Technical skill practice

SQL WHERE: Define the Rows That Belong in a Report

WHERE selects rows whose condition is true before the result is returned. Start with a plain description of the population, then translate each part into a condition on the available columns.

The practice task

List completed assignments submitted on or after a stated date. The fictional fixture contains an older completion, a recent draft and a recent completion with no submission date.

The data below is fictional. Run the example in a new SQLite database. It was checked with SQLite 3.51.0; other databases may use different syntax, functions or type rules.

Complete worked query

Create the small fixture and run the query together. The IDs, boundary values and missing entries make the result small enough to check by hand.

CREATE TABLE assignments(id INTEGER, status TEXT, submitted TEXT);
INSERT INTO assignments VALUES (1,'completed','2026-09-01'),(2,'draft','2026-10-05'),(3,'completed','2026-10-06'),(4,'completed',NULL);

SELECT id, submitted FROM assignments
WHERE status = 'completed' AND submitted >= '2026-10-01'
ORDER BY id;

Checked result

This is the result of the exact example above. NULL marks a missing database value rather than the text string "NULL".

Result rows

id | submitted

3 | 2026-10-06

Read the result

Only assignment 3 satisfies both conditions. Assignment 1 is too old, assignment 2 is a draft and assignment 4 has no known date that establishes it is inside the reporting period. The query does not edit any assignment.

The dates here use a consistent ISO year-month-day text format. That assumption makes the lexical comparison useful for these values. Mixing date formats or adding timestamps with different offsets requires a normalization and time-boundary decision first.

A filtered report cannot distinguish absent records from records excluded by its conditions unless you inspect the source. When a count looks low, check one condition at a time and review the rejected examples. Do not remove a condition just to make a total match an expectation.

Mistakes to check

Use these checks when adapting the example to a different dataset.

  • Keep the source population and the reporting period explicit.
  • Do not write = NULL to find a missing value.
  • Check boundary dates and incomplete records when verifying a filter.

Questions, answered

Can I run this example as written?

Yes, in a new SQLite database using the schema and values shown. The result above was checked with SQLite 3.51.0. Keep it separate from an existing database.

How could I include completed assignments whose date still needs review?

Use a separate missing-date report, or explicitly include submitted IS NULL if that is the intended population. Label unknown dates rather than treating them as recent submissions.

Sources and examples

ResumizeAI team. Examples are fictional teaching material, not customer results. Replace sample details with your own facts.

Your experience. A complete resume.

Build in Resumize with ATS-friendly templates, guided editing and a live preview. Start free, then upgrade when you need more.

Free account required. Free-plan PDF exports include a watermark.