Good Morning to all,
We know the uses of DISTINCT keyword in SQL. Here I share some usesful information relates to “Retrieve the unique rows without using the DISTINCT keyword.”
The DISTINCT keyword is used to return only distinct or different values. In table, the column may contain many duplicate values, and if you want to display the list the different values by using DISTINCT keyword in select query.
SQL SELECT DISTINCT Syntax
SELECT DISTINCT column_name,column_name FROM table_name;
SELECT DISTINCT employee_name FROM Employee;
How would you retrieve the unique values for the employee_name without using the DISTINCT keyword
GROUP BY keyword helps to retrieve the unique values in sql
SELECT employee_name from Employee GROUP BY employee_name
Running this query will return the following results:
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.