Intro to SQLfor Organizing
Module 5 · You are here

Filtering and Sorting: WHERE, ORDER BY, LIMIT

Move from "show me ten rows" to "show me the rows that actually answer my question." You'll meet the full operator menu, combine conditions with AND/OR, handle NULLs the right way, and float the headline row to the top with ORDER BY.

Time~20 minutes
BadgeFilter Builder
DeviceDesktop recommended
ArtifactOne useful filter + sort

By the end of Module 5, you will be able to:

  • Add a WHERE clause to filter rows by one condition.
  • Use the full operator menu: =, !=, >, <, >=, <=, IN, NOT, LIKE, BETWEEN.
  • Combine conditions with AND, OR, and NOT.
  • Handle missing values correctly with IS NULL and IS NOT NULL.
  • Sort with ORDER BY (ASC / DESC, multi-column).
  • Use LIMIT after ORDER BY to return the top N results.

Subsections in Module 5

Start here: Module 5.1 · WHERE: the gatekeeper
Begin Module 5
After Module 5: Module 6 · Summarizing and Sharing: GROUP BY, COUNT, Saved Queries
Next: Module 6 · Summarizing and Sharing: GROUP BY, COUNT, Saved Queries