Sql server® 2012 t-sql fundamentals



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

 

CHAPTER 6

 

Set Operators



 

 201

This query returns the following output.

country         region          city 

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

Australia       NSW             Sydney 

Australia       Victoria        Melbourne 

Brazil          NULL            Sao Paulo 

Canada          Québec          Montréal 

Canada          Québec          Ste-Hyacinthe 

Denmark         NULL            Lyngby 

Finland         NULL            Lappeenranta 

France          NULL            Annecy 

France          NULL            Montceau 

France          NULL            Paris 

Germany         NULL            Berlin 

Germany         NULL            Cuxhaven 

Germany         NULL            Frankfurt 

Italy           NULL            Ravenna 

Italy           NULL            Salerno 

Japan           NULL            Osaka 

Japan           NULL            Tokyo 

Netherlands     NULL            Zaandam 

Norway          NULL            Sandvika 

Singapore       NULL            Singapore 

Spain           Asturias        Oviedo 

Sweden          NULL            Göteborg 

Sweden          NULL            Stockholm 

UK              NULL            Manchester 

USA             LA              New Orleans 

USA             MA              Boston 

USA             MI              Ann Arbor 

USA             OR              Bend 

 

(28 row(s) affected) 



To control the order of evaluation of set operators, use parentheses, because they have the highest 

precedence. Also, using parentheses increases the readability, thus reducing the chance for errors. For 

example, if you want to return “(locations that are supplier locations but not employee locations) and 

that are also customer locations,” use the following code.

(SELECT country, region, city FROM Production.Suppliers 

 EXCEPT 


 SELECT country, region, city FROM HR.Employees) 

INTERSECT 

SELECT country, region, city FROM Sales.Customers;

This query returns the following output.

country         region          city 

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

Canada          Québec          Montréal 

France          NULL            Paris 

Germany         NULL            Berlin

www.it-ebooks.info





Download 10,93 Mb.

Do'stlaringiz bilan baham:
1   ...   250   251   252   253   254   255   256   257   ...   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