How do you use the DISTINCT keyword in SQL?

In SQL, the DISTINCT keyword is used to retrieve a unique result set.

The basic syntax of using the DISTINCT keyword is as follows:
SELECT DISTINCT column1, column2, …
FROM table_name;

column1, column2, … are the names of the columns to be returned, and table_name is the name of the table to be queried.

By using the DISTINCT keyword, you can eliminate duplicate rows in the result set.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds