Thuta Learning
SQL
BasicData & Databasesbeginner

AND, OR, NOT

AND, OR, NOT တွေက condition တစ်ခုထက်ပိုပြီးစစ်ချင်တဲ့အခါသုံးပါတယ်။ Filter system တွေမှာ အရေးကြီးပါတယ်။

• AND — conditions အားလုံးမှန်မှ result ထွက်မယ်

• OR — condition တစ်ခုခုမှန်ရင် result ထွက်မယ်

• NOT — condition မဟုတ်တဲ့ rows ကိုယူမယ်

Tip

Condition များလာရင် parentheses () သုံးပြီး logic ကိုရှင်းရှင်းလင်းလင်းရေးပါ။

sql
SELECT CustomerName, City, Country
FROM Customers
WHERE Country = 'Mexico' OR Country = 'Germany';
You should see
+--------------------+-------------+---------+ | CustomerName | City | Country | +--------------------+-------------+---------+ | Alfreds Futterkiste| Berlin | Germany | | Ana Trujillo | Mexico City | Mexico | | Antonio Moreno | Mexico City | Mexico | +--------------------+-------------+---------+ What this code does: Germany ဖြစ်တဲ့ customer သို့မဟုတ် Mexico ဖြစ်တဲ့ customer တွေကိုထုတ်ပြပါတယ်။ Common mistake: AND နဲ့ OR ကိုရောရေးတဲ့အခါ precedence ကြောင့် result မျှော်လင့်သလိုမထွက်နိုင်ပါ။ မသေချာရင် parentheses သုံးပါ။
AND, OR, NOT | Thuta Learning