PRO SQL Modules
SQL Basics1h 20m • 4 lessons
Multiple Tables1h 40m • 5 lessons
Query Restructuring40m • 2 lessons
Data Transformation1h 40m • 5 lessons
Analytical SQL2h • 6 lessons
LIKE

Dan Lee
Lesson Objectives
By the end of this lesson, you will:
- Learn how to filter text data using LIKE
- Understand wildcard characters (% and _) for flexible pattern matching
- Write SQL queries to find Netflix series based on keyword searches
🎬 Scenario: Finding Shows with “Dark” in the Title
Your manager at Netflix, Alex, is analyzing user interest in dark-themed content.
Alex asks:
Can you retrieve all shows that have the word “Dark” anywhere in the title?
Your task is to query the netflix_series table and provide the requested data.
series_id | title | genre | release_year | seasons | rating | total_views_millions |
---|---|---|---|---|---|---|
1 | Stranger Things | Sci-Fi | 2016 | 4 | 8.7 | 140 |
2 | Squid Game | Thriller | 2021 | 1 | 8 | 200 |
3 | The Witcher | Fantasy | 2019 | 3 | 7.9 | 90 |
4 | Money Heist | Crime | 2017 | 5 | 8.2 | 180 |
5 | Dark | Sci-Fi | 2017 | 3 | 8.8 | 85 |
1. Filtering Text Data with ‘LIKE’
The LIKE operator allows us to search for patterns in text. Instead of filtering by an exact match (=), we can use wildcard characters:
Wildcard | Description |
---|---|
% | Represents zero or more characters |
_ | Represents a single character |
Syntax:
1SELECT column1, column2
2FROM table_name
3WHERE column_name LIKE 'pattern';
Example Query: Finding Titles Containing “Dark”
1SELECT title, genre, rating
2FROM netflix_series
3WHERE title LIKE '%Dark%';
Expected Output:
title | genre | rating |
---|---|---|
Dark | Sci-Fi | 8.8 |
What’s Happening?
- LIKE %Dark% searches for any title that contains the word “Dark” anywhere.
- The % wildcard allows matches at the beginning, middle, or end of the title.
2. More Pattern Matching Examples
Pattern | Matches | Example Query |
---|---|---|
D% | Titles that start with “D” | WHERE title LIKE D% |
%Game | Titles that end with “Game” | WHERE title LIKE %Game |
%Mirror% | Titles that contain “Mirror” anywhere | WHERE title LIKE %Mirror% |
S____ Game | Titles that start with “S” and are 11 characters long | WHERE title LIKE S____ Game |
Example Query: Finding Titles That Start with “S”
1SELECT title, genre
2FROM netflix_series
3WHERE title LIKE 'S%';
Expected Output:
title | genre |
---|---|
Stranger Things | Sci-Fi |
Squid Game | Thriller |
What’s Happening?
- LIKE S% ensures that only titles starting with “S” appear in the results.
✍️ SQL Exercises
Exercise 1: Finding Netflix Shows with “Game” in the Title
Netflix executives want a list of all series that contain “Game” anywhere in the title.
Filter condition:
- title must contain the word “Game”.
Expected Output Example:
title | genre | rating |
---|---|---|
Squid Game | Thriller | 8.0 |
Write an SQL query to return the requested data.
Exercise 2: Finding Shows That Start with “B”
Alex is preparing a new recommendation system and wants to identify all Netflix series whose titles start with “B”. Order the table in the ascending order of rating.
Filter condition:
- title must start with the letter “B”.
Expected Output Example:
title | genre | rating |
---|---|---|
Bridgerton | Drama | 7.3 |
Black Mirror | Sci-Fi | 8.8 |
Breaking Bad | Crime | 9.5 |
Write an SQL query to return the requested data.