db_name
stringclasses 146
values | prompt
stringlengths 310
4.81k
|
|---|---|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# Show the name, location, and number of platforms for all stations.
#
### SQL:
#
# SELECT name , LOCATION , number_of_platforms FROM station
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# What are all locations of train stations?
#
### SQL:
#
# SELECT DISTINCT LOCATION FROM station
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# Show the names and total passengers for all train stations not in London.
#
### SQL:
#
# SELECT name , total_passengers FROM station WHERE LOCATION != 'London'
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# Show the names and main services for train stations that have the top three total number of passengers.
#
### SQL:
#
# SELECT name , main_services FROM station ORDER BY total_passengers DESC LIMIT 3
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# What is the average and maximum number of total passengers for train stations in London or Glasgow?
#
### SQL:
#
# SELECT avg(total_passengers) , max(total_passengers) FROM station WHERE LOCATION = 'London' OR LOCATION = 'Glasgow'
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# Show all locations and the total number of platforms and passengers for all train stations in each location.
#
### SQL:
#
# SELECT LOCATION , sum(number_of_platforms) , sum(total_passengers) FROM station GROUP BY LOCATION
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# Show all locations that have train stations with at least 15 platforms and train stations with more than 25 total passengers.
#
### SQL:
#
# SELECT DISTINCT LOCATION FROM station WHERE number_of_platforms >= 15 AND total_passengers > 25
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# Show all locations which don't have a train station with at least 15 platforms.
#
### SQL:
#
# SELECT LOCATION FROM station EXCEPT SELECT LOCATION FROM station WHERE number_of_platforms >= 15
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# Show the location with most number of train stations.
#
### SQL:
#
# SELECT LOCATION FROM station GROUP BY LOCATION ORDER BY count(*) DESC LIMIT 1
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# Show the name, time, and service for all trains.
#
### SQL:
#
# SELECT name , TIME , service FROM train
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# Show the number of trains
#
### SQL:
#
# SELECT count(*) FROM train
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# Show the name and service for all trains in order by time.
#
### SQL:
#
# SELECT name , service FROM train ORDER BY TIME
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# Show the station name and number of trains in each station.
#
### SQL:
#
# 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
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# show the train name and station name for each train.
#
### SQL:
#
# 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
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# Show all train names and times in stations in London in descending order by train time.
#
### SQL:
#
# 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
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# Show the station name with greatest number of trains.
#
### SQL:
#
# 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
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# Show the station name with at least two trains.
#
### SQL:
#
# 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
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# Show all locations with only 1 station.
#
### SQL:
#
# SELECT LOCATION FROM station GROUP BY LOCATION HAVING count(*) = 1
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# Show station names without any trains.
#
### SQL:
#
# SELECT name FROM station WHERE station_id NOT IN (SELECT station_id FROM train_station)
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# What are the names of the stations which serve both "Ananthapuri Express" and "Guruvayur Express" trains?
#
### SQL:
#
# 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"
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# Find the names of the trains that do not pass any station located in London.
#
### SQL:
#
# 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")
#
### End.
|
train_station
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# station ( Station_ID, Name, Annual_entry_exit, Annual_interchanges, Total_Passengers, Location, Main_Services, Number_of_Platforms )
# train ( Train_ID, Name, Time, Service )
# train_station ( Train_ID, Station_ID )
#
# train_station.Station_ID can be joined with station.Station_ID
# train_station.Train_ID can be joined with train.Train_ID
#
### Question:
#
# List the names and locations of all stations ordered by their yearly entry exit and interchange amounts.
#
### SQL:
#
# SELECT name , LOCATION FROM station ORDER BY Annual_entry_exit , Annual_interchanges
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# List all vehicle id
#
### SQL:
#
# SELECT vehicle_id FROM Vehicles;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What are the ids of all vehicles?
#
### SQL:
#
# SELECT vehicle_id FROM Vehicles;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# How many vehicle in total?
#
### SQL:
#
# SELECT count(*) FROM Vehicles;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# How many vehicles exist?
#
### SQL:
#
# SELECT count(*) FROM Vehicles;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# Show the detail of vehicle with id 1.
#
### SQL:
#
# SELECT vehicle_details FROM Vehicles WHERE vehicle_id = 1;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What are the details of the car with id 1?
#
### SQL:
#
# SELECT vehicle_details FROM Vehicles WHERE vehicle_id = 1;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# List the first name middle name and last name of all staff.
#
### SQL:
#
# SELECT first_name , middle_name , last_name FROM Staff;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What are the first, middle, and last names of all staff?
#
### SQL:
#
# SELECT first_name , middle_name , last_name FROM Staff;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What is the birthday of the staff member with first name as Janessa and last name as Sawayn?
#
### SQL:
#
# SELECT date_of_birth FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What is the date of birth for the staff member named Janessa Sawayn?
#
### SQL:
#
# SELECT date_of_birth FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# When did the staff member with first name as Janessa and last name as Sawayn join the company?
#
### SQL:
#
# SELECT date_joined_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# When did the staff member named Janessa Sawayn join the company?
#
### SQL:
#
# SELECT date_joined_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# When did the staff member with first name as Janessa and last name as Sawayn leave the company?
#
### SQL:
#
# SELECT date_left_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# When did the staff member Janessa Sawayn leave the company?
#
### SQL:
#
# SELECT date_left_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# How many staff have the first name Ludie?
#
### SQL:
#
# SELECT count(*) FROM Staff WHERE first_name = "Ludie";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# How many employees have a first name of Ludie?
#
### SQL:
#
# SELECT count(*) FROM Staff WHERE first_name = "Ludie";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What is the nickname of staff with first name as Janessa and last name as Sawayn?
#
### SQL:
#
# SELECT nickname FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What is the nickname of the employee named Janessa Sawayn?
#
### SQL:
#
# SELECT nickname FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# How many staff in total?
#
### SQL:
#
# SELECT count(*) FROM Staff;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# How many employees are there?
#
### SQL:
#
# SELECT count(*) FROM Staff;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# Which city does staff with first name as Janessa and last name as Sawayn live?
#
### SQL:
#
# 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";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# In what city does Janessa Sawayn live?
#
### SQL:
#
# 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";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# Which country and state does staff with first name as Janessa and last name as Sawayn lived?
#
### SQL:
#
# 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";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# In which country and state does Janessa Sawayn live?
#
### SQL:
#
# 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";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# How long is the total lesson time took by customer with first name as Rylan and last name as Goodwin?
#
### SQL:
#
# 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";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# How long is the total lesson time took by the customer named Rylan Goodwin?
#
### SQL:
#
# 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";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What is the zip code of staff with first name as Janessa and last name as Sawayn lived?
#
### SQL:
#
# 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";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What is the zip code of the hosue of the employee named Janessa Sawayn?
#
### SQL:
#
# 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";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# How many staff live in state Georgia?
#
### SQL:
#
# SELECT count(*) FROM Addresses WHERE state_province_county = "Georgia";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# How many employees live in Georgia?
#
### SQL:
#
# SELECT count(*) FROM Addresses WHERE state_province_county = "Georgia";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# Find out the first name and last name of staff lived in city Damianfort.
#
### SQL:
#
# 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";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What is the first and last name of all employees who live in the city Damianfort?
#
### SQL:
#
# 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";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# Which city lives most of staffs? List the city name and number of staffs.
#
### SQL:
#
# 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;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# In which city do the most employees live and how many of them live there?
#
### SQL:
#
# 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;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# List the states which have between 2 to 4 staffs living there.
#
### SQL:
#
# 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;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What are the names of the states that have 2 to 4 employees living there?
#
### SQL:
#
# 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;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# List the first name and last name of all customers.
#
### SQL:
#
# SELECT first_name , last_name FROM Customers;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What are the first and last names for all customers?
#
### SQL:
#
# SELECT first_name , last_name FROM Customers;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# List email address and birthday of customer whose first name as Carole.
#
### SQL:
#
# SELECT email_address , date_of_birth FROM Customers WHERE first_name = "Carole"
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What are the email addresses and date of births for all customers who have a first name of Carole?
#
### SQL:
#
# SELECT email_address , date_of_birth FROM Customers WHERE first_name = "Carole"
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# List phone number and email address of customer with more than 2000 outstanding balance.
#
### SQL:
#
# SELECT phone_number , email_address FROM Customers WHERE amount_outstanding > 2000;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What are the phone numbers and email addresses of all customers who have an outstanding balance of more than 2000?
#
### SQL:
#
# SELECT phone_number , email_address FROM Customers WHERE amount_outstanding > 2000;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What is the status code, mobile phone number and email address of customer with last name as Kohler or first name as Marina?
#
### SQL:
#
# SELECT customer_status_code , cell_mobile_phone_number , email_address FROM Customers WHERE first_name = "Marina" OR last_name = "Kohler"
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What is the status code, phone number, and email address of the customer whose last name is Kohler or whose first name is Marina?
#
### SQL:
#
# SELECT customer_status_code , cell_mobile_phone_number , email_address FROM Customers WHERE first_name = "Marina" OR last_name = "Kohler"
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# When are the birthdays of customer who are classified as 'Good Customer' status?
#
### SQL:
#
# SELECT date_of_birth FROM Customers WHERE customer_status_code = 'Good Customer'
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What is the date of birth of every customer whose status code is 'Good Customer'?
#
### SQL:
#
# SELECT date_of_birth FROM Customers WHERE customer_status_code = 'Good Customer'
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# When did customer with first name as Carole and last name as Bernhard became a customer?
#
### SQL:
#
# SELECT date_became_customer FROM Customers WHERE first_name = "Carole" AND last_name = "Bernhard";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# When did Carole Bernhard first become a customer?
#
### SQL:
#
# SELECT date_became_customer FROM Customers WHERE first_name = "Carole" AND last_name = "Bernhard";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# How many customers in total?
#
### SQL:
#
# SELECT count(*) FROM Customers;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# How many customers are there?
#
### SQL:
#
# SELECT count(*) FROM Customers;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# List all customer status codes and the number of customers having each status code.
#
### SQL:
#
# SELECT customer_status_code , count(*) FROM Customers GROUP BY customer_status_code;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# For each customer status code, how many customers are classified that way?
#
### SQL:
#
# SELECT customer_status_code , count(*) FROM Customers GROUP BY customer_status_code;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# Which customer status code has least number of customers?
#
### SQL:
#
# SELECT customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY count(*) ASC LIMIT 1;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What is the status code with the least number of customers?
#
### SQL:
#
# SELECT customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY count(*) ASC LIMIT 1;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# How many lessons taken by customer with first name as Rylan and last name as Goodwin were completed?
#
### SQL:
#
# 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";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# How many lessons did the customer Ryan Goodwin complete?
#
### SQL:
#
# 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";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What is maximum, minimum and average amount of outstanding of customer?
#
### SQL:
#
# SELECT max(amount_outstanding) , min(amount_outstanding) , avg(amount_outstanding) FROM Customers;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What is the maximum, minimum, and average amount of money outsanding for all customers?
#
### SQL:
#
# SELECT max(amount_outstanding) , min(amount_outstanding) , avg(amount_outstanding) FROM Customers;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# List the first name and last name of customers have the amount of outstanding between 1000 and 3000.
#
### SQL:
#
# SELECT first_name , last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What are the first and last names of all customers with between 1000 and 3000 dollars outstanding?
#
### SQL:
#
# SELECT first_name , last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# List first name and last name of customers lived in city Lockmanfurt.
#
### SQL:
#
# 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";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What are the first and last names of all customers who lived in Lockmanfurt?
#
### SQL:
#
# 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";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# Which country does customer with first name as Carole and last name as Bernhard lived in?
#
### SQL:
#
# 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"
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What is the country in which the customer Carole Bernhard lived?
#
### SQL:
#
# 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"
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What is zip code of customer with first name as Carole and last name as Bernhard?
#
### SQL:
#
# 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"
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What is the zip code of the customer Carole Bernhard?
#
### SQL:
#
# 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"
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# Which city does has most number of customers?
#
### SQL:
#
# 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;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What is the city with the most customers?
#
### SQL:
#
# 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;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# How much in total does customer with first name as Carole and last name as Bernhard paid?
#
### SQL:
#
# 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"
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What is the total amount of moeny paid by the customer Carole Bernhard?
#
### SQL:
#
# 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"
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# List the number of customers that did not have any payment history.
#
### SQL:
#
# SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_Payments );
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# How many customers have no payment histories?
#
### SQL:
#
# SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_Payments );
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# List first name and last name of customers that have more than 2 payments.
#
### SQL:
#
# 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;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# What are the first and last names of all customers with more than 2 payments?
#
### SQL:
#
# 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;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# List all payment methods and number of payments using each payment methods.
#
### SQL:
#
# SELECT payment_method_code , count(*) FROM Customer_Payments GROUP BY payment_method_code;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# For each payment method, how many payments were made?
#
### SQL:
#
# SELECT payment_method_code , count(*) FROM Customer_Payments GROUP BY payment_method_code;
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# How many lessons were in cancelled state?
#
### SQL:
#
# SELECT count(*) FROM Lessons WHERE lesson_status_code = "Cancelled";
#
### End.
|
driving_school
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Addresses ( address_id, line_1_number_building, city, zip_postcode, state_province_county, country )
# Staff ( staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff )
# Vehicles ( vehicle_id, vehicle_details )
# Customers ( customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number )
# Customer_Payments ( customer_id, datetime_payment, payment_method_code, amount_payment )
# Lessons ( lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price )
#
# Staff.staff_address_id can be joined with Addresses.address_id
# Customers.customer_address_id can be joined with Addresses.address_id
# Customer_Payments.customer_id can be joined with Customers.customer_id
# Lessons.customer_id can be joined with Customers.customer_id
# Lessons.staff_id can be joined with Staff.staff_id
# Lessons.vehicle_id can be joined with Vehicles.vehicle_id
#
### Question:
#
# How many lessons have been cancelled?
#
### SQL:
#
# SELECT count(*) FROM Lessons WHERE lesson_status_code = "Cancelled";
#
### End.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.