Learn with Abdou

Chapter 2 · Concept 4 of 6 · Practice

Where is Rick in the title?

LIKE, %, _ and DISTINCT · level 1 of 6

Opening your saved work…

Sign in to save across devices → · Download your guest work before switching accounts.

Where is Rick in the title? · LIKE, %, _ and DISTINCT · level 1 of 6

Names that start with R

Level 1: Watch it answered · Exercise 1 of 2

Which speaker labels begin with R? Watch the query answer it with a pattern and DISTINCT, then run it.

Data: Rick & Morty.

Why it works, clause by clause

  1. WHERE characterName LIKE 'R%': an R, then any run of characters, including none. Rick on its own matches.
  2. SELECT DISTINCT characterName: one row per different matching name, however many lines each one has.
  3. ORDER BY characterName: alphabetical, so two people comparing lists see the same order. It ranks nothing.

From the reading: Where is Rick in the title?, paragraph 2

The queryOpening the database…
SELECT DISTINCT characterName
FROM scripts
WHERE characterName LIKE 'R%'
ORDER BY characterName;
Open in the playground

Query results

Run it to see the result here.

Run it to see the result here.

Practice here is evidence for you and your instructor, never a grade. Grades live in Canvas.