Interview questions
Predict the result, find the errors, explain the solution. You can read the questions without an account.
300 questions
How many rows does an
INNER JOINreturn when the join keys contain duplicates andNULL?Predict the resultJOIN and row countsJuniorDoes swapping the tables change the result of a
LEFT JOIN?Predict the resultJOIN and row countsJuniorFrom interview write-ups: T-BankHow many rows does a
FULL JOINreturn?Predict the resultJOIN and row countsMiddleHow many rows does a
CROSS JOINreturn when the tables containNULL?Predict the resultJOIN and row countsJuniorWhat happens when you add a filter on the right table to the
WHEREclause of aLEFT JOIN?Predict the resultJOIN and row countsMiddleDoes a condition on the left table in
ONfilter out rows from aLEFT JOIN?Predict the resultJOIN and row countsMiddleWhat happens to
SUMafter aJOINwith order line items?Predict the resultJOIN and row countsMiddleHow many rows will a join between employees and their managers return?
Predict the resultJOIN and row countsJuniorWhich departments will this query identify as having no employees?
Predict the resultJOIN and row countsMiddleHow many orders does
COUNT(o.id)count for a customer with no orders?Predict the resultJOIN and row countsSeniorFind the bugs: count paid orders for every customer
Find the errorsJOIN and row countsMiddleFind the bugs: count orders and units purchased by customer
Find the errorsJOIN and row countsMiddleFind the bugs: employees and their managers
Find the errorsJOIN and row countsJuniorFind the bugs: total units purchased by each customer
Find the errorsJOIN and row countsMiddleWhat types of
JOINare there, and when would you use each?ExplainJOIN and row countsJuniorWhy does a condition in
WHEREturn aLEFT JOINinto an inner join?ExplainJOIN and row countsMiddleHow do you find unmatched rows, and why can
NOT INcause problems?ExplainJOIN and row countsSeniorWhich rows will a
JOINbetween orders and line items return after two filters?Predict the resultJOIN and row countsJuniorWho earns more than their manager in a
SELF JOIN?Predict the resultJOIN and row countsJuniorWhich pairs of customers from the same city will a
SELF JOINreturn?Predict the resultJOIN and row countsJuniorHow many rows will two consecutive
LEFT JOINoperations produce?Predict the resultJOIN and row countsMiddleWhich paid orders remain after excluding orders containing
pen?Predict the resultJOIN and row countsMiddleWhich rows will a
JOINbetween users and events return?Predict the resultJOIN and row countsJuniorHow many
login-to-viewpairs will a join create for each user?Predict the resultJOIN and row countsMiddleFind the bugs: order number and customer name
Find the errorsJOIN and row countsJuniorFind the bugs: counting line items in a customer's orders
Find the errorsJOIN and row countsMiddleFind the bugs: customers with three different products
Find the errorsJOIN and row countsMiddleWhat's the difference between
LEFT SEMI JOIN,LEFT ANTI JOIN, andLEFT ANY JOINin ClickHouse?ExplainJOIN and row countsMiddleHow does the optimizer choose the
JOINorder, and why do outer joins restrict it?ExplainJOIN and row countsSeniorWhat does
5 + NULLreturn?Predict the resultNULLJuniorFrom interview write-ups: T-BankWill
manager_id = NULLfind an employee with no manager?Predict the resultNULLJuniorWhat do
COUNT(*)andSUMreturn for a department with no employees?Predict the resultNULLJuniorWhat do
COUNT(*),COUNT(x), andCOUNT(DISTINCT x)return?Predict the resultNULLJuniorHow does
AVGhandleNULL?Predict the resultNULLMiddleWhat does
NOT INreturn when a subquery containsNULL?Predict the resultNULLMiddleWill
city = 'Berlin'andcity <> 'Berlin'include every customer?Predict the resultNULLMiddleWho does
ORDER BY salary DESC LIMIT 1return?Predict the resultNULLMiddleWhat does
CONCATreturn when one argument isNULL?Predict the resultNULLSeniorHow many groups does
GROUP BYcreate for a column containing multipleNULLvalues?Predict the resultNULLMiddleFind the bugs: employees missing a department or salary
Find the errorsNULLJuniorFind the bugs: paid orders excluding the test account
Find the errorsNULLMiddleFind the bugs: counting anonymous events
Find the errorsNULLSeniorWhat is three-valued logic in SQL?
ExplainNULLMiddleHow do
COUNT(*),COUNT(col), andCOUNT(DISTINCT col)differ?ExplainNULLJuniorWhat does
COALESCEreturn when a customer's city is missing?Predict the resultNULLJuniorHow does
CASEclassify an employee with a missing salary?Predict the resultNULLJuniorWhat does
NULLIFreturn for employee salaries?Predict the resultNULLJuniorFind the bugs: categorizing events by user
Find the errorsNULLMiddleWhat does
GREATESTreturn for two employee salaries?Predict the resultNULLMiddleHow many paying customers does
COUNT DISTINCT CASEcount?Predict the resultNULLMiddleWhat do the two window calculations return for the city values?
Predict the resultNULLMiddleFind the bugs: listing customers from Berlin
Find the errorsNULLJuniorWhich values remain after
EXCEPT ALL?Predict the resultNULLMiddleFind the bugs: matching values from two sources
Find the errorsNULLMiddleCan a foreign key contain
NULL?ExplainNULLMiddleCan you use a
SELECTalias inWHERE?Predict the resultQuery execution orderJuniorWill
SUMtotal only three orders if you addLIMIT 3?Predict the resultQuery execution orderJuniorWhat does
ORDER BYusing an alias return withLIMITandOFFSET?Predict the resultQuery execution orderJuniorHow many rows does a window function see when the query includes
WHERE?Predict the resultQuery execution orderMiddleCan you use an aggregate alias in
HAVING?Predict the resultQuery execution orderMiddleCan you sort
SELECT DISTINCTby a column outside the select list?Predict the resultQuery execution orderSeniorFind the bugs: employees earning above the company average
Find the errorsQuery execution orderJuniorFind the bugs: the most recently hired employee in each department
Find the errorsQuery execution orderMiddleFind the bugs: departments with at least two hires since 2021
Find the errorsQuery execution orderMiddleWhich runs last:
SELECT,FROM,WHERE, orGROUP BY?ExplainQuery execution orderJuniorFrom interview write-ups: T-BankDoes the database execute queries in logical order?
ExplainQuery execution orderSeniorWhich statuses do
DISTINCTandLIMIT 2return?Predict the resultQuery execution orderJuniorWhich groups remain after the
WHEREfilter?Predict the resultQuery execution orderJuniorWhich departments remain after
LEFT JOINandWHERE?Predict the resultQuery execution orderJuniorFind the bugs: paid orders report
Find the errorsQuery execution orderMiddleWhat happens when
LIMITis inside a subquery?Predict the resultQuery execution orderMiddleWill the ranking match the output order?
Predict the resultQuery execution orderMiddleWhat happens when you combine
DISTINCTwith a windowCOUNT?Predict the resultQuery execution orderMiddleWhat does
SELECT DISTINCT COUNT(*)return withGROUP BY?Predict the resultQuery execution orderMiddleFind the bugs: the three highest-value paid orders
Find the errorsQuery execution orderJuniorFind the bugs: total value of orders containing a specific product
Find the errorsQuery execution orderMiddleCan you sort groups by an aggregate that isn't in
SELECT?ExplainQuery execution orderMiddleWill
GROUP BYinclude a department with no employees?Predict the resultGROUP BY / HAVINGJuniorDoes
MAX(name)return the name of the highest-paid employee?Predict the resultGROUP BY / HAVINGJuniorWill a query using
GROUP BYrun ifSELECTincludes an ungrouped column?Predict the resultGROUP BY / HAVINGJuniorWhat does
WHEREfilter, and what doesHAVINGfilter?Predict the resultGROUP BY / HAVINGMiddleWill a customer with no paid orders disappear if the condition is inside
SUM?Predict the resultGROUP BY / HAVINGMiddleCan you add up unique user counts across groups?
Predict the resultGROUP BY / HAVINGMiddleWhat proportion of paid orders does
SUM(…) / COUNT(*)calculate?Predict the resultGROUP BY / HAVINGMiddleCan you select a column outside
GROUP BYwhen grouping by the primary key?Predict the resultGROUP BY / HAVINGSeniorFind the bugs: paid orders and unique buyers by month
Find the errorsGROUP BY / HAVINGJuniorFind the bugs: order counts and totals by customer
Find the errorsGROUP BY / HAVINGJuniorFind the bugs: units ordered and average unit price
Find the errorsGROUP BY / HAVINGMiddleFind the bugs: calculating company-wide average salary from department averages
Find the errorsGROUP BY / HAVINGMiddleWhat's the difference between
WHEREandHAVING?ExplainGROUP BY / HAVINGJuniorHow do you calculate the average price, and why does
AVG(price)give the wrong result here?ExplainGROUP BY / HAVINGMiddleWhich columns can you select in a query with
GROUP BY?ExplainGROUP BY / HAVINGSeniorFind the bugs: minimum paid order amount per customer
Find the errorsGROUP BY / HAVINGJuniorHow do you sum item quantities in groups defined by a condition?
Predict the resultGROUP BY / HAVINGJuniorHow does
GROUP BYaggregate orders with different statuses?Predict the resultGROUP BY / HAVINGJuniorWhat happens when you cap each order versus the group total?
Predict the resultGROUP BY / HAVINGMiddleHow do you safely calculate a ratio of two aggregates?
ExplainGROUP BY / HAVINGMiddleHow many rows does
HAVINGreturn withoutGROUP BY?Predict the resultGROUP BY / HAVINGMiddleHow many groups and orders does the outer query count?
Predict the resultGROUP BY / HAVINGMiddleWhich customers pass the
HAVINGcheck on order amounts?Predict the resultGROUP BY / HAVINGJuniorFind the bugs: revenue from repeat customers
Find the errorsGROUP BY / HAVINGMiddleFind the bugs: departments with payroll above the threshold
Find the errorsGROUP BY / HAVINGMiddleHow do you combine product names into one string per order?
ExplainGROUP BY / HAVINGMiddleHow do you avoid double-counting when aggregating after a
JOIN?ExplainGROUP BY / HAVINGSeniorWhat numbers will
ROW_NUMBER,RANK, andDENSE_RANKassign to employees in department 2?Predict the resultWindow functionsJuniorHow many rows will a query using
SUM(salary) OVER (PARTITION BY department_id)return?Predict the resultWindow functionsJuniorWhat does
LAGreturn for the first row?Predict the resultWindow functionsJuniorWhat happens to a running total when the window's
ORDER BYcontains ties?Predict the resultWindow functionsMiddleWhat does
LAST_VALUEreturn with the default window frame?Predict the resultWindow functionsMiddleHow does
NTILE(4)split 10 rows?Predict the resultWindow functionsMiddleWill a query using
QUALIFYrun?Predict the resultWindow functionsMiddleCan you nest an aggregate inside a window function:
SUM(COUNT(*)) OVER ()?Predict the resultWindow functionsSeniorWhat does grouping by
id - ROW_NUMBER()find?Predict the resultWindow functionsSeniorFind the bugs: Show each employee's salary alongside their department's average
Find the errorsWindow functionsJuniorFind the bugs: running total of payments for each customer
Find the errorsWindow functionsJuniorFind the bugs: three-order moving average
Find the errorsWindow functionsMiddleFind the bugs: an employee's percentage of department payroll
Find the errorsWindow functionsMiddleWhat is a window function, and how does
PARTITION BYdiffer fromGROUP BY?ExplainWindow functionsJuniorWhat's the difference between
ROW_NUMBER,RANK, andDENSE_RANK?ExplainWindow functionsJuniorWhat is a window frame, and how does
ROWSdiffer fromRANGE?ExplainWindow functionsSeniorHow do you calculate month-over-month revenue growth?
ExplainWindow functionsMiddleWhat will this
LEADquery return?Predict the resultWindow functionsJuniorFind the bugs: Count a user's earlier events
Find the errorsWindow functionsMiddleHow does
ROW_NUMBERwork when event types alternate?Predict the resultWindow functionsJuniorWhat does SUM return with a ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING frame?
Predict the resultWindow functionsMiddleFind the bugs: Order number and total orders per customer
Find the errorsWindow functionsMiddleWhat percentage ranks will
PERCENT_RANKassign based on employee salaries?Predict the resultWindow functionsMiddleWhat does
RANKreturn when orders are grouped by status?Predict the resultWindow functionsMiddleWhich names will
NTH_VALUEreturn when ordered by hire date?Predict the resultWindow functionsMiddleFind the bugs: two most recent events per user
Find the errorsWindow functionsJuniorWhat will
FIRST_VALUEandMINreturn for a customer's orders?Predict the resultWindow functionsJuniorHow do you analyze an event sequence with
LAGandLEAD?ExplainWindow functionsMiddleHow do you calculate the median salary for each department using window functions?
ExplainWindow functionsSeniorWhich duplicates does
GROUP BY … HAVING COUNT(*) > 1find?Predict the resultDuplicates and top NJuniorWill
LIMIT 1 OFFSET 1return the second-highest salary?Predict the resultDuplicates and top NJuniorHow many rows will
DENSE_RANKreturn for the top 2 salaries in each department?Predict the resultDuplicates and top NMiddleWill an event without a user appear in the “latest event per user” results?
Predict the resultDuplicates and top NMiddleWhich order will
DISTINCT ONkeep for each customer?Predict the resultDuplicates and top NMiddleHow many rows does
FETCH FIRST 2 ROWS WITH TIESreturn?Predict the resultDuplicates and top NSeniorFind the bugs: Count distinct events per user
Find the errorsDuplicates and top NJuniorFind the bugs: Which rows remain after deduplication?
Find the errorsDuplicates and top NMiddleFind the bugs: Highest-paid employees in each department
Find the errorsDuplicates and top NMiddleFind the bugs: Second-highest salary in each department
Find the errorsDuplicates and top NSeniorHow do you find and remove duplicates while keeping one row?
ExplainDuplicates and top NMiddleHow do you find the second-highest salary?
ExplainDuplicates and top NJuniorWhich events will a query with
LIMITandOFFSETreturn?Predict the resultDuplicates and top NJuniorWhat remains after applying
UNION DISTINCTto two tables?Predict the resultDuplicates and top NJuniorFind the bugs: Deduplicating an event log
Find the errorsDuplicates and top NJuniorWhich row will
ROW_NUMBERkeep for each product?Predict the resultDuplicates and top NJuniorWhich rows will a query with
GROUP BYandLIMITreturn?Predict the resultDuplicates and top NMiddleWhich city and order status pairs will
DISTINCTkeep?Predict the resultDuplicates and top NJuniorWhat will a query using
DISTINCTandUNION ALLreturn?Predict the resultDuplicates and top NMiddleHow do you paginate when the sort key can change?
ExplainDuplicates and top NSeniorFind the bugs: Each customer's latest paid order
Find the errorsDuplicates and top NMiddleFind the bugs: Top two products by units sold
Find the errorsDuplicates and top NMiddleWhich rows pass the running total filter?
Predict the resultDuplicates and top NMiddleHow many January orders does
BETWEEN '2026-01-01' AND '2026-01-31'find?Predict the resultDatesJuniorWhat do
CAST(created_at AS DATE) = …andcreated_at = CAST(… AS DATE)count?Predict the resultDatesJuniorWill
DATE_TRUNC('month', created_at)run successfully?Predict the resultDatesMiddleHow many days does date subtraction return between January 31 and February 1?
Predict the resultDatesMiddleOn how many days was each user active?
Predict the resultDatesMiddleWhat does
created_at + INTERVAL '1' MONTHreturn for orders placed at the end of a month?Predict the resultDatesMiddleFind the bugs: paid orders in February
Find the errorsDatesJuniorFind the bugs: hires by month
Find the errorsDatesJuniorFind the bugs: DAU for the last three days
Find the errorsDatesMiddleFind the bugs: employees with at least five years of service
Find the errorsDatesMiddleHow do you filter rows for a month when the column also contains a time?
ExplainDatesJuniorWhich employees match
EXTRACT(DAY FROM hired_at) = 1?Predict the resultDatesJuniorHow many events fall within a five-minute window?
Predict the resultDatesJuniorWhich orders match the midnight-hour filter?
Predict the resultDatesJuniorWhich users were active on both sides of the month boundary?
Predict the resultDatesMiddleHow many earlier paid orders does a temporal
SELF JOINfind?Predict the resultDatesMiddleWhat does grouping events by hour return?
Predict the resultDatesMiddleWhich orders were placed after each user's last event?
Predict the resultDatesMiddleFind the bugs: time of each customer's latest payment
Find the errorsDatesJuniorFind the bugs: customer events before an order
Find the errorsDatesMiddleFind the bugs: customers whose first order was in March
Find the errorsDatesMiddleHow do you handle late-arriving events in date-based reports?
ExplainDatesSeniorHow many departments does this
EXISTSquery return?Predict the resultSubqueries, CTEs, EXISTS / IN, UNIONJuniorCan a subquery in
FROMrun without an alias?Predict the resultSubqueries, CTEs, EXISTS / IN, UNIONMiddleWhich orders does
EXISTSfind when checking for a later order?Predict the resultSubqueries, CTEs, EXISTS / IN, UNIONMiddleHow many customers does
INfind when the subquery returnsNULL?Predict the resultSubqueries, CTEs, EXISTS / IN, UNIONMiddleHow many rows does
UNION ALLreturn withLIMIT 3at the end?Predict the resultSubqueries, CTEs, EXISTS / IN, UNIONMiddleHow many rows will
INTERSECTreturn for paid orders and customers fromBerlin?Predict the resultSubqueries, CTEs, EXISTS / IN, UNIONMiddleHow many employees from
Saleswill this query find?Predict the resultSubqueries, CTEs, EXISTS / IN, UNIONSeniorFind the bugs: orders from Berlin customers
Find the errorsSubqueries, CTEs, EXISTS / IN, UNIONJuniorFind the bugs: the highest-priced item in each order
Find the errorsSubqueries, CTEs, EXISTS / IN, UNIONMiddleFind the bugs: employee reporting hierarchy
Find the errorsSubqueries, CTEs, EXISTS / IN, UNIONMiddleWhat's the difference between
UNIONandUNION ALL?ExplainSubqueries, CTEs, EXISTS / IN, UNIONJuniorWhat is a correlated subquery?
ExplainSubqueries, CTEs, EXISTS / IN, UNIONJuniorHow does
INwith a subquery differ fromEXISTS?ExplainSubqueries, CTEs, EXISTS / IN, UNIONMiddleHow does a CTE differ from a subquery, and is it materialized?
ExplainSubqueries, CTEs, EXISTS / IN, UNIONSeniorWho earns more than the highest-paid employee in
Sales?Predict the resultSubqueries, CTEs, EXISTS / IN, UNIONJuniorWhat does a subquery in the
SELECTlist return?Predict the resultSubqueries, CTEs, EXISTS / IN, UNIONJuniorWhich orders have totals above the average for paid orders?
Predict the resultSubqueries, CTEs, EXISTS / IN, UNIONMiddleWhich values does the nested query with
EXCEPTreturn?Predict the resultSubqueries, CTEs, EXISTS / IN, UNIONJuniorWhich customers pass the aggregate filter?
Predict the resultSubqueries, CTEs, EXISTS / IN, UNIONMiddleWhich customers have only paid orders?
Predict the resultSubqueries, CTEs, EXISTS / IN, UNIONMiddleWhich department will the nested
MAXselect?Predict the resultSubqueries, CTEs, EXISTS / IN, UNIONMiddleFind the bugs: orders with at least two line items
Find the errorsSubqueries, CTEs, EXISTS / IN, UNIONJuniorFind the bugs: customers with multiple paid orders
Find the errorsSubqueries, CTEs, EXISTS / IN, UNIONMiddleFind the bugs: three required event types
Find the errorsSubqueries, CTEs, EXISTS / IN, UNIONMiddleWhen can you push a filter into a subquery?
ExplainSubqueries, CTEs, EXISTS / IN, UNIONSeniorHow many rows will a name search return if you remove
LOWER?Predict the resultIndexesMiddleWill the table accept a second row with the same primary key?
Predict the resultIndexesSeniorFind the bugs: a customer's two most recent orders
Find the errorsIndexesJuniorFind the bugs: the latest paid and cancelled orders
Find the errorsIndexesMiddleWhat is a database index, and why do we use one?
ExplainIndexesJuniorHow does column order in a composite index affect queries?
ExplainIndexesMiddleWhat is a covering index, and what is an
Index Only Scan?ExplainIndexesSeniorWhy doesn't
LIKE '%abc%'use a regular index?ExplainIndexesJuniorWhy can applying a function to a column prevent index usage?
ExplainIndexesJuniorHow do indexes slow down writes, and what is a HOT update?
ExplainIndexesSeniorHow does the primary key work in ClickHouse?
ExplainIndexesSeniorHow many rows does a non-unique index lookup return?
Predict the resultIndexesJuniorWhich salaries fall within a
BETWEENrange?Predict the resultIndexesJuniorWhich orders match the status and total filters?
Predict the resultIndexesJuniorFind the bugs: retrieving items from two orders
Find the errorsIndexesMiddleFind the bugs: orders for two customer scenarios
Find the errorsIndexesJuniorFind the bugs: Exporting employee records for HR
Find the errorsIndexesMiddleHow would you index JSONB searches in PostgreSQL?
ExplainIndexesMiddleDoes a foreign key automatically create an index?
ExplainIndexesMiddleHow does a unique index handle
NULL?ExplainIndexesSeniorHow does an InnoDB clustered index differ from a regular index?
ExplainIndexesMiddleWhen is a partial index useful in PostgreSQL?
ExplainIndexesMiddleHow does a hash index differ from a B-tree index?
ExplainIndexesJuniorHow do data-skipping indexes work in ClickHouse?
ExplainIndexesSeniorHow do you diagnose index bloat?
ExplainIndexesSeniorWhat appears on the second page with
OFFSETif a new event arrives?Predict the resultEXPLAIN and optimizationJuniorHow many rows will an
ORquery return when rewritten withUNION ALL?Predict the resultEXPLAIN and optimizationMiddleFind the bugs: the second page of a feed without
OFFSETFind the errorsEXPLAIN and optimizationMiddleWhat's the difference between
EXPLAINandEXPLAIN ANALYZE?ExplainEXPLAIN and optimizationJuniorWhat is the N+1 query problem?
ExplainEXPLAIN and optimizationJuniorWhy did the planner choose
Seq Scaneven though an index exists?ExplainEXPLAIN and optimizationMiddleHow do you read an
EXPLAIN ANALYZEplan in PostgreSQL?ExplainEXPLAIN and optimizationMiddleWhy does
OFFSETpagination slow down, and what can replace it?ExplainEXPLAIN and optimizationMiddleWhat does a filter return after row numbering?
Predict the resultEXPLAIN and optimizationJuniorFind the bugs: high-value paid orders from two customers
Find the errorsEXPLAIN and optimizationMiddleWhat does
Recheck Condmean in a PostgreSQL execution plan?ExplainEXPLAIN and optimizationSeniorWhy doesn't PostgreSQL use a parallel execution plan?
ExplainEXPLAIN and optimizationSeniorFind the bugs: orders containing two product types
Find the errorsEXPLAIN and optimizationMiddleWhich employees match this name pattern?
Predict the resultEXPLAIN and optimizationJuniorWhat does
Sortmean in a query execution plan?ExplainEXPLAIN and optimizationJuniorWhy can
SELECT *slow down a query?ExplainEXPLAIN and optimizationJuniorHow do
Nested Loop,Hash Join, andMerge Joindiffer?ExplainEXPLAIN and optimizationMiddleWhy does the planner get row-count estimates wrong?
ExplainEXPLAIN and optimizationMiddleWhen does it make sense to aggregate data before a
JOIN?ExplainEXPLAIN and optimizationMiddleHow can you tell whether a SQL query is CPU-bound or I/O-bound?
ExplainEXPLAIN and optimizationSeniorHow can you tell which table partitions were actually scanned?
ExplainEXPLAIN and optimizationMiddleWhy does the same SQL query perform differently with different parameters?
ExplainEXPLAIN and optimizationSeniorWill
FOR UPDATE SKIP LOCKEDwork withoutBEGIN?Predict the resultTransactions and locksMiddleCan you use
COUNT(*)withFOR UPDATE?Predict the resultTransactions and locksSeniorFind the bugs: long-running transactions
Find the errorsTransactions and locksMiddleWhat is a transaction, and what does ACID mean?
ExplainTransactions and locksJuniorWhy can't the application see your
UPDATE?ExplainTransactions and locksJuniorWhat are the transaction isolation levels, and which anomalies do they prevent?
ExplainTransactions and locksMiddleWhat can go wrong when two withdrawals hit the same account at once?
ExplainTransactions and locksMiddleWhat is a deadlock, and how can you prevent one?
ExplainTransactions and locksJuniorWhat is MVCC, and why does PostgreSQL need
VACUUM?ExplainTransactions and locksSeniorWhich sessions are idle with an open transaction?
Predict the resultTransactions and locksJuniorHow would you handle two managers editing the same customer record?
ExplainTransactions and locksMiddleHow would you prevent overlapping reservations under concurrent requests in InnoDB?
ExplainTransactions and locksSeniorFind the bugs: selecting orders for processing
Find the errorsTransactions and locksMiddleWhat happens when you lock an order and its line items?
Predict the resultTransactions and locksMiddleFind the bugs: paid orders with no items
Find the errorsTransactions and locksJuniorHow does
autocommitaffect multiple statements?ExplainTransactions and locksJuniorHow would a QA engineer test the atomicity of an order operation?
ExplainTransactions and locksJuniorWhy use
SAVEPOINTand partial rollbacks?ExplainTransactions and locksMiddleHow do you avoid losing an event when saving an order?
ExplainTransactions and locksMiddleWhat's the difference between waiting for a lock,
NOWAIT, andSKIP LOCKED?ExplainTransactions and locksMiddleWhat happens to an order ID when a transaction rolls back?
ExplainTransactions and locksMiddleWhy does InnoDB use
gap locksandnext-key locks?ExplainTransactions and locksSeniorHow do you safely retry a transaction after an error?
ExplainTransactions and locksSeniorHow does
Sagadiffer from two-phase commit?ExplainTransactions and locksSeniorCan you insert a second
NULLinto a column with aUNIQUEconstraint?Predict the resultDDL, keys, and normalizationJuniorWill a foreign key allow an order for a nonexistent customer?
Predict the resultDDL, keys, and normalizationSeniorFind the bugs: SQL newsletter subscribers
Find the errorsDDL, keys, and normalizationJuniorFind the bugs: orders with totals that don't match their line items
Find the errorsDDL, keys, and normalizationMiddleWhat are primary keys, unique keys, and foreign keys?
ExplainDDL, keys, and normalizationJuniorWhat's the difference between
DELETE,TRUNCATE, andDROP?ExplainDDL, keys, and normalizationJuniorWhat is normalization, and when should you denormalize?
ExplainDDL, keys, and normalizationMiddleHow do you add a constraint to a large table under load?
ExplainDDL, keys, and normalizationSeniorFind the bugs: checking data before changing a column
Find the errorsDDL, keys, and normalizationJuniorCan you add a customer with an existing name?
Predict the resultDDL, keys, and normalizationJuniorCan you insert
NULLinto a required column?Predict the resultDDL, keys, and normalizationJuniorWill the schema allow a negative item quantity?
Predict the resultDDL, keys, and normalizationJuniorHow would you design a schema for scheduling future tasks in local time?
ExplainDDL, keys, and normalizationMiddleFind the bugs: validating order statuses before a migration
Find the errorsDDL, keys, and normalizationJuniorHow do you insert rows with circular foreign keys?
ExplainDDL, keys, and normalizationMiddleWhy use
DECIMALinstead ofFLOATfor money?ExplainDDL, keys, and normalizationJuniorHow do
DEFAULT,CHECK, andNOT NULLwork together?ExplainDDL, keys, and normalizationJuniorWhat happens when you insert an empty string into a required field?
Predict the resultDDL, keys, and normalizationJuniorHow would you design a many-to-many relationship?
ExplainDDL, keys, and normalizationMiddleWhen should you use
ENUM,CHECK, or a status lookup table?ExplainDDL, keys, and normalizationMiddleHow would you choose between
BIGINT,UUID, and ID generation strategies?ExplainDDL, keys, and normalizationSeniorHow would you combine soft deletes with email uniqueness?
ExplainDDL, keys, and normalizationSeniorHow would you change a database schema without deploying all services at once?
ExplainDDL, keys, and normalizationSenior