Sql server® 2012 t-sql fundamentals


  ( ) (Parentheses) 2



Download 10,93 Mb.
Pdf ko'rish
bet96/443
Sana26.01.2022
Hajmi10,93 Mb.
#411755
1   ...   92   93   94   95   96   97   98   99   ...   443
Bog'liq
BookSQL

1. 

( ) (Parentheses)



2. 

* (Multiplication), / (Division), % (Modulo)



3. 

+ (Positive), – (Negative), + (Addition), + (Concatenation), – (Subtraction)



4. 

=, >, <, >=, <=, <>, !=, !>, !< (Comparison operators)



5. 

NOT

6. 

AND

7. 

BETWEENINLIKEOR

8. 

= (Assignment)

For example, in the following query, AND has precedence over OR.

SELECT orderid, custid, empid, orderdate 

FROM Sales.Orders 

WHERE 


        custid = 1 

    AND empid IN(1, 3, 5) 

    OR  custid = 85 

    AND empid IN(2, 4, 6);

The query returns orders that were either “placed by customer 1 and handled by employees 1, 3, 

or 5” or “placed by customer 85 and handled by employees 2, 4, or 6.” 

Parentheses have the highest precedence, so they give you full control. For the sake of other people 

who need to review or maintain your code and for readability purposes, it’s a good practice to use 

parentheses even when they are not required. The same is true for indentation. For example, the fol-

lowing query is the logical equivalent of the previous query, only its logic is much clearer. 

SELECT orderid, custid, empid, orderdate 

FROM Sales.Orders 

WHERE 

      (custid = 1 



        AND empid IN(1, 3, 5)) 

    OR 


      (custid = 85 

        AND empid IN(2, 4, 6));

www.it-ebooks.info




Download 10,93 Mb.

Do'stlaringiz bilan baham:
1   ...   92   93   94   95   96   97   98   99   ...   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