Interview questions
Predict the result, find the errors, explain the solution. You can read the questions without an account.
Topic: JOIN and row countsReset all
29 questions
How many rows does an
INNER JOINreturn when the join keys contain duplicates andNULL?Predict the resultJuniorDoes swapping the tables change the result of a
LEFT JOIN?Predict the resultJuniorFrom interview write-ups: T-BankHow many rows does a
FULL JOINreturn?Predict the resultMiddleHow many rows does a
CROSS JOINreturn when the tables containNULL?Predict the resultJuniorWhat happens when you add a filter on the right table to the
WHEREclause of aLEFT JOIN?Predict the resultMiddleDoes a condition on the left table in
ONfilter out rows from aLEFT JOIN?Predict the resultMiddleWhat happens to
SUMafter aJOINwith order line items?Predict the resultMiddleHow many rows will a join between employees and their managers return?
Predict the resultJuniorWhich departments will this query identify as having no employees?
Predict the resultMiddleHow many orders does
COUNT(o.id)count for a customer with no orders?Predict the resultSeniorFind the bugs: count paid orders for every customer
Find the errorsMiddleFind the bugs: count orders and units purchased by customer
Find the errorsMiddleFind the bugs: employees and their managers
Find the errorsJuniorFind the bugs: total units purchased by each customer
Find the errorsMiddleWhich rows will a
JOINbetween orders and line items return after two filters?Predict the resultJuniorWho earns more than their manager in a
SELF JOIN?Predict the resultJuniorWhich pairs of customers from the same city will a
SELF JOINreturn?Predict the resultJuniorHow many rows will two consecutive
LEFT JOINoperations produce?Predict the resultMiddleWhich paid orders remain after excluding orders containing
pen?Predict the resultMiddleWhich rows will a
JOINbetween users and events return?Predict the resultJuniorHow many
login-to-viewpairs will a join create for each user?Predict the resultMiddleFind the bugs: order number and customer name
Find the errorsJuniorFind the bugs: counting line items in a customer's orders
Find the errorsMiddleFind the bugs: customers with three different products
Find the errorsMiddle