Pattern Matching with LIKE
The LIKE operator lets you search for patterns in text, not just exact matches.
Wildcards
| Wildcard | Meaning |
|---|---|
% | Any sequence of characters (including none) |
_ | Exactly one character |
Common Patterns
-- Starts with 'A'
WHERE name LIKE 'A%'
-- Ends with 'son'
WHERE name LIKE '%son'
-- Contains 'ar'
WHERE name LIKE '%ar%'
-- Second character is 'a'
WHERE name LIKE '_a%'
Exercises
Loading exercise...
Loading exercise...
Loading exercise...
Loading exercise...
Loading exercise...
Case Sensitivity
In SQLite (which powers this playground), LIKE is case-insensitive by default:
'Apple' LIKE 'a%'matches
In other databases like PostgreSQL, LIKE is case-sensitive. Use ILIKE for case-insensitive matching.
Loading exercise...
Free Practice
Loading SQL editor...
Try these patterns:
- Find all users with 3-letter names (
___) - Find users with emails from a specific domain
- Combine LIKE with other conditions using AND
التالي · الدرس 10 من 27
Sorting with ORDER BY
قراءة 1 دقيقة
أنهيت 9 من 27 درسًا

اسأل Byte عن هذا الدرس
محادثة خاصة حول هذا الدرس. قرأ Byte الدرس كاملًا، ويجيب خلال ثوانٍ، ويُظهر القسم الذي تأتي منه كل إجابة. يمكنك السؤال بأي لغة.
الأسئلة والأجوبة
أسئلة عامة حول هذا الدرس. يجيب AI Tutor فورًا بلغتك، ويراجع فريق FreeAcademy الإجابات، ويمكن لكل المتعلمين قراءتها.

