TL;DR – When a column contains duplicate values and you only need to list the distinct (different) ones, you can use the SELECT DISTINCT command.
Contents
Syntax of SQL SELECT DISTINCT
Example
SELECT DISTINCT column1, column2, ...
FROM table_name;
Examples using a demo database
The Developers table
ID | Name | City | Country |
---|---|---|---|
1 | Tom Kurkutis | New York | USA |
2 | Ana Fernandez | London | UK |
3 | Antonio Indigo | Paris | France |
4 | Aarav Kaelin | Delhi | India |
5 | Andrew Tumota | Miami | USA |
6 | Basma Zlata | Miami | USA |

Pros Main Features
- Simplistic design (no unnecessary information)
- High-quality courses (even the free ones)
- Variety of features
- Nanodegree programs
- Suitable for enterprises
- Paid certificates of completion

Pros Main Features
- Professional service
- Flexible timetables
- A variety of features to choose from
- Professional certificates of completion
- University-level courses
- Multiple Online degree programs

Pros Main Features
- Great user experience
- Offers quality content
- Very transparent with their pricing
- Free certificates of completion
- Focused on data science skills
- Flexible learning timetable
Selecting all values from one column
Selecting only distinct values from one column
Counting distinct values
Note: this example will not work in Microsoft Edge and Firefox, as they use Microsoft Access which doesn't support
COUNT(DISTINCT column_name)
.
In MS Access
Latest Udacity Coupon Found:
Verified STAFF PICK
75% OFF COURSES
Udacity Black Friday Offer
The best time to save on Udacity courses is now - follow this coupon to access a 75% Udacity Black Friday discount & enjoy learning at a very low cost!
Expiration date: 28/02/2021
3176 People Used
Only 97 Left