How to select unique records in oracle?

Member

by lottie , in category: MySQL , 3 months ago

How to select unique records in oracle?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by arnoldo.moen , 3 months ago

@lottie 

To select unique records in Oracle, you can use the DISTINCT keyword in your SELECT statement.


For example:

1
2
SELECT DISTINCT column1, column2, column3
FROM your_table;


This query will return only unique combinations of the values in the specified columns in the result set.


Alternatively, you can use the GROUP BY clause to group the records by a specific column and select only the unique groups.


For example:

1
2
3
SELECT column1, column2, column3
FROM your_table
GROUP BY column1, column2, column3;


This query will group the records by the specified columns and return only one record for each unique group.