Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



SQL UNIQUE and DISTINCT

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 08-05-2010
Member
 
Join Date: Apr 2010
Posts: 59
SQL UNIQUE and DISTINCT
  

Hello Friends,

I recently started to learn the SQL. I have some confusion about UNIQUE and DISTINCT clause of SQL. I am not getting what is the exact use of these UNIQUE and DISTINCT clause. I have have referred many books but nothing was helpful. If you posses sound knowledge about the UNIQUE and DISTINCT clause, then please try to share it me. I will really appreciate your any help.

Reply With Quote
  #2  
Old 08-05-2010
Member
 
Join Date: Apr 2008
Posts: 1,947
Re: SQL UNIQUE and DISTINCT

The SQL DISTINCT clause is basically used beside with SELECT keyword and that retrieve only unique data entry depending on the column list you have mentioned after it. Fundamentally what the DISTINCT keyword does is removing the duplicate from the consequence set returned by SELECT statement.
Reply With Quote
  #3  
Old 08-05-2010
Member
 
Join Date: May 2008
Posts: 2,007
Re: SQL UNIQUE and DISTINCT

I don't found any dissimilarity in with distinct and unique in the select statement, as both clause are performing same procedure in the select. I want to add one that is u can not use distinct clause in the create statement while unique clause u can. I suggest you to practically try these two clause, and see what result you will get.
Reply With Quote
  #4  
Old 08-05-2010
Member
 
Join Date: Apr 2008
Posts: 2,000
Re: SQL UNIQUE and DISTINCT

According to me the difference between distinct and unique is, unique is apply previous to insertion and retrieval. It comprises of non replica values. If unique constraint is specified it doesn’t obtain replica values. The distinct is useful in retrieval, consequently distinct is the grouping of concealed duplicate and non duplicate rows.
Reply With Quote
  #5  
Old 08-05-2010
Member
 
Join Date: May 2008
Posts: 2,290
Re: SQL UNIQUE and DISTINCT

When you apply unique clause all the column values will be sorted. But it is different in distinct clause, it only confiscate the duplicate from the sql table, not column values which are sorted. The unique is nothing but the constraint it's assert for to prevent the data duplication. I hope it will resolve all your confusion about unique clause.
Reply With Quote
  #6  
Old 10-05-2010
Member
 
Join Date: Apr 2008
Posts: 2,371
Re: SQL UNIQUE and DISTINCT

The SQL DISTINCT command is normally used with the SELECT statement of sql that retrieves only distinctive data entry depending on the column list that you have precise after it. Basically what the DISTINCT clause does is removing the duplicate which is from the result set returned by SELECT statement.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "SQL UNIQUE and DISTINCT"
Thread Thread Starter Forum Replies Last Post
Select unique values without using distinct Maya Angelou Software Development 6 17-05-2010 10:26 AM
What is the difference between Distinct and DistinctRow? Orion lella Software Development 4 04-02-2010 12:29 AM
How to use DISTINCT in SQL DotNetUser Software Development 2 07-09-2009 11:33 PM
Distinct OR Group By sidkid Windows Software 3 03-09-2009 08:36 PM
SELECT UNIQUE and SELECT DISTINCT TAARIQ Software Development 3 03-06-2009 10:00 PM


All times are GMT +5.5. The time now is 11:01 AM.