Purpose: The DISTINCT
clause removes duplicate rows from the result set, ensuring each row is unique.Syntax:
SELECT DISTINCT column1, column2 FROM table_name;
Example:
SELECT DISTINCT department_id FROM employees;
Explanation: This retrieves unique department IDs from the employees
table, eliminating duplicates.
Leave a Reply