Loading Depth Study
Preparing your workspace
SQL clauses allow applications to retrieve only the records they actually need in a specific order.
WHERE filters rows based on conditions. ORDER BY sorts results in ascending or descending order. LIMIT restricts how many rows are returned. Operators such as =, >, <, >=, <=, and <> are commonly used with WHERE. IN, BETWEEN, LIKE, and logical operators such as AND and OR make filtering more expressive. These tools form the foundation of useful application queries.
An admin page can retrieve only published courses, sort them by newest date, and show the first 20 results.
SELECT id, title, difficulty
FROM courses
WHERE published = 1
AND difficulty IN ('Beginner', 'Intermediate')
ORDER BY created_at DESC
LIMIT 20;The query returns up to 20 published beginner or intermediate courses, newest first.