Page 69 - SQL
P. 69

Chapter 18: EXCEPT




        Remarks



        EXCEPT returns any distinct values from the dataset to the left of the EXCEPT operator that are not
        also returned from the right dataset.


        Examples



        Select dataset except where values are in this other dataset


         --dataset schemas must be identical
         SELECT 'Data1' as 'Column' UNION ALL
         SELECT 'Data2' as 'Column' UNION ALL
         SELECT 'Data3' as 'Column' UNION ALL
         SELECT 'Data4' as 'Column' UNION ALL
         SELECT 'Data5' as 'Column'
         EXCEPT
         SELECT 'Data3' as 'Column'
         --Returns Data1, Data2, Data4, and Data5


        Read EXCEPT online: https://riptutorial.com/sql/topic/4082/except



















































        https://riptutorial.com/                                                                               51
   64   65   66   67   68   69   70   71   72   73   74