SQL LESSON 7 OF 32

IN, BETWEEN & LIKE

IN matches one of several values. BETWEEN includes both endpoints. LIKE matches text patterns: % means any length; _ means one character. Case behavior depends on the database and collation.

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

IN कई मानों में से मिलान करता है। BETWEEN दोनों सीमाएँ शामिल करता है। LIKE में % कोई भी लंबाई और _ एक अक्षर है। केस का व्यवहार डेटाबेस पर निर्भर है।

अभ्यास: Book पर समाप्त उत्पाद के name, नाम क्रम में दिखाएँ।

Hinglish mein samjhein

IN multiple values match karta hai. BETWEEN dono endpoints include karta hai. LIKE mein % any length aur _ one character hai. Case behavior database par depend karta hai.

Practice: Book par end hone wale products ke name sorted dikhao.

A small SQL example

SELECT name FROM customers WHERE city IN ('Delhi','Pune');

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

Show name of products whose name ends in Book, ordered by name.

Check answer & explanation
SELECT name FROM products WHERE name LIKE '%Book' ORDER BY name;

The leading % allows any characters before Book. ORDER BY name makes the result order explicit.

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

BETWEEN includes…

  1. Both endpoints
  2. Neither endpoint
  3. Only the lower endpoint
Check the quiz answer

Both endpoints

IN matches one of several values. BETWEEN includes both endpoints. LIKE matches text patterns: % means any length; _ means one character. Case behavior depends on the database and collation.

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.