Sql server® 2012 t-sql fundamentals



Download 10,93 Mb.
Pdf ko'rish
bet330/443
Sana26.01.2022
Hajmi10,93 Mb.
#411755
1   ...   326   327   328   329   330   331   332   333   ...   443
Bog'liq
BookSQL

 

CHAPTER 8

 

Data Modification



 

 289

10265       2006-07-25 00:00:00.000 

10266       2006-07-26 00:00:00.000 

10267       2006-07-29 00:00:00.000 

10268       2006-07-30 00:00:00.000 

10269       2006-07-31 00:00:00.000 

 

(22 row(s) affected)



3

Delete from the dbo.Orders table orders placed by customers from Brazil.



4

Run the following query against dbo.Customers, and notice that some rows have a NULL in the region 

column.

SELECT * FROM dbo.Customers;

The output from this query is as follows.

custid      companyname      country         region     city 

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

1           Customer NRZBB   Germany         NULL       Berlin 

2           Customer MLTDN   Mexico          NULL       México D.F. 

3           Customer KBUDE   Mexico          NULL       México D.F. 

4           Customer HFBZG   UK              NULL       London 

5           Customer HGVLZ   Sweden          NULL       Luleå 

6           Customer XHXJV   Germany         NULL       Mannheim 

7           Customer QXVLA   France          NULL       Strasbourg 

8           Customer QUHWH   Spain           NULL       Madrid 

9           Customer RTXGC   France          NULL       Marseille 

10          Customer EEALV   Canada          BC         Tsawassen 

... 


 

(90 row(s) affected)

Update the dbo.Customers table and change all NULL region values to . Use the OUTPUT 

clause to show the custidoldregion, and newregion.



Desired output:



custid      oldregion       newregion 

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

1           NULL             

2           NULL             

3           NULL             

4           NULL             

5           NULL             

6           NULL             

7           NULL             

8           NULL             

9           NULL             

www.it-ebooks.info




290  

Microsoft SQL Server 2012 T-SQL Fundamentals

11          NULL             

12          NULL             

13          NULL             

14          NULL             

16          NULL             

17          NULL             

18          NULL             

19          NULL             

20          NULL             

23          NULL             

24          NULL             

25          NULL             

26          NULL             

27          NULL             

28          NULL             

29          NULL             

30          NULL             

39          NULL             

40          NULL             

41          NULL             

44          NULL             

49          NULL             

50          NULL             

52          NULL             

53          NULL             

54          NULL             

56          NULL             

58          NULL             

59          NULL             

60          NULL             

63          NULL             

64          NULL             

66          NULL             

68          NULL             

69          NULL             

70          NULL             

72          NULL             

73          NULL             

74          NULL             

76          NULL             

79          NULL             

80          NULL             

83          NULL             

84          NULL             

85          NULL             

86          NULL             

87          NULL             

90          NULL             

91          NULL             

 

(58 row(s) affected)



www.it-ebooks.info



Download 10,93 Mb.

Do'stlaringiz bilan baham:
1   ...   326   327   328   329   330   331   332   333   ...   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