SQL LESSON 6 OF 32

AND, OR & NOT

AND requires both conditions. OR requires either. NOT reverses a condition. AND binds more tightly than OR, so use parentheses to make your intended grouping clear.

हिन्दी में समझें

AND में दोनों शर्तें और OR में कोई एक सही चाहिए। NOT शर्त उलटता है। AND पहले लागू होता है, इसलिए समूह साफ करने को कोष्ठक रखें।

अभ्यास: Tech category के 1000 तक के उत्पादों का name चुनें।

Hinglish mein samjhein

AND mein dono, OR mein koi ek condition true chahiye. NOT condition ulat deta hai. AND pehle bind hota hai, isliye brackets se grouping clear karo.

Practice: Tech products jo 1000 ya kam ke hain unke name lo.

A small SQL example

SELECT name, price FROM products WHERE category = 'Books' AND price >= 500;

Examples use the fictional shop database bundled with the SQL playground: customers, products, orders, order_items and employees. The engine is SQLite; other SQL dialects may differ.

Try this example in the SQL playground →

Practise this idea

Select name of Tech products costing at most 1000.

Check answer & explanation
SELECT name FROM products WHERE category = 'Tech' AND price <= 1000;

AND requires both the Tech category and the price cap. <= includes a product costing exactly 1000.

Stuck in the course? Choose Check answer for either the challenge or quiz. Read the explanation and continue to the next lesson at your own pace.

Check your understanding

Use parentheses to clarify…

  1. Condition grouping
  2. Table passwords
  3. Column storage
Check the quiz answer

Condition grouping

AND requires both conditions. OR requires either. NOT reverses a condition. AND binds more tightly than OR, so use parentheses to make your intended grouping clear.

References & corrections

Use the official SQLite documentation for full language rules. Read how these lessons are made and checked. Found a mistake? Report it to Excel Keys with this lesson URL and a reproducible example.

FROM LEARNING TO BUSINESS RESULTS

Need a dashboard for your team?

Excel Keys designs custom Excel and HTML dashboards around your own KPIs and Excel files. They run offline in the browser, so your data stays on your computer.