Section 1 - Instruction

So far you've filtered data using exact matches with WHERE clauses. But what if you want to find all customers whose names start with "John" but might be "Johnson", "Johnston", or "Johnny"?

Exact matching with = won't work here. You need flexible pattern matching.

Engagement Message

Can you think of other situations where exact matching would be too restrictive?

Section 2 - Instruction

The LIKE operator lets you search for patterns instead of exact matches. It's perfect for partial text searches.

Instead of WHERE name = 'John', you can use WHERE name LIKE 'John%' to find names starting with "John".

Engagement Message

What's one example where you'd use LIKE instead of =?

Section 3 - Instruction

The % wildcard represents any number of characters (including zero). Think of it as "anything can go here."

SELECT name FROM customers WHERE email LIKE '%@gmail.com';

This finds all Gmail users regardless of what comes before the @.

Engagement Message

What would LIKE 'A%' find in a names column?

Section 4 - Instruction

The _ wildcard represents exactly one character. It's more precise than %.

SELECT product FROM inventory WHERE code LIKE 'PR_001';

This matches PR1001, PRA001, PRB001, but NOT PRA2001 (too many characters).

Engagement Message

When would you use _ instead of %?

Section 5 - Instruction
Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal