Search⌘ K
AI Features

Fetching Unique Results

Explore how to apply the DISTINCT keyword in SQL SELECT queries to retrieve unique records and avoid duplicates. Understand handling multiple fields with DISTINCT and create queries that produce distinct combinations of values.

The DISTINCT keyword

Let’s write a query to retrieve ProductCategories. Run the following query to show results:

MySQL
SELECT ProductCategory FROM SalesData;

It extracts the ProductCategory names from all ...