SELECT DISTINCT:
The SQL DISTINCT keyword is used in conjunction with SELECT statement to eliminate all the duplicate records and fetching only unique records.
There may be a situation when have multiple duplicate records in a table. While fetching such records, it makes more sense to fetch only unique records instead of fetching duplicate records.
SYNTAX:
SELECT DISTINCT column1, column2....columnN
FROM table_name;
EXAMPLE:
SELECT DISTINCT name from student;
Displays only the values of the column name without any duplicates present in the table.
No comments:
Post a Comment