Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Except Clause in SQL

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 246
    Comment on it

    Except Clause:

    It combines two select statements and return tuples from first SELECT statement which are not returned by second SELECT statement. It is used to achieve Distinct and Not In queries operation in a single clause(Except).

    Syntax:

    SELECT column(s)
    FROM tablename1
    WHERE condition
    
    EXCEPT
    
    SELECT column(s)
    FROM tablename2
    WHERE condition;

    Example:

    SELECT emp_id,emp_name
    FROM Employee
    EXCEPT
    SELECT emp_id
    FROM ExEmp;

    This query will fetch employee ID and name whose data are not present in ExEmp table. 


    Except Clause was introduced in SQL Server and works similar to Minus clause used in Oracle.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: