Stage 2 · Lesson 1 of 8
SELECT, FROM, aliases and DISTINCT
Every read starts with , which lists the columns or calculations you want, and FROM, which names the table. Give a calculated column a clear name with AS, such as price * 0.9 AS sale_price. Give tables short aliases too (nicknames like c for customers), because you will need them once you join tables.
removes duplicate rows, comparing all the selected columns together. It answers questions like which countries have customers. In any query you save, name the columns you want.
SELECT * is fine for exploring, but it fetches data you do not need and breaks when someone adds a column.
Common trapusing DISTINCT to hide duplicates caused by a mistake, which you will meet again when joins multiply rows in the next stage.
A question to check yourself, an AI practice session and 2 cheat sheet entries come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking SQL for Tech Interviews
Design Gurus · Intermediate · Subscription
The basics, order of execution and functions chapters, each followed by graded problems
- CourseFreeSQLBolt
SQLBolt · Beginner
Free: Lessons 1 to 4, 8, 9 and 12 cover SELECT, filtering, sorting, NULLs, expressions and query order
Practise
Keep handy
Also worth your time
Walks through the logical order a query is evaluated in, which explains most early errors