Interview questions
Predict the result, find the errors, explain the solution. You can read the questions without an account.
26 questions
What does
5 + NULLreturn?Predict the resultJuniorFrom interview write-ups: T-BankWill
manager_id = NULLfind an employee with no manager?Predict the resultJuniorWhat do
COUNT(*)andSUMreturn for a department with no employees?Predict the resultJuniorWhat do
COUNT(*),COUNT(x), andCOUNT(DISTINCT x)return?Predict the resultJuniorHow does
AVGhandleNULL?Predict the resultMiddleWhat does
NOT INreturn when a subquery containsNULL?Predict the resultMiddleWill
city = 'Berlin'andcity <> 'Berlin'include every customer?Predict the resultMiddleWho does
ORDER BY salary DESC LIMIT 1return?Predict the resultMiddleWhat does
CONCATreturn when one argument isNULL?Predict the resultSeniorHow many groups does
GROUP BYcreate for a column containing multipleNULLvalues?Predict the resultMiddleFind the bugs: employees missing a department or salary
Find the errorsJuniorFind the bugs: paid orders excluding the test account
Find the errorsMiddleFind the bugs: counting anonymous events
Find the errorsSeniorWhat is three-valued logic in SQL?
ExplainMiddleWhat does
COALESCEreturn when a customer's city is missing?Predict the resultJuniorHow does
CASEclassify an employee with a missing salary?Predict the resultJuniorWhat does
NULLIFreturn for employee salaries?Predict the resultJuniorFind the bugs: categorizing events by user
Find the errorsMiddleWhat does
GREATESTreturn for two employee salaries?Predict the resultMiddleHow many paying customers does
COUNT DISTINCT CASEcount?Predict the resultMiddleWhat do the two window calculations return for the city values?
Predict the resultMiddleFind the bugs: listing customers from Berlin
Find the errorsJuniorWhich values remain after
EXCEPT ALL?Predict the resultMiddleFind the bugs: matching values from two sources
Find the errorsMiddle