question_id int64 1 75.7k | db_id stringclasses 33 values | db_name stringclasses 4 values | question stringlengths 19 259 | partition stringclasses 4 values | difficulty stringclasses 3 values | SQL stringlengths 25 862 |
|---|---|---|---|---|---|---|
75,701 | book_sql | book_sql | How many Sarah Cortez invoices are still oustanding? | val | medium | SELECT COUNT(DISTINCT transaction_id) FROM master_txn_table WHERE customers = 'sarah cortez' AND transaction_type = 'invoice' AND open_balance > 0 |
75,702 | book_sql | book_sql | How many Service Provisioning did we sell to Kimberly Myers in may last year? | val | medium | SELECT SUM(quantity) FROM master_txn_table WHERE customers = 'kimberly myers' AND product_service = 'service provisioning' AND transaction_type IN ('invoice', 'sales receipt') AND transaction_date BETWEEN DATE(CURRENT_DATE, '-1 year', 'start of year', '+4 month') AND DATE(CURRENT_DATE, '-1 year', 'start of year', '+5 month', '-1 day') |
75,703 | book_sql | book_sql | Did we receive payment from Carlos Larson partnership in aug this year? | val | medium | SELECT transaction_id FROM master_txn_table WHERE transaction_type = 'payment' AND customers = 'carlos larson' AND transaction_date BETWEEN DATE(CURRENT_DATE, 'start of year', '+7 month') AND DATE(CURRENT_DATE, 'start of year', '+8 month', '-1 day') |
75,704 | book_sql | book_sql | Number of invoices created for Dance performances in This month? | val | medium | SELECT COUNT(DISTINCT transaction_id) FROM master_txn_table WHERE transaction_type = 'invoice' AND INSTR(account, 'dance performances') AND transaction_date BETWEEN DATE(CURRENT_DATE, 'start of month') AND DATE(CURRENT_DATE) |
75,705 | book_sql | book_sql | Check the sales receipts record and compute the average quantities ordered with the payment method [payment_method]. | val | hard | SELECT AVG(quantity_per_transaction) FROM (SELECT transaction_id, SUM(quantity) AS quantity_per_transaction FROM master_txn_table WHERE transaction_type = 'sales receipt' AND payment_method = '[payment_method]' GROUP BY transaction_id) |
75,706 | book_sql | book_sql | How many Citronella oil did we sell to Sylvia Bennett This year? | val | medium | SELECT SUM(quantity) FROM master_txn_table WHERE customers = 'sylvia bennett' AND product_service = 'citronella oil' AND transaction_type IN ('invoice', 'sales receipt') AND transaction_date BETWEEN DATE(CURRENT_DATE, 'start of year') AND DATE(CURRENT_DATE) |
75,707 | book_sql | book_sql | How much revenue came through Jordan Patterson YTD? | val | hard | SELECT SUM(credit) FROM master_txn_table AS t1 JOIN chart_of_accounts AS t2 ON t1.account = t2.account_name WHERE customers = 'jordan patterson' AND account_type IN ('income', 'other income') AND transaction_date BETWEEN DATE(CURRENT_DATE, 'start of year') AND DATE(CURRENT_DATE) |
75,708 | book_sql | book_sql | How much did Helen Brown spend on Arizona Dept. of Revenue Payable in July during last year? | val | hard | SELECT SUM(debit) FROM master_txn_table AS t1 JOIN chart_of_accounts AS t2 ON t1.account = t2.account_name WHERE t1.customers = 'helen brown' AND INSTR(account, 'arizona dept. of revenue payable') AND STRFTIME('%m', transaction_date) = '07' AND STRFTIME('%y', transaction_date) = STRFTIME('%y', CURRENT_DATE) - 1 AND account_type IN ('expense', 'other expense') |
75,709 | book_sql | book_sql | What was the last bill Dustin Sandoval received from Katherine Hart? | val | medium | SELECT MAX(credit) FROM master_txn_table WHERE customers = 'dustin sandoval' AND transaction_type = 'bill' AND vendor = 'katherine hart' |
75,710 | book_sql | book_sql | How much did Rose Harris spend on Campground and RV park services in July during last year? | val | hard | SELECT SUM(debit) FROM master_txn_table AS t1 JOIN chart_of_accounts AS t2 ON t1.account = t2.account_name WHERE t1.customers = 'rose harris' AND INSTR(account, 'campground and rv park services') AND STRFTIME('%m', transaction_date) = '07' AND STRFTIME('%y', transaction_date) = STRFTIME('%y', CURRENT_DATE) - 1 AND account_type IN ('expense', 'other expense') |
75,711 | book_sql | book_sql | What was the first invoice value for Hydrogen manufacturing in MTD? | val | medium | SELECT MIN(credit) FROM master_txn_table WHERE transaction_type = 'invoice' AND INSTR(account, 'hydrogen manufacturing') AND transaction_date BETWEEN DATE(CURRENT_DATE, 'start of month') AND DATE(CURRENT_DATE) |
75,712 | book_sql | book_sql | What was the first bill Caleb Price received from Christopher Raymond? | val | medium | SELECT MIN(credit) FROM master_txn_table WHERE customers = 'caleb price' AND transaction_type = 'bill' AND vendor = 'christopher raymond' |
75,713 | book_sql | book_sql | How many Golf Instructions did we sell to Mrs. Brittany Fisher MD This quarter? | val | medium | SELECT SUM(quantity) FROM master_txn_table WHERE customers = 'mrs. brittany fisher md' AND product_service = 'golf instructions' AND transaction_type IN ('invoice', 'sales receipt') AND transaction_date >= STRFTIME('%y-%m-%d', STRFTIME('%y', 'now', '-1 year') || '-' || SUBSTRING('00' || ((CAST((STRFTIME('%m', 'now') - 1) AS REAL) / 3) * 3 + 1), -2, 2) || '-01') |
75,714 | book_sql | book_sql | Did we receive payment from Brandon Moore partnership today? | val | medium | SELECT transaction_id FROM master_txn_table WHERE transaction_type = 'payment' AND customers = 'brandon moore' AND transaction_date BETWEEN DATE(CURRENT_DATE) AND DATE(CURRENT_DATE) |
75,715 | book_sql | book_sql | How many Dominic Spencer invoices are still oustanding? | val | medium | SELECT COUNT(DISTINCT transaction_id) FROM master_txn_table WHERE customers = 'dominic spencer' AND transaction_type = 'invoice' AND open_balance > 0 |
75,716 | book_sql | book_sql | Check the sales receipts record and compute the average quantities ordered with the payment method [payment_method]. | val | hard | SELECT AVG(quantity_per_transaction) FROM (SELECT transaction_id, SUM(quantity) AS quantity_per_transaction FROM master_txn_table WHERE transaction_type = 'sales receipt' AND payment_method = '[payment_method]' GROUP BY transaction_id) |
75,717 | book_sql | book_sql | What our monthly spend on Nicholas Perez | val | hard | SELECT DATE(transaction_date, 'start of month'), SUM(debit) FROM master_txn_table WHERE vendor = 'nicholas perez' GROUP BY DATE(transaction_date, 'start of month') |
75,718 | book_sql | book_sql | Did we receive payment from James Mann partnership Last 12 months? | val | medium | SELECT transaction_id FROM master_txn_table WHERE transaction_type = 'payment' AND customers = 'james mann' AND transaction_date BETWEEN DATE(CURRENT_DATE, '-12 months', 'start of month') AND DATE(CURRENT_DATE, 'start of month', '-1 day') |
75,719 | book_sql | book_sql | What acount had our biggest expense This year? | val | hard | SELECT account, SUM(debit) FROM master_txn_table AS t1 JOIN chart_of_accounts AS t2 ON t1.account = t2.account_name WHERE account_type IN ('expense', 'other expense') AND transaction_date BETWEEN DATE(CURRENT_DATE, 'start of year') AND DATE(CURRENT_DATE) GROUP BY account ORDER BY SUM(debit) DESC LIMIT 1 |
75,720 | book_sql | book_sql | What our monthly spend on Lindsey Owens | val | hard | SELECT DATE(transaction_date, 'start of month'), SUM(debit) FROM master_txn_table WHERE vendor = 'lindsey owens' GROUP BY DATE(transaction_date, 'start of month') |
75,721 | book_sql | book_sql | Check the sales receipts record and compute the average quantities ordered with the payment method [payment_method]. | val | hard | SELECT AVG(quantity_per_transaction) FROM (SELECT transaction_id, SUM(quantity) AS quantity_per_transaction FROM master_txn_table WHERE transaction_type = 'sales receipt' AND payment_method = '[payment_method]' GROUP BY transaction_id) |
75,722 | book_sql | book_sql | As of This quarter to date, how many invoices for Donna Brock remained unpaid? | val | medium | SELECT COUNT(DISTINCT transaction_id) FROM master_txn_table WHERE customers = 'donna brock' AND transaction_type = 'invoice' AND open_balance > 0 AND transaction_date >= STRFTIME('%y-%m-%d', STRFTIME('%y', 'now', '-1 year') || '-' || SUBSTRING('00' || ((CAST((STRFTIME('%m', 'now') - 1) AS REAL) / 3) * 3 + 1), -2, 2) || '-01') |
75,723 | book_sql | book_sql | Compare sales by customer Last month | val | hard | SELECT customers, SUM(credit) FROM master_txn_table WHERE account IN ('income', 'other income') AND transaction_date BETWEEN DATE(CURRENT_DATE, 'start of month', '-1 months') AND DATE(CURRENT_DATE, 'start of month', '-1 days') GROUP BY customers |
75,724 | book_sql | book_sql | When was the last time we sold Home office | val | hard | SELECT transaction_date FROM master_txn_table AS t1 JOIN chart_of_accounts AS t2 ON t1.account = t2.account_name WHERE account_type IN ('income', 'other income') AND product_service = 'home office' ORDER BY transaction_date DESC LIMIT 1 |
75,725 | book_sql | book_sql | Compare sales by customer This month | val | hard | SELECT customers, SUM(credit) FROM master_txn_table WHERE account IN ('income', 'other income') AND transaction_date BETWEEN DATE(CURRENT_DATE, 'start of month') AND DATE(CURRENT_DATE) GROUP BY customers |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.