O'Reilly logo

SQL: Visual QuickStart Guide by Chris Fehily

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Finding Different Rows with EXCEPT

An EXCEPT operation, also called a difference, combines the results of two queries into a single result that comprises the rows that belong only to the first query. To contrast INTERSECT and EXCEPT, A INTERSECT B contains rows from table A that are duplicated in table B, whereas A EXCEPT B contains rows from table A that aren’t duplicated in table B. Differences have the same restrictions as unions; see “Combining Rows with UNION” earlier in this chapter.

To find different rows:

  • Type:
    								select_statement1
    EXCEPT
    select_statement2;
    
    select_statement1 and select_statement2 are SELECT statements. The number and the order of the columns must be identical in both statements, and the data types of corresponding columns ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required