In SQL, the DISTINCT keyword is used in SELECT statement to retrieve unique values from a database table. Any duplicate value will show up only once.
Syntax:
SELECT DISTINCT “column_name” FROM “table_name”;
In the above syntax “table_name” is the name of the table where data is stored, and “column_name” is the name of the column containing the data to be retrieved.
Examples:
The examples will use the following table:
Table Shipping

Example1: Use DISTINCT on one column
To select all distinct status in Table Shipping, we use following syntax:
SELECT DISTINCT status FROM Shipping;
Result:

Example2: Use DISTINCT on multiple columns
If we want to get a list showing all unique combinations of status and customer, we should use the following syntax:
SELECT DISTINCT status, customer FROM Shipping;
Result:
