Projecting Columns and Aliasing Pitfalls
Why you cannot reference a SELECT alias in WHERE, and how interviewers test alias scope.
Projection: Choosing Your Columns
Picking which columns a query returns is called projection — that's what you do every time you write SELECT. Name them explicitly in real code; save SELECT * for quick exploring.
SELECT id, first_name, email
FROM employees;Why Interviewers Dislike SELECT *
Why do interviewers dislike SELECT * in app code? It's fragile (column order can shift), wastes bandwidth, hurts index use, and hides what you actually need. Name your columns. 👍
All lessons in this course
- Projecting Columns and Aliasing Pitfalls
- Computed Columns and Expression Precedence
- DISTINCT vs GROUP BY for Uniqueness
- CASE Expressions in SELECT