strawquery PT
All lessons

Lesson 7 of 30

Patterns with LIKE

Today at the studio

Aoi, the head writer, remembers an episode title only in pieces: "it had a cat in it, I think." Elsewhere, Byte has been walking across the keyboard again and the characters table is full of half-remembered names.

The idea

LIKE compares text with a pattern. The percent sign % stands for any run of characters, including none. The underscore _ stands for exactly one character.

So 'Moon%' starts with Moon, '%Moon' ends with Moon, and '%Moon%' contains it anywhere. In SQLite, LIKE ignores upper and lower case for English letters.

Example

SELECT name FROM staff WHERE name LIKE '%a'

Your turn

0 of 4 questions

Question 1 of 4

Which show titles start with "The "? Show title.

Unofficial fan project. Titles belong to their creators and rights holders.