AI engineering glossary · SQL databases

What is DISTINCT?

DISTINCT: A keyword that removes duplicate rows from a result so each combination of the selected values appears once. It needs the database to sort or hash the rows, which can be expensive on big results.

Level: beginnerTopic: SQL databases

DISTINCT: an example

SELECT DISTINCT city FROM customers; lists each city once even if thousands of customers live there.

Related terms

More SQL databases terms

Where you learn it

DISTINCT is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.