SQL for Smarties | SQL Programming Style | Trees and Hierarchies in SQL | SQL Puzzles and Answers | Data and Databases


Sunday, June 25, 2006

Distinct and Unique

SQL Apprentice Question
Distinct(in oracle and SQL server) and Unique(in oracle) are they both same
Can we use them interchangeably?



Celko Answers

>> Distinct(in oracle and SQL server) and Unique(in oracle) are they both same Can we use them interchangeably? <<


No. That is one of MANY Oracle dialect screw-ups to prevent Standard,
portable code. The UNIQUE() constraint is part of the DDL; the
DISTINCT option is part of the DML.

No comments: