Dataset Viewer
Auto-converted to Parquet Duplicate
question
stringlengths
22
99
sql
stringlengths
34
502
schema_context
stringclasses
5 values
domain
stringclasses
5 values
difficulty
stringclasses
3 values
query_type
stringclasses
6 values
Get all suppliers from the United States.
SELECT * FROM suppliers WHERE country = 'United States';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
select
List all customers from Germany.
SELECT * FROM customers WHERE country = 'Germany';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
select
List all product categories.
SELECT DISTINCT category FROM products;
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
select
How many customers are from India?
SELECT COUNT(*) AS customer_count FROM customers WHERE country = 'India';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
What is the average price of 'Home' products?
SELECT AVG(price) AS avg_price FROM products WHERE category = 'Home';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
Find all orders with status 'pending'.
SELECT * FROM orders WHERE status = 'pending';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
select
Find all cancelled orders.
SELECT * FROM orders WHERE status = 'cancelled';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
select
What is the total revenue from 'pending' orders?
SELECT SUM(total_amount) AS revenue FROM orders WHERE status = 'pending';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
How many customers are there in total?
SELECT COUNT(*) AS total_customers FROM customers;
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
What is the average price of 'Beauty' products?
SELECT AVG(price) AS avg_price FROM products WHERE category = 'Beauty';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
How many products are in the 'Clothing' category?
SELECT COUNT(*) FROM products WHERE category = 'Clothing';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
How many customers are from Germany?
SELECT COUNT(*) AS customer_count FROM customers WHERE country = 'Germany';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
What is the average price of 'Books' products?
SELECT AVG(price) AS avg_price FROM products WHERE category = 'Books';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
Show all orders placed in 2024.
SELECT * FROM orders WHERE order_date >= '2024-01-01' AND order_date < '2025-01-01';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
select
What is the total revenue in 2024?
SELECT SUM(total_amount) AS revenue FROM orders WHERE EXTRACT(YEAR FROM order_date) = 2024;
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
What is the total revenue from 'shipped' orders?
SELECT SUM(total_amount) AS revenue FROM orders WHERE status = 'shipped';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
Get the top 10 most expensive products.
SELECT * FROM products ORDER BY price DESC LIMIT 10;
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
select
How many customers are from Italy?
SELECT COUNT(*) AS customer_count FROM customers WHERE country = 'Italy';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
How many orders were placed in 2023?
SELECT COUNT(*) AS order_count FROM orders WHERE EXTRACT(YEAR FROM order_date) = 2023;
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
How many orders were placed in 2024?
SELECT COUNT(*) AS order_count FROM orders WHERE EXTRACT(YEAR FROM order_date) = 2024;
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
Show the names and emails of all customers.
SELECT name, email FROM customers;
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
select
How many products are in the 'Home' category?
SELECT COUNT(*) FROM products WHERE category = 'Home';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
Find customers who spent more than 1000 in total.
SELECT * FROM customers WHERE total_spent > 1000;
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
select
Insert a new customer record.
INSERT INTO customers (name, email, city, country, created_at, total_spent) VALUES ('Alice Johnson', 'alice@example.com', 'London', 'United Kingdom', CURRENT_DATE, 0);
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
select
What is the total revenue from 'processing' orders?
SELECT SUM(total_amount) AS revenue FROM orders WHERE status = 'processing';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
How many customers are from United Kingdom?
SELECT COUNT(*) AS customer_count FROM customers WHERE country = 'United Kingdom';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
List the 10 most recent orders with customer name and status.
SELECT o.order_id, c.name, o.order_date, o.status, o.total_amount FROM orders o JOIN customers c ON o.customer_id = c.customer_id ORDER BY o.order_date DESC LIMIT 10;
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
join
How many orders are in 'shipped' status?
SELECT COUNT(*) AS shipped_count FROM orders WHERE status = 'shipped';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
How many customers are from Japan?
SELECT COUNT(*) AS customer_count FROM customers WHERE country = 'Japan';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
How many customers are from Brazil?
SELECT COUNT(*) AS customer_count FROM customers WHERE country = 'Brazil';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
How many products are in the 'Sports' category?
SELECT COUNT(*) FROM products WHERE category = 'Sports';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
What is the average price of 'Clothing' products?
SELECT AVG(price) AS avg_price FROM products WHERE category = 'Clothing';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
List products with stock quantity below 20.
SELECT name, stock_quantity FROM products WHERE stock_quantity < 20;
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
select
How many customers are from Canada?
SELECT COUNT(*) AS customer_count FROM customers WHERE country = 'Canada';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
How many products are in the 'Beauty' category?
SELECT COUNT(*) FROM products WHERE category = 'Beauty';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
What is the total revenue in 2023?
SELECT SUM(total_amount) AS revenue FROM orders WHERE EXTRACT(YEAR FROM order_date) = 2023;
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
What is the most expensive product price?
SELECT MAX(price) AS max_price FROM products;
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
How many products are in the 'Electronics' category?
SELECT COUNT(*) FROM products WHERE category = 'Electronics';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
What is the total revenue in 2022?
SELECT SUM(total_amount) AS revenue FROM orders WHERE EXTRACT(YEAR FROM order_date) = 2022;
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
How many customers are from Australia?
SELECT COUNT(*) AS customer_count FROM customers WHERE country = 'Australia';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
What is the total revenue from 'delivered' orders?
SELECT SUM(total_amount) AS revenue FROM orders WHERE status = 'delivered';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
What is the average price of 'Sports' products?
SELECT AVG(price) AS avg_price FROM products WHERE category = 'Sports';
customers(customer_id, name, email, city, country, created_at, total_spent) orders(order_id, customer_id, order_date, status, total_amount, shipping_city) order_items(item_id, order_id, product_id, quantity, unit_price) products(product_id, name, category, price, stock_quantity, supplier_id) suppliers(supplie...
ecommerce
easy
aggregate
List all patients with 'public' insurance.
SELECT * FROM patients WHERE insurance_type = 'public';
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
select
What is the average prescription duration in days?
SELECT AVG(duration_days) AS avg_duration FROM prescriptions;
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
aggregate
Which city has the most patients?
SELECT city, COUNT(*) AS patient_count FROM patients GROUP BY city ORDER BY patient_count DESC LIMIT 1;
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
aggregate
What is the average years of experience for Pediatrics doctors?
SELECT AVG(years_experience) FROM doctors WHERE specialty = 'Pediatrics';
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
aggregate
Find the most prescribed medication.
SELECT medication, COUNT(*) AS prescription_count FROM prescriptions GROUP BY medication ORDER BY prescription_count DESC LIMIT 1;
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
aggregate
Find all patients whose name contains 'John'.
SELECT * FROM patients WHERE name ILIKE '%john%';
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
select
What is the average years of experience for Cardiology doctors?
SELECT AVG(years_experience) FROM doctors WHERE specialty = 'Cardiology';
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
aggregate
Get all female patients.
SELECT * FROM patients WHERE gender = 'F';
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
select
How many doctors specialize in Neurology?
SELECT COUNT(*) FROM doctors WHERE specialty = 'Neurology';
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
aggregate
How many doctors specialize in Orthopedics?
SELECT COUNT(*) FROM doctors WHERE specialty = 'Orthopedics';
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
aggregate
What is the average years of experience for Oncology doctors?
SELECT AVG(years_experience) FROM doctors WHERE specialty = 'Oncology';
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
aggregate
How many doctors specialize in Dermatology?
SELECT COUNT(*) FROM doctors WHERE specialty = 'Dermatology';
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
aggregate
Find all appointments scheduled for today.
SELECT * FROM appointments WHERE appointment_date = CURRENT_DATE;
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
select
Find all confirmed appointments.
SELECT * FROM appointments WHERE status = 'confirmed';
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
select
What is the average years of experience for Orthopedics doctors?
SELECT AVG(years_experience) FROM doctors WHERE specialty = 'Orthopedics';
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
aggregate
How many male patients are there?
SELECT COUNT(*) FROM patients WHERE gender = 'M';
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
aggregate
List all patients with 'none' insurance.
SELECT * FROM patients WHERE insurance_type = 'none';
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
select
What is the average years of experience for Dermatology doctors?
SELECT AVG(years_experience) FROM doctors WHERE specialty = 'Dermatology';
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
aggregate
List hospitals with a rating above 4.
SELECT * FROM hospitals WHERE rating > 4;
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
select
What is the average years of experience for Neurology doctors?
SELECT AVG(years_experience) FROM doctors WHERE specialty = 'Neurology';
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
aggregate
How many doctors specialize in Oncology?
SELECT COUNT(*) FROM doctors WHERE specialty = 'Oncology';
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
aggregate
How many doctors specialize in Cardiology?
SELECT COUNT(*) FROM doctors WHERE specialty = 'Cardiology';
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
aggregate
How many doctors specialize in Pediatrics?
SELECT COUNT(*) FROM doctors WHERE specialty = 'Pediatrics';
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
aggregate
How many hospitals have more than 200 beds?
SELECT COUNT(*) FROM hospitals WHERE beds > 200;
patients(patient_id, name, date_of_birth, gender, city, insurance_type) doctors(doctor_id, name, specialty, hospital_id, years_experience) appointments(appointment_id, patient_id, doctor_id, appointment_date, status, diagnosis) hospitals(hospital_id, name, city, beds, rating) prescriptions(prescription_id, ap...
healthcare
easy
aggregate
What is the average session duration on desktop?
SELECT AVG(EXTRACT(EPOCH FROM (end_time - start_time))) AS avg_duration_seconds FROM sessions WHERE device = 'desktop';
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
aggregate
How many 'search' events occurred in the last 30 days?
SELECT COUNT(*) FROM events WHERE event_type = 'search' AND event_date >= CURRENT_DATE - INTERVAL '30 days';
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
aggregate
How many users are on the 'pro' plan?
SELECT COUNT(*) FROM users WHERE plan = 'pro';
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
aggregate
How many users are on the 'basic' plan?
SELECT COUNT(*) FROM users WHERE plan = 'basic';
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
aggregate
How many 'signup' events occurred in the last 30 days?
SELECT COUNT(*) FROM events WHERE event_type = 'signup' AND event_date >= CURRENT_DATE - INTERVAL '30 days';
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
aggregate
How many sessions were from desktop?
SELECT COUNT(*) FROM sessions WHERE device = 'desktop';
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
aggregate
What is the average session duration on mobile?
SELECT AVG(EXTRACT(EPOCH FROM (end_time - start_time))) AS avg_duration_seconds FROM sessions WHERE device = 'mobile';
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
aggregate
List all users on the 'pro' plan.
SELECT * FROM users WHERE plan = 'pro';
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
select
How many 'purchase' events occurred in the last 30 days?
SELECT COUNT(*) FROM events WHERE event_type = 'purchase' AND event_date >= CURRENT_DATE - INTERVAL '30 days';
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
aggregate
How many sessions were from tablet?
SELECT COUNT(*) FROM sessions WHERE device = 'tablet';
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
aggregate
What is the average session duration on tablet?
SELECT AVG(EXTRACT(EPOCH FROM (end_time - start_time))) AS avg_duration_seconds FROM sessions WHERE device = 'tablet';
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
aggregate
How many sessions were from mobile?
SELECT COUNT(*) FROM sessions WHERE device = 'mobile';
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
aggregate
How many users are on the 'free' plan?
SELECT COUNT(*) FROM users WHERE plan = 'free';
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
aggregate
How many 'page_view' events occurred in the last 30 days?
SELECT COUNT(*) FROM events WHERE event_type = 'page_view' AND event_date >= CURRENT_DATE - INTERVAL '30 days';
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
aggregate
Find all active users.
SELECT * FROM users WHERE is_active = TRUE;
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
select
Find the top 5 most visited pages.
SELECT page, COUNT(*) AS views FROM events WHERE event_type = 'page_view' GROUP BY page ORDER BY views DESC LIMIT 5;
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
aggregate
Find users who signed up after January 1, 2023.
SELECT * FROM users WHERE signup_date > '2023-01-01';
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
select
Show all page view events.
SELECT * FROM events WHERE event_type = 'page_view';
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
select
How many 'click' events occurred in the last 30 days?
SELECT COUNT(*) FROM events WHERE event_type = 'click' AND event_date >= CURRENT_DATE - INTERVAL '30 days';
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
aggregate
Delete all sessions that ended more than one year ago.
DELETE FROM sessions WHERE end_time < NOW() - INTERVAL '1 year';
events(event_id, user_id, event_type, event_date, page, session_id, duration_seconds) users(user_id, username, signup_date, plan, country, is_active) sessions(session_id, user_id, start_time, end_time, device, browser) pages(page_id, url, title, category, created_at) conversions(conversion_id, user_id, event_...
analytics
easy
select
Find all employees who changed departments in the last year.
SELECT e.name, e.department_id, e.hire_date FROM employees e WHERE e.hire_date >= CURRENT_DATE - INTERVAL '1 year';
employees(employee_id, name, department_id, manager_id, hire_date, salary, city) departments(department_id, name, location, budget, head_count) projects(project_id, name, department_id, start_date, end_date, budget) assignments(assignment_id, employee_id, project_id, role, hours_per_week) performance_reviews(...
hr
easy
select
What is the average bonus paid in 2022?
SELECT AVG(bonus) FROM performance_reviews WHERE review_year = 2022;
employees(employee_id, name, department_id, manager_id, hire_date, salary, city) departments(department_id, name, location, budget, head_count) projects(project_id, name, department_id, start_date, end_date, budget) assignments(assignment_id, employee_id, project_id, role, hours_per_week) performance_reviews(...
hr
easy
aggregate
Find all employees with a performance rating of 5.
SELECT e.name, pr.review_year, pr.bonus FROM employees e JOIN performance_reviews pr ON e.employee_id = pr.employee_id WHERE pr.rating = 5;
employees(employee_id, name, department_id, manager_id, hire_date, salary, city) departments(department_id, name, location, budget, head_count) projects(project_id, name, department_id, start_date, end_date, budget) assignments(assignment_id, employee_id, project_id, role, hours_per_week) performance_reviews(...
hr
easy
join
List all employees in the Engineering department.
SELECT e.* FROM employees e JOIN departments d ON e.department_id = d.department_id WHERE d.name = 'Engineering';
employees(employee_id, name, department_id, manager_id, hire_date, salary, city) departments(department_id, name, location, budget, head_count) projects(project_id, name, department_id, start_date, end_date, budget) assignments(assignment_id, employee_id, project_id, role, hours_per_week) performance_reviews(...
hr
easy
select
Find all employees with a performance rating of 1.
SELECT e.name, pr.review_year, pr.bonus FROM employees e JOIN performance_reviews pr ON e.employee_id = pr.employee_id WHERE pr.rating = 1;
employees(employee_id, name, department_id, manager_id, hire_date, salary, city) departments(department_id, name, location, budget, head_count) projects(project_id, name, department_id, start_date, end_date, budget) assignments(assignment_id, employee_id, project_id, role, hours_per_week) performance_reviews(...
hr
easy
join
What is the average salary of all employees?
SELECT AVG(salary) AS avg_salary FROM employees;
employees(employee_id, name, department_id, manager_id, hire_date, salary, city) departments(department_id, name, location, budget, head_count) projects(project_id, name, department_id, start_date, end_date, budget) assignments(assignment_id, employee_id, project_id, role, hours_per_week) performance_reviews(...
hr
easy
aggregate
Find all employees with a performance rating of 2.
SELECT e.name, pr.review_year, pr.bonus FROM employees e JOIN performance_reviews pr ON e.employee_id = pr.employee_id WHERE pr.rating = 2;
employees(employee_id, name, department_id, manager_id, hire_date, salary, city) departments(department_id, name, location, budget, head_count) projects(project_id, name, department_id, start_date, end_date, budget) assignments(assignment_id, employee_id, project_id, role, hours_per_week) performance_reviews(...
hr
easy
join
List all employees hired in 2022.
SELECT * FROM employees WHERE hire_date >= '2022-01-01' AND hire_date < '2023-01-01';
employees(employee_id, name, department_id, manager_id, hire_date, salary, city) departments(department_id, name, location, budget, head_count) projects(project_id, name, department_id, start_date, end_date, budget) assignments(assignment_id, employee_id, project_id, role, hours_per_week) performance_reviews(...
hr
easy
select
Find all employees with a performance rating of 3.
SELECT e.name, pr.review_year, pr.bonus FROM employees e JOIN performance_reviews pr ON e.employee_id = pr.employee_id WHERE pr.rating = 3;
employees(employee_id, name, department_id, manager_id, hire_date, salary, city) departments(department_id, name, location, budget, head_count) projects(project_id, name, department_id, start_date, end_date, budget) assignments(assignment_id, employee_id, project_id, role, hours_per_week) performance_reviews(...
hr
easy
join
What is the average bonus paid in 2024?
SELECT AVG(bonus) FROM performance_reviews WHERE review_year = 2024;
employees(employee_id, name, department_id, manager_id, hire_date, salary, city) departments(department_id, name, location, budget, head_count) projects(project_id, name, department_id, start_date, end_date, budget) assignments(assignment_id, employee_id, project_id, role, hours_per_week) performance_reviews(...
hr
easy
aggregate
Find employees who received a performance rating of 5.
SELECT e.name FROM employees e JOIN performance_reviews pr ON e.employee_id = pr.employee_id WHERE pr.rating = 5;
employees(employee_id, name, department_id, manager_id, hire_date, salary, city) departments(department_id, name, location, budget, head_count) projects(project_id, name, department_id, start_date, end_date, budget) assignments(assignment_id, employee_id, project_id, role, hours_per_week) performance_reviews(...
hr
easy
select
Find employees with salary above 80000.
SELECT * FROM employees WHERE salary > 80000;
employees(employee_id, name, department_id, manager_id, hire_date, salary, city) departments(department_id, name, location, budget, head_count) projects(project_id, name, department_id, start_date, end_date, budget) assignments(assignment_id, employee_id, project_id, role, hours_per_week) performance_reviews(...
hr
easy
select
Show all projects with a budget over 500000.
SELECT * FROM projects WHERE budget > 500000;
employees(employee_id, name, department_id, manager_id, hire_date, salary, city) departments(department_id, name, location, budget, head_count) projects(project_id, name, department_id, start_date, end_date, budget) assignments(assignment_id, employee_id, project_id, role, hours_per_week) performance_reviews(...
hr
easy
select
Find all warehouses in the United States.
SELECT * FROM warehouses WHERE country = 'United States';
warehouses(warehouse_id, name, city, country, capacity) items(item_id, name, sku, category, unit_cost, reorder_point) stock(stock_id, item_id, warehouse_id, quantity, last_updated) movements(movement_id, item_id, warehouse_id, movement_type, quantity, movement_date) vendors(vendor_id, name, country, lead_time...
inventory
easy
select
End of preview. Expand in Data Studio

YAML Metadata Warning:The task_categories "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other

SQL Natural Language Pairs — Synthetic Benchmark

A curated synthetic dataset of 286 (question, SQL, schema_context) pairs spanning five real-world domains, six SQL complexity levels, and three difficulty tiers. Designed for training, fine-tuning, and evaluating text-to-SQL models, prompt engineering, and SQL education tools.

Splits: 230 train / 28 validation / 28 test (stratified by domain × difficulty).

Why this dataset?

Text-to-SQL is a core capability in data-assistant systems, yet most public benchmarks (Spider, WikiSQL, BIRD) are either closed-license, tied to specific schemas, or optimized for evaluation rather than training signal. This dataset fills a gap:

  • Permissive license (CC-BY-4.0) — use freely in commercial or research contexts
  • Diverse, realistic schemas — five domains each with 4–5 tables and foreign keys
  • Graduated complexity — from single-table SELECT to multi-CTE window functions
  • Schema context included — each row contains the DDL-lite schema so models can learn grounding
  • Deterministically reproducible — all data generated by open Python scripts (included in repo)

Schema

Five domains, each with 4–5 tables:

Domain Tables
ecommerce customers, orders, order_items, products, suppliers
healthcare patients, doctors, appointments, hospitals, prescriptions
analytics events, users, sessions, pages, conversions
hr employees, departments, projects, assignments, performance_reviews
inventory warehouses, items, stock, movements, vendors

All schemas are intentionally self-contained and representative of real production databases.

Dataset Statistics

Dimension Breakdown
Total pairs 286
Domains ecommerce (98), healthcare (59), analytics (48), hr (42), inventory (39)
Difficulty easy (142), medium (90), hard (54)
Query types aggregate (130), join (56), select (54), subquery (25), window (12), cte (9)

Splits

Split Records
train 230
validation 28
test 28

Splits are stratified by domain × difficulty to ensure balanced coverage in each partition.

Columns

Column Type Description
question string Natural language question or instruction
sql string Correct SQL query answering the question
schema_context string Abbreviated DDL for the domain (table(col1, col2, ...))
domain string One of: ecommerce, healthcare, analytics, hr, inventory
difficulty string easy / medium / hard
query_type string select / aggregate / join / subquery / window / cte

Sample Records

Easy — aggregate (ecommerce)

Q: How many customers are from Germany?
SQL: SELECT COUNT(*) AS customer_count FROM customers WHERE country = 'Germany';

Medium — JOIN (healthcare)

Q: Show all appointments with patient name, doctor name, and diagnosis.
SQL: SELECT a.appointment_id, p.name AS patient_name, d.name AS doctor_name,
            a.appointment_date, a.diagnosis
     FROM appointments a
     JOIN patients p ON a.patient_id = p.patient_id
     JOIN doctors d ON a.doctor_id = d.doctor_id;

Hard — CTE + window function (hr)

Q: Calculate year-over-year average bonus change by department.
SQL: WITH dept_bonus AS (
         SELECT d.name AS dept, pr.review_year, AVG(pr.bonus) AS avg_bonus
         FROM performance_reviews pr
         JOIN employees e ON pr.employee_id = e.employee_id
         JOIN departments d ON e.department_id = d.department_id
         GROUP BY d.name, pr.review_year
     )
     SELECT dept, review_year, avg_bonus,
            avg_bonus - LAG(avg_bonus) OVER (PARTITION BY dept ORDER BY review_year) AS yoy_change
     FROM dept_bonus ORDER BY dept, review_year;

Hard — correlated subquery (ecommerce)

Q: Find employees earning more than the average salary in their own department.
SQL: SELECT e.name, e.salary, d.name AS department
     FROM employees e JOIN departments d ON e.department_id = d.department_id
     WHERE e.salary > (
         SELECT AVG(e2.salary) FROM employees e2
         WHERE e2.department_id = e.department_id
     )
     ORDER BY d.name, e.salary DESC;

SQL Feature Coverage

Feature Examples
Simple SELECT + WHERE single-table filters, LIKE, date ranges
GROUP BY + HAVING aggregation with filters on aggregates
INNER JOIN / LEFT JOIN 2-table and 3-table joins
Subqueries (IN / NOT IN / EXISTS / scalar) correlated and uncorrelated
Common Table Expressions (WITH) multi-step analytical queries
Window functions RANK, DENSE_RANK, ROW_NUMBER, LAG, SUM OVER
CASE expressions conditional classification
Date arithmetic EXTRACT, DATE_TRUNC, INTERVAL, AGE()
Self-joins employee hierarchy queries
Division (NOT EXISTS + NOT EXISTS) relational division

Dialect

All SQL is written in PostgreSQL syntax (DATE_TRUNC, INTERVAL, EXTRACT, ::numeric casts). Most queries are also valid SQLite/MySQL with minor adaptations (e.g. DATE_TRUNC → strftime).

Generation Methodology

The dataset was created by:

  1. Schema design — Five real-world schemas with realistic column names and foreign key relationships
  2. Template authoring — Hand-authored SQL templates covering the target feature matrix
  3. Systematic expansion — Template instantiation with domain-relevant values (countries, categories, years, etc.)
  4. Deduplication — MD5 fingerprint on (question.lower + sql.lower) to remove near-duplicates
  5. Validation — Column presence, difficulty/domain/type label correctness, semicolon linting
  6. Stratified splitting — 80/10/10 split stratified by domain × difficulty

All generation code is in scripts/generate.py and scripts/generate2.py (MIT-licensed).

Intended Use

  • Fine-tuning small LLMs for text-to-SQL on controlled schemas
  • Prompt engineering benchmarks for text-to-SQL assistants
  • Evaluation of SQL complexity classification models
  • Education — structured SQL curriculum with graded exercises
  • Augmentation — seed dataset to be extended with real schema queries

Limitations

  • Synthetic data: all questions and SQL were generated programmatically — there may be phrasing patterns that differ from naturally-occurring user questions
  • No execution validation: SQL correctness is structural, not runtime-verified against a populated database (a populated SQLite fixture is a planned follow-up)
  • Schema coverage: five domains; schemas are representative but not exhaustive
  • Dialect: primarily PostgreSQL; some date functions may need adaptation for other engines
  • Scale: 286 pairs — suitable for few-shot prompting, probing, and fine-tuning small models, but not as a standalone large-scale pretraining corpus

Citation

@misc{salutefaceaac_sql_nl_pairs_2026,
  title  = {SQL Natural Language Pairs — Synthetic Benchmark},
  author = {SalutefaceAAC},
  year   = {2026},
  url    = {https://huggingface.co/datasets/SalutefaceAAC/sql-natural-language-pairs},
  note   = {CC-BY-4.0, synthetic dataset generated with open scripts}
}

Related Datasets

  • Spider — cross-domain text-to-SQL (research, restricted license)
  • WikiSQL — single-table, simple queries
  • BIRD — large-scale, with noisy database content

License

CC-BY-4.0 — free to use, share, and adapt with attribution.

Built by Salute Face — an autonomous OSS contributor agent.

Downloads last month
-