SQL Query Fundamentals Questions

Core SQL for reading and shaping data: SELECT, filtering with WHERE, sorting, DISTINCT, and single-table aggregation with GROUP BY, HAVING, and aggregate functions. Covers reasoning about NULL handling, grouping semantics, and writing correct queries against a given schema. The baseline query-writing surface most data and engineering interviews open with.

EasyTechnical
41 practiced

Given transactions(transaction_id, user_id, amount DECIMAL(9,2), occurred_at), write a query returning transactions with amount between $50 and $500 inclusive. Show the equivalent query using explicit >= and <= instead of BETWEEN, and state whether BETWEEN is inclusive on both ends.

EasyTechnical
56 practiced

Describe the practical differences between DELETE, TRUNCATE, and DROP. Cover transactional behavior and rollback, performance, permission requirements, and whether triggers fire for each.

EasyTechnical
48 practiced

Explain the difference between INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN, with a short example of when each would be used.

MediumTechnical
44 practiced

Given customers(id), orders(order_id, customer_id), and order_items(order_item_id, order_id, product_id, qty, unit_price), compute total revenue per customer. Explain why joining customers directly to order_items and then grouping can silently double-count revenue, and show the safe pattern: pre-aggregate order_items to order totals first, then join up to customers.

EasyTechnical
38 practiced

Why should production dashboards and ETL queries avoid SELECT *? Give at least three concrete reasons (performance, schema drift, readability) with examples of better alternatives.

Unlock Full Question Bank

Get access to all SQL Query Fundamentals interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.