Sql server® 2012 t-sql fundamentals



Download 10,93 Mb.
Pdf ko'rish
bet252/443
Sana26.01.2022
Hajmi10,93 Mb.
#411755
1   ...   248   249   250   251   252   253   254   255   ...   443
Bog'liq
BookSQL

 

CHAPTER 6

 

Set Operators



 

 199

The following query returns distinct locations that are customer locations but not employee 

locations.

SELECT country, region, city FROM Sales.Customers 

EXCEPT 

SELECT country, region, city FROM HR.Employees;

This query returns 66 locations, shown here in abbreviated form.

country         region          city 

--------------- --------------- --------------- 

Argentina       NULL            Buenos Aires 

Austria         NULL            Graz 

Austria         NULL            Salzburg 

Belgium         NULL            Bruxelles 

Belgium         NULL            Charleroi 

... 

USA             WY              Lander 



Venezuela       DF              Caracas 

Venezuela       Lara            Barquisimeto 

Venezuela       Nueva Esparta   I. de Margarita 

Venezuela       Táchira         San Cristóbal 

 

(66 row(s) affected)



You can also use alternatives to the EXCEPT operator. One alternative is an outer join that filters only 

outer rows, which are rows that appear in one side but not the other. Another alternative is to use the 



NOT EXISTS predicate. However, if you want to consider two NULL marks as equal, set operators give 

you this behavior by default with no need for special treatment, whereas the alternatives don’t. 




Download 10,93 Mb.

Do'stlaringiz bilan baham:
1   ...   248   249   250   251   252   253   254   255   ...   443




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish