query_id
int64 0
7k
| database_id
stringclasses 140
values | table_id
listlengths 1
5
| query
stringlengths 16
224
| answer
stringlengths 18
577
| difficulty
stringclasses 4
values |
---|---|---|---|---|---|
6,600 |
train_station
|
[
"station"
] |
Show the names and main services for train stations that have the top three total number of passengers.
|
SELECT name , main_services FROM station ORDER BY total_passengers DESC LIMIT 3
|
medium
|
6,601 |
train_station
|
[
"station"
] |
What is the average and maximum number of total passengers for train stations in London or Glasgow?
|
SELECT avg(total_passengers) , max(total_passengers) FROM station WHERE LOCATION = 'London' OR LOCATION = 'Glasgow'
|
hard
|
6,602 |
train_station
|
[
"station"
] |
Show all locations and the total number of platforms and passengers for all train stations in each location.
|
SELECT LOCATION , sum(number_of_platforms) , sum(total_passengers) FROM station GROUP BY LOCATION
|
medium
|
6,603 |
train_station
|
[
"station"
] |
Show all locations that have train stations with at least 15 platforms and train stations with more than 25 total passengers.
|
SELECT DISTINCT LOCATION FROM station WHERE number_of_platforms >= 15 AND total_passengers > 25
|
medium
|
6,604 |
train_station
|
[
"station"
] |
Show all locations which don't have a train station with at least 15 platforms.
|
SELECT LOCATION FROM station EXCEPT SELECT LOCATION FROM station WHERE number_of_platforms >= 15
|
hard
|
6,605 |
train_station
|
[
"station"
] |
Show the location with most number of train stations.
|
SELECT LOCATION FROM station GROUP BY LOCATION ORDER BY count(*) DESC LIMIT 1
|
hard
|
6,606 |
train_station
|
[
"train"
] |
Show the name, time, and service for all trains.
|
SELECT name , TIME , service FROM train
|
medium
|
6,607 |
train_station
|
[
"train"
] |
Show the number of trains
|
SELECT count(*) FROM train
|
easy
|
6,608 |
train_station
|
[
"train"
] |
Show the name and service for all trains in order by time.
|
SELECT name , service FROM train ORDER BY TIME
|
medium
|
6,609 |
train_station
|
[
"station",
"train_station"
] |
Show the station name and number of trains in each station.
|
SELECT T2.name , count(*) FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id
|
medium
|
6,610 |
train_station
|
[
"train",
"station",
"train_station"
] |
show the train name and station name for each train.
|
SELECT T2.name , T3.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id
|
medium
|
6,611 |
train_station
|
[
"train",
"station",
"train_station"
] |
Show all train names and times in stations in London in descending order by train time.
|
SELECT T3.name , T3.time FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T2.location = 'London' ORDER BY T3.time DESC
|
extra
|
6,612 |
train_station
|
[
"station",
"train_station"
] |
Show the station name with greatest number of trains.
|
SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id ORDER BY count(*) DESC LIMIT 1
|
extra
|
6,613 |
train_station
|
[
"station",
"train_station"
] |
Show the station name with at least two trains.
|
SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id HAVING count(*) >= 2
|
medium
|
6,614 |
train_station
|
[
"station"
] |
Show all locations with only 1 station.
|
SELECT LOCATION FROM station GROUP BY LOCATION HAVING count(*) = 1
|
easy
|
6,615 |
train_station
|
[
"station",
"train_station"
] |
Show station names without any trains.
|
SELECT name FROM station WHERE station_id NOT IN (SELECT station_id FROM train_station)
|
hard
|
6,616 |
train_station
|
[
"train",
"station",
"train_station"
] |
What are the names of the stations which serve both "Ananthapuri Express" and "Guruvayur Express" trains?
|
SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T3.Name = "Ananthapuri Express" INTERSECT SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T3.Name = "Guruvayur Express"
|
extra
|
6,617 |
train_station
|
[
"train",
"station",
"train_station"
] |
Find the names of the trains that do not pass any station located in London.
|
SELECT T2.name FROM train_station AS T1 JOIN train AS T2 ON T1.train_id = T2.train_id WHERE T1.station_id NOT IN (SELECT T4.station_id FROM train_station AS T3 JOIN station AS T4 ON T3.station_id = T4.station_id WHERE t4.location = "London")
|
extra
|
6,618 |
train_station
|
[
"station"
] |
List the names and locations of all stations ordered by their yearly entry exit and interchange amounts.
|
SELECT name , LOCATION FROM station ORDER BY Annual_entry_exit , Annual_interchanges
|
medium
|
6,619 |
driving_school
|
[
"vehicles"
] |
List all vehicle id
|
SELECT vehicle_id FROM Vehicles;
|
easy
|
6,620 |
driving_school
|
[
"vehicles"
] |
What are the ids of all vehicles?
|
SELECT vehicle_id FROM Vehicles;
|
easy
|
6,621 |
driving_school
|
[
"vehicles"
] |
How many vehicle in total?
|
SELECT count(*) FROM Vehicles;
|
easy
|
6,622 |
driving_school
|
[
"vehicles"
] |
How many vehicles exist?
|
SELECT count(*) FROM Vehicles;
|
easy
|
6,623 |
driving_school
|
[
"vehicles"
] |
Show the detail of vehicle with id 1.
|
SELECT vehicle_details FROM Vehicles WHERE vehicle_id = 1;
|
easy
|
6,624 |
driving_school
|
[
"vehicles"
] |
What are the details of the car with id 1?
|
SELECT vehicle_details FROM Vehicles WHERE vehicle_id = 1;
|
easy
|
6,625 |
driving_school
|
[
"staff"
] |
List the first name middle name and last name of all staff.
|
SELECT first_name , middle_name , last_name FROM Staff;
|
medium
|
6,626 |
driving_school
|
[
"staff"
] |
What are the first, middle, and last names of all staff?
|
SELECT first_name , middle_name , last_name FROM Staff;
|
medium
|
6,627 |
driving_school
|
[
"staff"
] |
What is the birthday of the staff member with first name as Janessa and last name as Sawayn?
|
SELECT date_of_birth FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
|
medium
|
6,628 |
driving_school
|
[
"staff"
] |
What is the date of birth for the staff member named Janessa Sawayn?
|
SELECT date_of_birth FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
|
medium
|
6,629 |
driving_school
|
[
"staff"
] |
When did the staff member with first name as Janessa and last name as Sawayn join the company?
|
SELECT date_joined_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
|
medium
|
6,630 |
driving_school
|
[
"staff"
] |
When did the staff member named Janessa Sawayn join the company?
|
SELECT date_joined_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
|
medium
|
6,631 |
driving_school
|
[
"staff"
] |
When did the staff member with first name as Janessa and last name as Sawayn leave the company?
|
SELECT date_left_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
|
medium
|
6,632 |
driving_school
|
[
"staff"
] |
When did the staff member Janessa Sawayn leave the company?
|
SELECT date_left_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
|
medium
|
6,633 |
driving_school
|
[
"staff"
] |
How many staff have the first name Ludie?
|
SELECT count(*) FROM Staff WHERE first_name = "Ludie";
|
easy
|
6,634 |
driving_school
|
[
"staff"
] |
How many employees have a first name of Ludie?
|
SELECT count(*) FROM Staff WHERE first_name = "Ludie";
|
easy
|
6,635 |
driving_school
|
[
"staff"
] |
What is the nickname of staff with first name as Janessa and last name as Sawayn?
|
SELECT nickname FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
|
medium
|
6,636 |
driving_school
|
[
"staff"
] |
What is the nickname of the employee named Janessa Sawayn?
|
SELECT nickname FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
|
medium
|
6,637 |
driving_school
|
[
"staff"
] |
How many staff in total?
|
SELECT count(*) FROM Staff;
|
easy
|
6,638 |
driving_school
|
[
"staff"
] |
How many employees are there?
|
SELECT count(*) FROM Staff;
|
easy
|
6,639 |
driving_school
|
[
"addresses",
"staff"
] |
Which city does staff with first name as Janessa and last name as Sawayn live?
|
SELECT T1.city FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";
|
medium
|
6,640 |
driving_school
|
[
"addresses",
"staff"
] |
In what city does Janessa Sawayn live?
|
SELECT T1.city FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";
|
medium
|
6,641 |
driving_school
|
[
"addresses",
"staff"
] |
Which country and state does staff with first name as Janessa and last name as Sawayn lived?
|
SELECT T1.country , T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";
|
extra
|
6,642 |
driving_school
|
[
"addresses",
"staff"
] |
In which country and state does Janessa Sawayn live?
|
SELECT T1.country , T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";
|
extra
|
6,643 |
driving_school
|
[
"lessons",
"customers"
] |
How long is the total lesson time took by customer with first name as Rylan and last name as Goodwin?
|
SELECT sum(T1.lesson_time) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin";
|
medium
|
6,644 |
driving_school
|
[
"lessons",
"customers"
] |
How long is the total lesson time took by the customer named Rylan Goodwin?
|
SELECT sum(T1.lesson_time) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin";
|
medium
|
6,645 |
driving_school
|
[
"addresses",
"staff"
] |
What is the zip code of staff with first name as Janessa and last name as Sawayn lived?
|
SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";
|
medium
|
6,646 |
driving_school
|
[
"addresses",
"staff"
] |
What is the zip code of the hosue of the employee named Janessa Sawayn?
|
SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";
|
medium
|
6,647 |
driving_school
|
[
"addresses"
] |
How many staff live in state Georgia?
|
SELECT count(*) FROM Addresses WHERE state_province_county = "Georgia";
|
easy
|
6,648 |
driving_school
|
[
"addresses"
] |
How many employees live in Georgia?
|
SELECT count(*) FROM Addresses WHERE state_province_county = "Georgia";
|
easy
|
6,649 |
driving_school
|
[
"addresses",
"staff"
] |
Find out the first name and last name of staff lived in city Damianfort.
|
SELECT T2.first_name , T2.last_name FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T1.city = "Damianfort";
|
medium
|
6,650 |
driving_school
|
[
"addresses",
"staff"
] |
What is the first and last name of all employees who live in the city Damianfort?
|
SELECT T2.first_name , T2.last_name FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T1.city = "Damianfort";
|
medium
|
6,651 |
driving_school
|
[
"addresses",
"staff"
] |
Which city lives most of staffs? List the city name and number of staffs.
|
SELECT T1.city , count(*) FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.city ORDER BY count(*) DESC LIMIT 1;
|
extra
|
6,652 |
driving_school
|
[
"addresses",
"staff"
] |
In which city do the most employees live and how many of them live there?
|
SELECT T1.city , count(*) FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.city ORDER BY count(*) DESC LIMIT 1;
|
extra
|
6,653 |
driving_school
|
[
"addresses",
"staff"
] |
List the states which have between 2 to 4 staffs living there.
|
SELECT T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.state_province_county HAVING count(*) BETWEEN 2 AND 4;
|
medium
|
6,654 |
driving_school
|
[
"addresses",
"staff"
] |
What are the names of the states that have 2 to 4 employees living there?
|
SELECT T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.state_province_county HAVING count(*) BETWEEN 2 AND 4;
|
medium
|
6,655 |
driving_school
|
[
"customers"
] |
List the first name and last name of all customers.
|
SELECT first_name , last_name FROM Customers;
|
medium
|
6,656 |
driving_school
|
[
"customers"
] |
What are the first and last names for all customers?
|
SELECT first_name , last_name FROM Customers;
|
medium
|
6,657 |
driving_school
|
[
"customers"
] |
List email address and birthday of customer whose first name as Carole.
|
SELECT email_address , date_of_birth FROM Customers WHERE first_name = "Carole"
|
medium
|
6,658 |
driving_school
|
[
"customers"
] |
What are the email addresses and date of births for all customers who have a first name of Carole?
|
SELECT email_address , date_of_birth FROM Customers WHERE first_name = "Carole"
|
medium
|
6,659 |
driving_school
|
[
"customers"
] |
List phone number and email address of customer with more than 2000 outstanding balance.
|
SELECT phone_number , email_address FROM Customers WHERE amount_outstanding > 2000;
|
medium
|
6,660 |
driving_school
|
[
"customers"
] |
What are the phone numbers and email addresses of all customers who have an outstanding balance of more than 2000?
|
SELECT phone_number , email_address FROM Customers WHERE amount_outstanding > 2000;
|
medium
|
6,661 |
driving_school
|
[
"customers"
] |
What is the status code, mobile phone number and email address of customer with last name as Kohler or first name as Marina?
|
SELECT customer_status_code , cell_mobile_phone_number , email_address FROM Customers WHERE first_name = "Marina" OR last_name = "Kohler"
|
extra
|
6,662 |
driving_school
|
[
"customers"
] |
What is the status code, phone number, and email address of the customer whose last name is Kohler or whose first name is Marina?
|
SELECT customer_status_code , cell_mobile_phone_number , email_address FROM Customers WHERE first_name = "Marina" OR last_name = "Kohler"
|
extra
|
6,663 |
driving_school
|
[
"customers"
] |
When are the birthdays of customer who are classified as 'Good Customer' status?
|
SELECT date_of_birth FROM Customers WHERE customer_status_code = 'Good Customer'
|
easy
|
6,664 |
driving_school
|
[
"customers"
] |
What is the date of birth of every customer whose status code is 'Good Customer'?
|
SELECT date_of_birth FROM Customers WHERE customer_status_code = 'Good Customer'
|
easy
|
6,665 |
driving_school
|
[
"customers"
] |
When did customer with first name as Carole and last name as Bernhard became a customer?
|
SELECT date_became_customer FROM Customers WHERE first_name = "Carole" AND last_name = "Bernhard";
|
medium
|
6,666 |
driving_school
|
[
"customers"
] |
When did Carole Bernhard first become a customer?
|
SELECT date_became_customer FROM Customers WHERE first_name = "Carole" AND last_name = "Bernhard";
|
medium
|
6,667 |
driving_school
|
[
"customers"
] |
How many customers in total?
|
SELECT count(*) FROM Customers;
|
easy
|
6,668 |
driving_school
|
[
"customers"
] |
How many customers are there?
|
SELECT count(*) FROM Customers;
|
easy
|
6,669 |
driving_school
|
[
"customers"
] |
List all customer status codes and the number of customers having each status code.
|
SELECT customer_status_code , count(*) FROM Customers GROUP BY customer_status_code;
|
medium
|
6,670 |
driving_school
|
[
"customers"
] |
For each customer status code, how many customers are classified that way?
|
SELECT customer_status_code , count(*) FROM Customers GROUP BY customer_status_code;
|
medium
|
6,671 |
driving_school
|
[
"customers"
] |
Which customer status code has least number of customers?
|
SELECT customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY count(*) ASC LIMIT 1;
|
hard
|
6,672 |
driving_school
|
[
"customers"
] |
What is the status code with the least number of customers?
|
SELECT customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY count(*) ASC LIMIT 1;
|
hard
|
6,673 |
driving_school
|
[
"lessons",
"customers"
] |
How many lessons taken by customer with first name as Rylan and last name as Goodwin were completed?
|
SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin" AND T1.lesson_status_code = "Completed";
|
medium
|
6,674 |
driving_school
|
[
"lessons",
"customers"
] |
How many lessons did the customer Ryan Goodwin complete?
|
SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin" AND T1.lesson_status_code = "Completed";
|
medium
|
6,675 |
driving_school
|
[
"customers"
] |
What is maximum, minimum and average amount of outstanding of customer?
|
SELECT max(amount_outstanding) , min(amount_outstanding) , avg(amount_outstanding) FROM Customers;
|
medium
|
6,676 |
driving_school
|
[
"customers"
] |
What is the maximum, minimum, and average amount of money outsanding for all customers?
|
SELECT max(amount_outstanding) , min(amount_outstanding) , avg(amount_outstanding) FROM Customers;
|
medium
|
6,677 |
driving_school
|
[
"customers"
] |
List the first name and last name of customers have the amount of outstanding between 1000 and 3000.
|
SELECT first_name , last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000;
|
medium
|
6,678 |
driving_school
|
[
"customers"
] |
What are the first and last names of all customers with between 1000 and 3000 dollars outstanding?
|
SELECT first_name , last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000;
|
medium
|
6,679 |
driving_school
|
[
"addresses",
"customers"
] |
List first name and last name of customers lived in city Lockmanfurt.
|
SELECT T1.first_name , T1.last_name FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T2.city = "Lockmanfurt";
|
medium
|
6,680 |
driving_school
|
[
"addresses",
"customers"
] |
What are the first and last names of all customers who lived in Lockmanfurt?
|
SELECT T1.first_name , T1.last_name FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T2.city = "Lockmanfurt";
|
medium
|
6,681 |
driving_school
|
[
"addresses",
"customers"
] |
Which country does customer with first name as Carole and last name as Bernhard lived in?
|
SELECT T2.country FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard"
|
medium
|
6,682 |
driving_school
|
[
"addresses",
"customers"
] |
What is the country in which the customer Carole Bernhard lived?
|
SELECT T2.country FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard"
|
medium
|
6,683 |
driving_school
|
[
"addresses",
"customers"
] |
What is zip code of customer with first name as Carole and last name as Bernhard?
|
SELECT T2.zip_postcode FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard"
|
medium
|
6,684 |
driving_school
|
[
"addresses",
"customers"
] |
What is the zip code of the customer Carole Bernhard?
|
SELECT T2.zip_postcode FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard"
|
medium
|
6,685 |
driving_school
|
[
"addresses",
"customers"
] |
Which city does has most number of customers?
|
SELECT T2.city FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY count(*) DESC LIMIT 1;
|
extra
|
6,686 |
driving_school
|
[
"addresses",
"customers"
] |
What is the city with the most customers?
|
SELECT T2.city FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY count(*) DESC LIMIT 1;
|
extra
|
6,687 |
driving_school
|
[
"customer_payments",
"customers"
] |
How much in total does customer with first name as Carole and last name as Bernhard paid?
|
SELECT sum(T1.amount_payment) FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Carole" AND T2.last_name = "Bernhard"
|
medium
|
6,688 |
driving_school
|
[
"customer_payments",
"customers"
] |
What is the total amount of moeny paid by the customer Carole Bernhard?
|
SELECT sum(T1.amount_payment) FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Carole" AND T2.last_name = "Bernhard"
|
medium
|
6,689 |
driving_school
|
[
"customer_payments",
"customers"
] |
List the number of customers that did not have any payment history.
|
SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_Payments );
|
extra
|
6,690 |
driving_school
|
[
"customer_payments",
"customers"
] |
How many customers have no payment histories?
|
SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_Payments );
|
extra
|
6,691 |
driving_school
|
[
"customer_payments",
"customers"
] |
List first name and last name of customers that have more than 2 payments.
|
SELECT T2.first_name , T2.last_name FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) > 2;
|
medium
|
6,692 |
driving_school
|
[
"customer_payments",
"customers"
] |
What are the first and last names of all customers with more than 2 payments?
|
SELECT T2.first_name , T2.last_name FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) > 2;
|
medium
|
6,693 |
driving_school
|
[
"customer_payments"
] |
List all payment methods and number of payments using each payment methods.
|
SELECT payment_method_code , count(*) FROM Customer_Payments GROUP BY payment_method_code;
|
medium
|
6,694 |
driving_school
|
[
"customer_payments"
] |
For each payment method, how many payments were made?
|
SELECT payment_method_code , count(*) FROM Customer_Payments GROUP BY payment_method_code;
|
medium
|
6,695 |
driving_school
|
[
"lessons"
] |
How many lessons were in cancelled state?
|
SELECT count(*) FROM Lessons WHERE lesson_status_code = "Cancelled";
|
easy
|
6,696 |
driving_school
|
[
"lessons"
] |
How many lessons have been cancelled?
|
SELECT count(*) FROM Lessons WHERE lesson_status_code = "Cancelled";
|
easy
|
6,697 |
driving_school
|
[
"staff",
"lessons"
] |
List lesson id of all lessons taught by staff with first name as Janessa, last name as Sawayn and nickname containing letter 's'.
|
SELECT T1.lesson_id FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" AND nickname LIKE "%s%";
|
hard
|
6,698 |
driving_school
|
[
"staff",
"lessons"
] |
What are the the lesson ids of all staff taught by Janessa Sawayn whose nickname has the letter s?
|
SELECT T1.lesson_id FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" AND nickname LIKE "%s%";
|
hard
|
6,699 |
driving_school
|
[
"staff",
"lessons"
] |
How many lessons taught by staff whose first name has letter 'a' in it?
|
SELECT count(*) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name LIKE "%a%"
|
hard
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.