Sobes.tech
Junior — Middle

What is the purpose of the DISTINCT operator in SQL queries?

sobes.tech AI

Answer from AI

The DISTINCT operator in SQL is used to remove duplicates from the query result. It returns only unique rows based on the selected columns. For example, if there are repeating values in a table, with DISTINCT you will get each value only once.

Example:

SELECT DISTINCT country FROM customers;

This query will return a list of unique countries from the customers table.

What is the purpose of the DISTINCT operator in SQL… - sobes.tech