Oracle中的distinct 与unique
distinct 与unique的区别:
select distinct state from customers order by state asc; select unique state,firstname from customers order by state asc;
在Oracle中显示效果是一样的。
在SQL语法里面,有unique和distinct两个关键字,
unique是distinct的同义词,功能完全相同。
distinct是标准语法,其他数据库 sql server,db2,oracle,sybase,mysql等都支持。
unique,oracle、informix数据库认识,其他数据库有的认识,有的不认识。
以后方便数据库移植,推荐使用distinct。
大家要注意此项,当遇到1486 error:
01489, 00000, "result of string concatenation is too long"
// *Cause: String concatenation result is more than the maximum size.
// *Action: Make sure that the result is less than the maximum size
浙公网安备 33010602011771号