Results 1 to 5 of 5

Thread: difference bet unique and distinct

  1. #1
    Junior Member
    Join Date
    Feb 2007

    Unhappy difference bet unique and distinct

    Is threre any difference bet 'disinct' and 'unique' key word used in select clause
    select disinct(column_name) from table_name;
    select unique(column_name) from table_name;

  2. #2
    Expert Member
    Join Date
    Sep 2006

    Re: difference bet unique and distinct

    Hi Smitai,

    The keywords, DISTINCT and UNIQUE are synonymous.
    Both are used to specify to return only one copy of each set of duplicate rows selected.
    One restriction is that DISTINCT cannot be specified if the FROM clause contains LOB columns.

    *** Innila ***

  3. #3
    Junior Member
    Join Date
    Jun 2007

    Smile Re: difference bet unique and distinct

    UNIQUE we are inserting unique data to table
    DISTINCT means we are retriving unique values from duplicate records

  4. #4
    Junior Member
    Join Date
    Jul 2008

    Re: difference bet unique and distinct

    Both are same but distinct use in sql as well in oracle but unique only use for oracle

  5. #5
    Junior Member
    Join Date
    Oct 2009

    Re: difference bet unique and distinct


    SQL> insert into emp values(eno number(4) unique,ejob varchar(15));

    Here unique restricts the user to enter the same value more than once.

    Error:Voilating constraint


    SQL>select distinct(ejob) from emp;

    Here distinct is used to eliminate the duplicate values from emp. i.e ejob

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.