Learn with Abdou

Chapter 2 · Concept 3 of 6 · Practice

Ask for Morty

WHERE, boundaries, AND, OR, parentheses, IN and BETWEEN · level 1 of 6

Opening your saved work…

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

Ask for Morty · WHERE, boundaries, AND, OR, parentheses, IN and BETWEEN · level 1 of 6

Morty, at least ten words

Level 1: Watch it answered · Exercise 1 of 2

Which of Morty's lines run to at least ten words? Watch the query answer it with two tests, then run it and check one row against both.

Data: Rick & Morty.

Why it works, clause by clause

  1. FROM scripts: the engine starts with all 1,905 lines.
  2. WHERE characterName = 'Morty': the first test. Morty is text, so it sits in single quotes.
  3. AND wordCount >= 10: the second test. A row stays only when both are true, and at least means a ten-word line counts.
  4. SELECT id, characterName, wordCount: the two tested columns beside the id, so anyone can check each row against both tests.
  5. ORDER BY id, LIMIT 5: the first five that qualify. A preview of the matching lines, not the whole answer.

From the reading: Ask for Morty, paragraph 1

The queryOpening the database…
SELECT id, characterName, wordCount
FROM scripts
WHERE characterName = 'Morty' AND wordCount >= 10
ORDER BY id
LIMIT 5;
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.