DISTINCT Oracle Query for Column Values
Q: Write an Oracle query to retrieve distinct values from a specific column in a table using the DISTINCT keyword.
- Oracle
- Senior level question
Explore all the latest Oracle interview questions and answers
ExploreMost Recent & up-to date
100% Actual interview focused
Create Oracle interview for FREE!
To retrieve distinct values from a specific column in a table in Oracle, you can use the SELECT statement with the DISTINCT keyword. Here's an example query:
SELECT DISTINCT column_name
FROM table_name;
Replace "column_name" with the name of the column from which you want to retrieve distinct values, and "table_name" with the actual name of the table.
For example, if you have a table named "Employees" and you want to retrieve distinct values from the "department" column, the query would be:
SELECT DISTINCT department
FROM Employees;
Executing this query will retrieve all unique values from the "department" column in the "Employees" table.
Remember to adjust the column name and table name based on your specific database schema and requirements. The DISTINCT keyword ensures that only distinct values are returned, eliminating duplicates from the result set.


