Back to DATA RETRIEVAL & FILTERING

SELECT DISTINCT

Understand `DISTINCT` Clause

2 minutesVideo LessonPDF notes
🎯 Free Guest Mode: You are learning for free. Sign in to save your completion progress and quiz answers.

Ready to continue?

Mark this lesson as complete when you're ready to proceed.

Key moments

  1. SELECT DISTINCT Syntax — The `DISTINCT` keyword is placed after `SELECT` to ensure only unique rows are returned in the result set.
  2. Counting Unique Values — The `COUNT(DISTINCT column)` function is used to aggregate and report the total number of unique entries in a column.
  3. MS Access Limitation — Standard `COUNT(DISTINCT)` syntax is not supported in MS Access, requiring developers to use alternative query structures.
PDF notes

Frequently asked questions

Does SELECT DISTINCT slow down my query?

Yes, because the database must perform extra sorting or hashing operations to identify and eliminate duplicates before returning the result set.

What happens if I use DISTINCT with multiple columns?

The combination of values across all selected columns must be unique for the row to be returned; rows are only duplicates if all columns match.

Why is COUNT(DISTINCT) not supported everywhere?

It is due to variations in SQL dialects and historical implementation choices by specific database vendors, such as MS Access.

How was this lesson?

Your feedback helps us refine explanations and catch bugs.