Ask for Morty
WHERE, boundaries, AND, OR, parentheses, IN and BETWEEN · level 3 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 3 of 6
Trace the tree
The first twelve lines, speaker and word count, in id order: Rick 11, Morty 5, Rick 7, Morty 11, Rick 12, Morty 7, Rick 15, Rick 19, Morty 8, Rick 27, Morty 3, Rick 18. The query below keeps those twelve and then asks characterName = 'Morty' OR characterName = 'Rick' AND wordCount >= 15. Draw the tree on paper: which test does the engine settle first? Before you run it, how many rows come back?
SELECT id, characterName, wordCount
FROM scripts
WHERE id <= 12 AND (characterName = 'Morty' OR characterName = 'Rick' AND wordCount >= 15)
ORDER BY id;Data: Rick & Morty.
Query results
The real result appears here after you run it.The real result appears here after you run it.
Practice here is evidence for you and your instructor, never a grade. Grades live in Canvas.