sql · level 1 · unit 2 · lesson 3
- meet it
- guess first
- your turn
- fix it
- nailed it
Tap a green word if you get lost.
meet it
Ask for more than, less than, or not equal to.
= only finds exact matches. Often you want a range instead, like every snack under a pound. A does that, with an between a column and a value.
< means less than and > means more than. <= means less than or equal to, and >= means more than or equal to. <> means not equal to.
Prices in the snacks table are in pence, so price < 100 finds every snack under a pound.
SELECT name, price FROM snacks WHERE price < 100; In <= and >= the = always comes second, never first.
guess first
Chocolate costs exactly 120. What does this show?
Guess before you run it. Wrong guesses are how you learn, and nothing is marked.
SELECT name FROM snacks WHERE price > 120;
your turn
Your turn. Find the snacks still on the shelf.
The stock column says how many of each snack are left, and popcorn has run out. Choose an operator and a number so the query finds every snack in stock, but not popcorn.
result
Your answer appears here as a table.
fix it
The database cannot read this sign. Fix it!
result
Your answer appears here as a table.
- Read the error. Which symbol does it point near?
- The
>and the=are both right, but they are in the wrong order. - Change => to >=, then press run.
nailed it
you can find rows above and below a line. :D
<means less than,>more than,<>not equal to.<=and>=include the value itself.- In
<=and>=the=comes second.
new words in your collection
- comparison
- operator
This lesson isn’t saved. A free account remembers every lesson you finish.