Loading

Quipoin Menu

Learn • Practice • Grow

sql / Window Functions
mcq
Direction: Choose the correct option

Q1.

What are window functions?
A. Table functions
B. Index functions
C. Aggregate functions
D. Functions that operate on row sets without grouping
Direction: Choose the correct option

Q2.

SELECT name, department, salary, ROW_NUMBER() OVER (PARTITION BY department ORDER BY salary DESC) FROM employees;
What does PARTITION BY do?
A. Sorts rows
B. Divides rows into groups
C. Divides table
D. Groups by department
Direction: Choose the correct option

Q3.

What's the difference between RANK() and DENSE_RANK()?
A. RANK is faster
B. RANK leaves gaps after ties, DENSE_RANK doesn't
C. DENSE_RANK leaves gaps
D. Both same
Direction: Choose the correct option

Q4.

SELECT order_date, amount, SUM(amount) OVER (ORDER BY order_date) FROM orders;
What does this calculate?
A. Average amount
B. Total amount
C. Running total of amounts
D. Maximum amount
Direction: Choose the correct option

Q5.

SELECT name, salary, LAG(salary, 1) OVER (ORDER BY salary) FROM employees;
What does LAG() do?
A. Access previous row's value
B. Next row's value
C. First row's value
D. Last row's value