Example 4: Find Unique Hire Dates
Query:
SELECT DISTINCT DATE(hire_date) AS unique_hire_date FROM worker;
This query will retrieve a list of unique hire dates from the worker table aliasing the result as unique_hire_date.
Output:
DISTINCT Clause in MariaDB
MariaDB uses SQL (Structured Query Language) and is an open-source relational database management system (RDBMS) for managing and manipulating data. With the help of the MariaDB DISTINCT clause, you can efficiently extract unique values from a given column or collection of columns in query results. In SELECT queries, this clause is frequently used to remove duplicate rows and show only unique data. Let’s examine the specifics of MariaDB’s DISTINCT clause.