DISTINCT

The DISTINCT keywords return all the unique occurrences of values in a specific column from the table. It is very often used to make sure that duplicated rows of data are dealt with when necessary in the query.

To demonstrate the use of DISTINCT, let's query all distinct available categories from the products table.

SELECT DISTINCT(category) 
FROM products;
   category
---------------
 Electronics
 Audio
 Storage
 Monitors
 Laptops
 Auto
 Camera
 Office
 TV
 Accessories
 Home
 Gaming
 Personal Care
 Drones
 Health
 Smart Home
 Smartphones
 Kitchen
 Tablets
 Wearables
(20 rows)