Sql server® 2012 t-sql fundamentals



Download 10,93 Mb.
Pdf ko'rish
bet196/443
Sana26.01.2022
Hajmi10,93 Mb.
#411755
1   ...   192   193   194   195   196   197   198   199   ...   443
Bog'liq
BookSQL

 

CHAPTER 4

 

Subqueries



 

 141

This query produces the following output, shown here in abbreviated form.

orderid     orderdate                   empid       custid      nextorderid 

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

10248       2006-07-04 00:00:00.000     5           85          10249 

10249       2006-07-05 00:00:00.000     6           79          10250 

10250       2006-07-08 00:00:00.000     4           34          10251 

10251       2006-07-08 00:00:00.000     3           84          10252 

10252       2006-07-09 00:00:00.000     4           76          10253 

... 


11073       2008-05-05 00:00:00.000     2           58          11074 

11074       2008-05-06 00:00:00.000     7           73          11075 

11075       2008-05-06 00:00:00.000     8           68          11076 

11076       2008-05-06 00:00:00.000     4           9           11077 

11077       2008-05-06 00:00:00.000     1           65          NULL 

 

(830 row(s) affected)



Notice that because there’s no order after the last, the subquery returned a NULL for the last 

order.


Note that SQL Server 2012 introduces new window functions called LAG and LEAD that allow the 

return of an element from a “previous” or “next” row based on specified ordering. I will cover these 

and other window functions in Chapter 7.


Download 10,93 Mb.

Do'stlaringiz bilan baham:
1   ...   192   193   194   195   196   197   198   199   ...   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