Skip to content
Quantoros

Return all columns of transactions in the travel or entertainment categories with an amount over $200, between…

SQLLevel: FoundationBasics and filtering

Return all columns of transactions in the travel or entertainment categories with an amount over $200, between 2026-03-01 and 2026-05-31 inclusive.

Table definitions (from the source exercise):

CREATE TABLE transactions(transaction_id INTEGER PRIMARY KEY, account_id INTEGER, transaction_date TEXT, amount REAL, merchant_category TEXT);
Hints
  • Write an interleaving of two concurrent operations.
  • Which observations does the isolation level permit, and what happens on a mid-operation failure?

Answer

Approach: IN for the category list, BETWEEN for the dates.

SELECT *
FROM transactions
WHERE merchant_category IN ('travel','entertainment')
  AND amount > 200
  AND transaction_date BETWEEN '2026-03-01' AND '2026-05-31';

The source uses SQLite with a MySQL compatibility layer. Date and string functions are dialect dependent; the query is preserved as published.

Source and licence: SQL Practice Lab — Ebrahim Sharifi · MIT

Related questions