root@coding-prodigies:~# โ–Š
// lesson 2 of 12 ยท 16 min

SELECT, WHERE, and ORDER BY

โš‘ Report an issue with this lesson
SELECT title, price
FROM courses
WHERE level = 'beginner'
ORDER BY price ASC;

SELECT chooses columns, FROM chooses the table, WHERE filters rows, ORDER BY sorts the result. Common WHERE patterns:

WHERE price > 50
WHERE level IN ('beginner', 'intermediate')
WHERE title LIKE '%Python%'
WHERE price BETWEEN 30 AND 100

SELECT * grabs every column โ€” fine for exploring, but in real application code, name the columns you actually need.

Try it yourself

Exercise: Using the courses table below, write a SELECT for title and price where level = 'beginner', ordered by price ascending.
Expected output: open-ended โ€” there's no single correct output here, just get your code running without errors.
sqlite3
Output

      
    

Run your code and get it working before marking this lesson complete.

// free preview

9 more lessons โ€” including Project: design a small course-platform schema โ€” plus a certificate are waiting.

Unlock the full course โ€” $59.99