Interview questions
Predict the result, find the errors, explain the solution. You can read the questions without an account.
Topic: Window functionsReset all
29 questions
What numbers will
ROW_NUMBER,RANK, andDENSE_RANKassign to employees in department 2?Predict the resultJuniorHow many rows will a query using
SUM(salary) OVER (PARTITION BY department_id)return?Predict the resultJuniorWhat does
LAGreturn for the first row?Predict the resultJuniorWhat happens to a running total when the window's
ORDER BYcontains ties?Predict the resultMiddleWhat does
LAST_VALUEreturn with the default window frame?Predict the resultMiddleHow does
NTILE(4)split 10 rows?Predict the resultMiddleWill a query using
QUALIFYrun?Predict the resultMiddleCan you nest an aggregate inside a window function:
SUM(COUNT(*)) OVER ()?Predict the resultSeniorWhat does grouping by
id - ROW_NUMBER()find?Predict the resultSeniorFind the bugs: Show each employee's salary alongside their department's average
Find the errorsJuniorFind the bugs: running total of payments for each customer
Find the errorsJuniorFind the bugs: three-order moving average
Find the errorsMiddleFind the bugs: an employee's percentage of department payroll
Find the errorsMiddleWhat will this
LEADquery return?Predict the resultJuniorFind the bugs: Count a user's earlier events
Find the errorsMiddleHow does
ROW_NUMBERwork when event types alternate?Predict the resultJuniorWhat does SUM return with a ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING frame?
Predict the resultMiddleFind the bugs: Order number and total orders per customer
Find the errorsMiddleWhat percentage ranks will
PERCENT_RANKassign based on employee salaries?Predict the resultMiddleWhat does
RANKreturn when orders are grouped by status?Predict the resultMiddleWhich names will
NTH_VALUEreturn when ordered by hire date?Predict the resultMiddleFind the bugs: two most recent events per user
Find the errorsJuniorWhat will
FIRST_VALUEandMINreturn for a customer's orders?Predict the resultJunior