Sql Query To Use a ' SELECT ' statement with DISTINCT() function.


To retrieve the distinct or unique or common value of the column from the existing created table. Then we can use a ' SELECT ' statement with DISTINCT.

Statement 1 will retrieve the distinct or unique salary of all employees from the Employees table in the Employee DB Database.

Statement 2 will retrieve the distinct or unique salary of all employees whose employee_id is greater than 150 from the employees' table in the Employee DB Database

Enter - Select * from table_name;
SQL Query
SELECT 'Distinct function without where condition'; SELECT DISTINCT(salary) FROM employees; SELECT 'Distinct function using where condition'; SELECT DISTINCT(salary) FROM employees WHERE employee_id>150;
Output