Results 1 to 6 of 6

Thread: SQL UNIQUE and DISTINCT

  1. #1
    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.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    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.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    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.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    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.

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    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.

  6. #6
    Join Date
    Apr 2008
    Posts
    2,366

    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.

Similar Threads

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

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,596,820.56478 seconds with 17 queries