← SQL Analyst Starter

Lesson 1 of 4

Filter with both conditions

Select paid orders strictly above a threshold.

Do the work

  1. SELECT declares the output columns.
  2. WHERE combines status and amount with AND.
  3. An amount equal to the threshold does not pass a strict > test.

See the method

SELECT order_id, amount FROM orders

Watch the walkthrough

Read the video transcript
  1. Filter with both conditions. SELECT order_id, amount FROM orders
  2. Filter with both conditions. Exclude pending order 2 and boundary order 3. Include paid orders 1, 4 and 7.
  3. Group without losing rows. Filter paid orders.
  4. Group without losing rows. Keep the North sale and the East orphan order; customer existence is not a condition.
  5. Join and keep unmatched orders. Orders are the left table.
  6. Join and keep unmatched orders. An inner join drops order 5 and order 6. Join on the ID.
  7. Treat NULL explicitly. Riley has NULL email; Casey has an empty email.
  8. Treat NULL explicitly. NULL and an empty string are different values.

The video works through all four course topics; the lesson demonstrations above focus on the current step.

Practice independently

Take it further

Try a WITH expression to name the paid-order subset before filtering.