What is the usage of the DISTINCT keyword?

The DISTINCT keyword is used to ensure that the fetched value is only a non-duplicate value. The DISTINCT keyword is used to SELECT DISTINCT, and it always fetches different (distinct) from the column of the table.

The DISTINCT keyword in SQL is used to eliminate duplicate records from the result set of a SELECT query. When you use the DISTINCT keyword in a SELECT statement, it instructs the database to return only unique values for the specified columns.

For example, consider the following query:

SELECT DISTINCT column1, column2
FROM your_table;

This query will retrieve unique combinations of values from column1 and column2 in the specified table, eliminating any duplicate rows.

In summary, the DISTINCT keyword is used to ensure that the result set contains only distinct (unique) values for the specified columns.