Javatpoint Logo
Javatpoint Logo


MariaDB DISTINCT Clause is used to remove duplicates from the result when we use it with SELECT statement.


Note: When you use only expression in DISTINCT clause, the query will return the unique values for that expression.When you use multiple expression in
the DISTINCT clause, the query will return unique combinations for the multiple expressions listed.
The DISTINCT clause doesn't ignore NULL values. So when using the DISTINCT clause in your SQL statement, your result set will include NULL as a distinct value.


Using Single Expression

We have a table name "Students", having some duplicate entries. A name "Ajeet" is repeated three times.

Mariadb Distinct clause 1

Let's use the DISTINCT clause to remove duplicates from the table.


Mariadb Distinct clause 2

You can see that "Ajeet" is repeated three times in the original "Students" table but after using DISTINCT clause, it is returned one time and duplicate entries are deleted.

Using Multiple Expressions

You can use DISTINCT clause to remove duplicates from more than one expression in MariaDB.


Mariadb Distinct clause 3

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA