Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Location
    Sweden
    Posts
    1

    Unanswered: Warning: Stupid question!!!

    Hi!

    I'm new to this database-stuff - so I have a question: How to use unique? Not the one to use when create a table to show a key is unique, I mean the one to decide if a query is unique???
    I thought it should be used the same way as 'exists' but i recive "missing expression".

    Pleas help me, only one week until exam...

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: Warning: Stupid question!!!

    Originally posted by sam_14332
    Hi!

    I'm new to this database-stuff - so I have a question: How to use unique? Not the one to use when create a table to show a key is unique, I mean the one to decide if a query is unique???
    I thought it should be used the same way as 'exists' but i recive "missing expression".

    Pleas help me, only one week until exam...
    Not sure what you mean by "decide if a query is unique". Do you mean, see if it only returns 1 row? There is no UNIQUE keyword for this, but there are various ways e.g. SELECT COUNT(*) will show how many rows there are.

    The following SELECT will show all deptno values that are unique in the emp table:

    SELECT deptno
    FROM emp
    GROUP BY deptno
    HAVING COUNT(*) = 1;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •