0
the "UNIQUE" keyword
is it any different from DISTINCT?
2 Respostas
+ 3
The main difference between unique and distinct is that UNIQUE is a constraint that is used on the input of data and ensures data integrity. While DISTINCT keyword is used when we want to query our results or in other words, output the data. Both UNIQUE and DISTINCT key words ensure the same thing, i.e. data is not repeated. One makes sure during input and other during the output.
+ 2
SELECT UNIQUE works in Oracle databases, but it is not standard SQL.
To retrieve unique values from a column, SELECT DISTINCT is more universal and works in every database engine.
UNIQUE keyword is otherwise used as a constraint when you create tables.