The most intelligent Java IDE
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » JDBC
 
RSS feed
 
New topic
Author

What is the difference between Distinct and Unique?

Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Messages: 329

What is the difference between Distinct and Unique?
Deepak Bala
Bartender

Joined: Feb 24, 2006
Messages: 4870

In what context ?

SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
Peter Johnson
author
Bartender

Joined: May 14, 2008
Messages: 2374

And for which database?

JBoss In Action
Scott Selikoff
Bartender

Joined: Oct 23, 2005
Messages: 3064

If you are using it in projection to filter out duplicate results, then probably nothing. Some databases actually only support one of them (some support both), so this is more of a syntax issue than anything else.

Otherwise, UNIQUE can also be an attribute for a column making it a candidate/primary key, whereas DISTINCT is only used in SELECT statements.

My Blog: Down Home Country Coding with Scott Selikoff
 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » JDBC
 
RSS feed
 
New topic
replay challenge