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

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 650
    Comment on it

    INTERSECT Clause:

    It works similar like union clause as it is used to combine two SELECT statements, but it returns  tuples only from first SELECT statement which are common to tuples in the second SELECT statement.

    Syntax:

    SELECT column(s)
    FROM table1
    WHERE condition
    
    INTERSECT
    
    SELECT column(s)
    FROM table2
    WHERE condition;

    Example:

     SELECT  EmpID, EmpNAME, EmpSalary
         FROM Employee
         
    INTERSECT
         SELECT  ID, NAME, Salary
         FROM Employee1;

    The above query will select those emploee id,name salary which are common in both tables.

     

    Every SQL statement written in a SQL INTERSECT must have the same number of fields in the result sets with same data types.

 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: