Chapter 1 · 6 min

Selecting columns

Every SQL interview starts the same way: can you get the right rows out of a table without dragging the whole table along? The SELECT clause names the columns you want, and FROM names where they come from.

SELECT order_id, customer_id, order_date
FROM orders
LIMIT 10;

Three habits separate a query that works from one an interviewer trusts:

A column can also be renamed in the output with AS. That matters in interviews more than in production: the question usually specifies the exact column names it expects back, and a grader — human or automated — will compare against those names.