Write each query here, and run it on a real Postgres database in your browser.
Find videos by a pattern, and send them back in the order the team asks for.
Scenario
Simplified's team looks its videos up by their titles, and lists them in order. You write both kinds of query.
Simplified's videos table holds eight videos.
Can you find the right videos, and send them back in the right order?
Postgres promises no order until your query asks for one.
The team remembers only that some titles start with the word The.
Send back every title that starts with The.
Someone on the team remembers a title whose second letter is e.
Send back every title that fits.
The team wants every title with qu in it, capital or small.
An assistant wrote this query. It runs, but one title is missing.
Run it, work out which one, then fix it.
The team lists its videos with the newest at the top.
A newer video has a higher id.
Send back every video's id and title, highest id first.
Now the team lists every video, longest first.
Two videos tie on 95 seconds, so break the tie by title, in alphabetical order.
Send back title and seconds.
The team wants only two videos: the two shortest.
Two videos tie for second place, so the one in the earlier chapter goes first.
Send back their title and seconds, shortest first.
A search sends back fewer rows than it should
LIKE treats a capital and a small letter as different.
Check the capitals in your pattern, or use ILIKE to ignore case.
syntax error at or near "ORDER"
LIMIT goes at the very end, after ORDER BY.
Not yet: these are the right rows, but not in the right order
Check which column ORDER BY sorts by, and whether it needs DESC.
If two rows tie, add a second column after a comma.
Each step passes once its query sends back the right rows. Then mark the lab complete to unlock the next lesson.