# The Many Faces of DISTINCT in PostgreSQL

DevFeed: [The Many Faces of DISTINCT in PostgreSQL](<https://devfeed.tech/articles/the-many-faces-of-distinct-in-postgresql-33942.md>)

Original publisher: [Read original article](<https://hakibenita.com/the-many-faces-of-distinct-in-postgre-sql>)

Author: Haki Benita

Published: 2017-05-10T21:00:00Z

Content type: tutorial

Language: en

Sources: [Haki Benita](<https://devfeed.tech/sources/haki-benita.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Databases](<https://devfeed.tech/topics/databases.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [articles](<https://devfeed.tech/tags/articles.md>), [databases](<https://devfeed.tech/tags/databases.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [programming](<https://devfeed.tech/tags/programming.md>), [sql](<https://devfeed.tech/tags/sql.md>)

## AI overview

A tutorial on the different uses of DISTINCT in PostgreSQL, including removing duplicate rows, selecting the first row in each group with DISTINCT ON, and handling NULL comparisons in SQL.

## Source excerpt

I started my programming career as an Oracle DBA. It took a few years but eventually I got fed up with the corporate world and I went about doing my own thing. After I gotten over not having proper partitions and MERGE statement, I found some nice unique features in PostgreSQL. Oddly enough, a lot of them contained the word DISTINCT.