SQL Data Analytics ยท Lesson 3
SELECT, DISTINCT & Aliases
Learn to select only the columns you need, remove duplicate results and make query outputs easier to understand.
0 of 8 concepts passed
SELECT Exactly What You Need
SELECT tells SQL which columns to return. Choosing only the columns needed for a report makes results easier to read and avoids carrying unnecessary data.
Remember
SELECT name, city returns just the two requested columns.
Analyst habit
Predict the output, check the result, and confirm that it answers the business question.
Interactive data lab
Select specific columns
SELECT name, city FROM Customers;
The result contains name and city for each customer. The customer_id and state columns are not included.
Customers sample table
Click a city chip to inspect repeated values
| ID | Name | City | State |
|---|---|---|---|
| 101 | Rahul | Delhi | Delhi |
| 102 | Priya | Mumbai | Maharashtra |
| 103 | Amit | Pune | Maharashtra |
| 104 | Neha | Delhi | Delhi |
| 105 | Arjun | Mumbai | Maharashtra |
Unique city chips
Sample has 5 customers and 3 unique cities.
Interactive activity ยท Part 1
A report needs each customer's name and city. Which columns should you select?
Choose an option, then check it. You must pass this activity before the related MCQ unlocks.
Hint: Focus on the two fields explicitly requested by the report.
Concept FAQ
Questions about this concept
What You Will Learn in SQL Lesson 3
Practice choosing columns with SELECT, predicting query output, removing duplicates with DISTINCT, evaluating multi-column combinations, and using column and table aliases.
Why These Skills Matter in Business
Analysts use SELECT to focus reports, DISTINCT to discover categories, and aliases to make outputs understandable to managers and stakeholders.
Common Beginner Mistakes
- Assuming SELECT removes duplicates automatically.
- Thinking DISTINCT deletes records from the source table.
- Assuming DISTINCT on two columns deduplicates each column separately.
- Confusing a temporary alias with a permanent database rename.
- Expecting DISTINCT to sort results without ORDER BY.
Frequently Asked Questions
What is the difference between SELECT and SELECT DISTINCT?
SELECT returns rows based on the selected columns. SELECT DISTINCT removes duplicate result rows across the selected columns.
Does DISTINCT change data in the database?
No. It affects the query result only.
What is a column alias?
A temporary label for a result column, commonly assigned with AS.
What is a table alias?
A temporary short name for a table within a query.
What comes next after this lesson?
Lesson 4 introduces filtering rows with WHERE so you can retrieve records that meet conditions.