TechSapphire Saturday, 2024-12-21, 5:32 PM
Site menu
Login form
News
Play Games
  • Deep Freeze
  • Ice Slide
  • Gyroball
  • Fat Fish
  • Bush Royal Rampage
  • Main » 2012 » September » 4 » SQL Server UNION, INTERSECT and EXCEPT (MINUS) clauses
    5:16 AM
    SQL Server UNION, INTERSECT and EXCEPT (MINUS) clauses
    Union is to select all records from two table but common record only once.

    Select * from tbemp1
    UNION
    Select * from tbemp2


    Inersect is to select common records from two tables.

    Select * from tbemp1
    INTERSECT
    Select * from tbemp2

    Except(Minus) is equivalent to oracle minus clause. Select records of table 1 which are not in table 2.

    Select * from tbemp1
    EXCEPT
    Select * from tbemp2
    Category: Database | Views: 20056 | Added by: Admin | Tags: sql, Common, Minus, sqlserver, Record, Clause, Intersect, Except, SERVER, Union | Rating: 0.0/0
    Total comments: 0
    Only registered users can add comments.
    [ Registration | Login ]
    Categories
    Programming [27]
    Tips for programming
    Security [2]
    Security Tips
    Google [1]
    Use google faster then ever you use
    Project [14]
    HTML [2]
    Electronics [0]
    Data Structure [0]
    Database [16]
    SQL SERVER
    SSRS [1]
    Sql Server Reporting Services
    Copyright MyCorp © 2024