database_id
stringlengths
4
31
query
stringlengths
22
577
question
stringlengths
19
224
formula_1
SELECT DISTINCT name FROM races WHERE YEAR BETWEEN 2014 AND 2017
Find the distinct names of all races held between 2014 and 2017?
formula_1
SELECT DISTINCT T1.forename , T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid WHERE T2.milliseconds < 93000
List the forename and surname of all distinct drivers who once had laptime less than 93000 milliseconds?
formula_1
SELECT DISTINCT T1.driverid , T1.nationality FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid WHERE T2.milliseconds > 100000
Find all the distinct id and nationality of drivers who have had laptime more than 100000 milliseconds?
formula_1
SELECT T1.forename , T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid ORDER BY T2.milliseconds LIMIT 1
What are the forename and surname of the driver who has the smallest laptime?
formula_1
SELECT T1.driverid , T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid ORDER BY T2.milliseconds DESC LIMIT 1
What is the id and family name of the driver who has the longest laptime?
formula_1
SELECT T1.driverid , T1.forename , T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid WHERE POSITION = '1' GROUP BY T1.driverid HAVING count(*) >= 2
What is the id, forename and surname of the driver who had the first position in terms of laptime at least twice?
formula_1
SELECT count(*) FROM results AS T1 JOIN races AS T2 ON T1.raceid = T2.raceid WHERE T2.name = "Australian Grand Prix" AND YEAR = 2009
How many drivers participated in the race Australian Grand Prix held in 2009?
formula_1
SELECT count(DISTINCT driverId) FROM results WHERE raceId NOT IN( SELECT raceId FROM races WHERE YEAR != 2009 )
How many drivers did not participate in the races held in 2009?
formula_1
SELECT T2.name , T2.year FROM results AS T1 JOIN races AS T2 ON T1.raceid = T2.raceid JOIN drivers AS T3 ON T1.driverid = T3.driverid WHERE T3.forename = "Lewis"
Give me a list of names and years of races that had any driver whose forename is Lewis?
formula_1
SELECT forename , surname FROM drivers WHERE nationality = "German"
Find the forename and surname of drivers whose nationality is German?
formula_1
SELECT T2.driverid , T3.forename FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid JOIN drivers AS T3 ON T2.driverid = T3.driverid WHERE T1.name = "Australian Grand Prix" INTERSECT SELECT T2.driverid , T3.forename FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid JOIN drivers AS T3 ON T2.drive...
Find the ids and forenames of drivers who participated both the races with name Australian Grand Prix and the races with name Chinese Grand Prix?
formula_1
SELECT T3.forename , T3.surname FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid JOIN drivers AS T3 ON T2.driverid = T3.driverid WHERE T1.name = "Australian Grand Prix" EXCEPT SELECT T3.forename , T3.surname FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid JOIN drivers AS T3 ON T2.driverid = T...
What are the forenames and surnames of drivers who participated in the races named Australian Grand Prix but not the races named Chinese Grand Prix?
formula_1
SELECT DISTINCT T1.forename FROM drivers AS T1 JOIN driverstandings AS T2 ON T1.driverid = T2.driverid WHERE T2.position = 1 AND T2.wins = 1
Find all the forenames of distinct drivers who was in position 1 as standing and won?
formula_1
SELECT DISTINCT T1.forename FROM drivers AS T1 JOIN driverstandings AS T2 ON T1.driverid = T2.driverid WHERE T2.position = 1 AND T2.wins = 1 AND T2.points > 20
Find all the forenames of distinct drivers who won in position 1 as driver standing and had more than 20 points?
formula_1
SELECT count(*) , nationality FROM constructors GROUP BY nationality
What are the numbers of constructors for different nationalities?
formula_1
SELECT count(*) , constructorid FROM constructorStandings GROUP BY constructorid
What are the numbers of races for each constructor id?
formula_1
SELECT T1.name FROM races AS T1 JOIN circuits AS T2 ON T1.circuitid = T2.circuitid WHERE T2.country = "Spain" AND T1.year > 2017
What are the names of races that were held after 2017 and the circuits were in the country of Spain?
formula_1
SELECT DISTINCT T1.name FROM races AS T1 JOIN circuits AS T2 ON T1.circuitid = T2.circuitid WHERE T2.country = "Spain" AND T1.year > 2000
What are the unique names of races that held after 2000 and the circuits were in Spain?
formula_1
SELECT DISTINCT driverid , STOP FROM pitstops WHERE duration < (SELECT max(duration) FROM pitstops WHERE raceid = 841)
Find the distinct driver id and the stop number of all drivers that have a shorter pit stop duration than some drivers in the race with id 841.
formula_1
SELECT DISTINCT driverid , STOP FROM pitstops WHERE duration > (SELECT min(duration) FROM pitstops WHERE raceid = 841)
Find the distinct driver id of all drivers that have a longer stop duration than some drivers in the race whose id is 841?
formula_1
SELECT DISTINCT forename FROM drivers ORDER BY forename ASC
List the forenames of all distinct drivers in alphabetical order?
formula_1
SELECT DISTINCT name FROM races ORDER BY name DESC
List the names of all distinct races in reversed lexicographic order?
formula_1
SELECT name FROM races WHERE YEAR BETWEEN 2009 AND 2011
What are the names of races held between 2009 and 2011?
formula_1
SELECT name FROM races WHERE TIME > "12:00:00" OR TIME < "09:00:00"
What are the names of races held after 12:00:00 or before 09:00:00?
formula_1
SELECT T1.forename , T1.surname , T1.driverid FROM drivers AS T1 JOIN pitstops AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING count(*) > 8 UNION SELECT T1.forename , T1.surname , T1.driverid FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING count(*)...
What are the drivers' first, last names and id who had more than 8 pit stops or participated in more than 5 races?
formula_1
SELECT T1.surname , T1.driverid FROM drivers AS T1 JOIN pitstops AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING count(*) = 11 INTERSECT SELECT T1.surname , T1.driverid FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING count(*) > 5
What are the drivers' last names and id who had 11 pit stops and participated in more than 5 race results?
formula_1
SELECT T1.driverid , T1.surname FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid WHERE T3.year > 2010 GROUP BY T1.driverid ORDER BY count(*) DESC LIMIT 1
What is the id and last name of the driver who participated in the most races after 2010?
formula_1
SELECT name FROM circuits WHERE country = "UK" OR country = "Malaysia"
What are the names of circuits that belong to UK or Malaysia?
formula_1
SELECT circuitid , LOCATION FROM circuits WHERE country = "France" OR country = "Belgium"
Find the id and location of circuits that belong to France or Belgium?
formula_1
SELECT T1.name FROM constructors AS T1 JOIN constructorstandings AS T2 ON T1.constructorid = T2.constructorid WHERE T1.nationality = "Japanese" AND T2.points > 5
Find the names of Japanese constructors that have once earned more than 5 points?
formula_1
SELECT avg(T2.fastestlapspeed) FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year = 2008 AND T1.name = "Monaco Grand Prix"
What is the average fastest lap speed in race named 'Monaco Grand Prix' in 2008 ?
formula_1
SELECT max(T2.fastestlapspeed) FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year = 2008 AND T1.name = "Monaco Grand Prix"
What is the maximum fastest lap speed in race named 'Monaco Grand Prix' in 2008 ?
formula_1
SELECT max(T2.fastestlapspeed) , T1.name , T1.year FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year > 2014 GROUP BY T1.name ORDER BY T1.year
What are the maximum fastest lap speed in races held after 2014 grouped by race name and ordered by year?
formula_1
SELECT avg(T2.fastestlapspeed) , T1.name , T1.year FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year > 2014 GROUP BY T1.name ORDER BY T1.year
What are the average fastest lap speed in races held after 2004 grouped by race name and ordered by year?
formula_1
SELECT T1.driverid , T1.forename , count(*) FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid GROUP BY T1.driverid HAVING count(*) >= 2
Find the id, forename and number of races of all drivers who have at least participated in two races?
formula_1
SELECT T1.driverid , count(*) FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid GROUP BY T1.driverid HAVING count(*) <= 30
Find the driver id and number of races of all drivers who have at most participated in 30 races?
phone_1
SELECT Model_name , RAM_MiB FROM chip_model ORDER BY RAM_MiB ASC LIMIT 1;
Which model has the least amount of RAM? List the model name and the amount of RAM.
phone_1
SELECT max(T1.RAM_MiB) , min(T1.RAM_MiB) FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T2.Company_name = "Nokia Corporation";
What is maximum and minimum RAM size of phone produced by company named "Nokia Corporation"?
phone_1
SELECT avg(T1.ROM_MiB) FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T2.Company_name = "Nokia Corporation";
What is the average ROM size of phones produced by the company named "Nokia Corporation"?
phone_1
SELECT T2.Hardware_Model_name , T2.Company_name FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T1.Launch_year = 2002 OR T1.RAM_MiB > 32;
List the hardware model name and company name for all the phones that were launched in year 2002 or have RAM size greater than 32.
phone_1
SELECT Hardware_Model_name , Company_name FROM phone WHERE Accreditation_type LIKE 'Full';
Find all phones that have word 'Full' in their accreditation types. List the Hardware Model name and Company name.
phone_1
SELECT T1.Char_cells , T1.Pixels , T1.Hardware_colours FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T2.Hardware_Model_name = "LG-P760";
Find the Char cells, Pixels and Hardware colours for the screen of the phone whose hardware model name is "LG-P760".
phone_1
SELECT T2.Hardware_Model_name , T2.Company_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.Type = "Graphics";
List the hardware model name and company name for the phone whose screen mode type is "Graphics"
phone_1
SELECT Company_name , count(*) FROM phone GROUP BY Company_name ORDER BY count(*) ASC LIMIT 1;
Find the name of the company that has the least number of phone models. List the company name and the number of phone model produced by that company.
phone_1
SELECT Company_name FROM phone GROUP BY Company_name HAVING count(*) > 1;
List the name of the company that produced more than one phone model.
phone_1
SELECT max(used_kb) , min(used_kb) , avg(used_kb) FROM screen_mode;
List the maximum, minimum and average number of used kb in screen mode.
phone_1
SELECT T2.Hardware_Model_name FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T1.Launch_year = 2002 ORDER BY T1.RAM_MiB DESC LIMIT 1;
List the name of the phone model launched in year 2002 and with the highest RAM size.
phone_1
SELECT T1.WiFi , T3.Type FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model JOIN screen_mode AS T3 ON T2.screen_mode = T3.Graphics_mode WHERE T2.Hardware_Model_name = "LG-P760";
What are the wifi and screen mode type of the hardware model named "LG-P760"?
phone_1
SELECT T2.Hardware_Model_name FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model JOIN screen_mode AS T3 ON T2.screen_mode = T3.Graphics_mode WHERE T3.Type = "Text" OR T1.RAM_MiB > 32;
List the hardware model name for the phones that have screen mode type "Text" or RAM size greater than 32.
phone_1
SELECT DISTINCT T2.Hardware_Model_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.Type = "Graphics" OR t2.Company_name = "Nokia Corporation"
List the hardware model name for the phones that were produced by "Nokia Corporation" or whose screen mode type is "Graphics."
phone_1
SELECT DISTINCT T2.Hardware_Model_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE t2.Company_name = "Nokia Corporation" AND T1.Type != "Text";
List the hardware model name for the phones that were produced by "Nokia Corporation" but whose screen mode type is not Text.
phone_1
SELECT DISTINCT T2.Hardware_Model_name , T2.Company_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.used_kb BETWEEN 10 AND 15;
List the phone hardware model and company name for the phones whose screen usage in kb is between 10 and 15.
phone_1
SELECT Accreditation_level FROM phone GROUP BY Accreditation_level HAVING count(*) > 3
Find the accreditation level that more than 3 phones use.
phone_1
SELECT avg(RAM_MiB) FROM chip_model WHERE model_name NOT IN (SELECT chip_model FROM phone)
Find the average ram mib size of the chip models that are never used by any phone.
phone_1
SELECT model_name FROM chip_model EXCEPT SELECT chip_model FROM phone WHERE Accreditation_type = 'Full'
Find the names of the chip models that are not used by any phone with full accreditation type.
driving_school
SELECT date_of_birth FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
What is the birthday of the staff member with first name as Janessa and last name as Sawayn?
driving_school
SELECT date_joined_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
When did the staff member with first name as Janessa and last name as Sawayn join the company?
driving_school
SELECT date_left_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
When did the staff member with first name as Janessa and last name as Sawayn leave the company?
driving_school
SELECT nickname FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
What is the nickname of staff with first name as Janessa and last name as Sawayn?
driving_school
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";
Which city does staff with first name as Janessa and last name as Sawayn live?
driving_school
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";
In which country and state does staff with first name as Janessa and last name as Sawayn live?
driving_school
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";
How long is the total lesson time took by customer with first name as Rylan and last name as Goodwin?
driving_school
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";
What is the zip code of staff with first name as Janessa and last name as Sawayn?
driving_school
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";
Find out the first name and last name of staff living in city Damianfort.
driving_school
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;
In which city live the most staff? List the city name and number of staff.
driving_school
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;
List the states which have between 2 to 4 staff living there.
driving_school
SELECT customer_status_code , cell_mobile_phone_number , email_address FROM Customers WHERE first_name = "Marina" OR last_name = "Kohler"
What is the status code, mobile phone number and email address of the customer with last name as Kohler or first name as Marina?
driving_school
SELECT date_became_customer FROM Customers WHERE first_name = "Carole" AND last_name = "Bernhard";
When did customer with first name as Carole and last name as Bernhard became a customer?
driving_school
SELECT customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY count(*) ASC LIMIT 1;
Which customer status code has least number of customers?
driving_school
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";
How many lessons taken by customer with first name as Rylan and last name as Goodwin were completed?
driving_school
SELECT max(amount_outstanding) , min(amount_outstanding) , avg(amount_outstanding) FROM Customers;
What is maximum, minimum and average amount of outstanding of customer?
driving_school
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";
List first name and last name of customers living in city Lockmanfurt.
driving_school
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"
Which country does customer with first name as Carole and last name as Bernhard live in?
driving_school
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"
What is zip code of customer with first name as Carole and last name as Bernhard?
driving_school
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;
Which city has most number of customers?
driving_school
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"
How much in total has customer with first name as Carole and last name as Bernhard paid?
driving_school
SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_Payments );
List the number of customers that did not have any payment history.
driving_school
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;
List first name and last name of customers that have more than 2 payments.
driving_school
SELECT T1.lesson_id FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" AND nickname LIKE "%s%";
List lesson id of all lessons taught by staff with first name as Janessa, last name as Sawayn and nickname containing letter 's'.
driving_school
SELECT count(*) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name LIKE "%a%"
How many lessons taught by staff whose first name has letter 'a' in it?
driving_school
SELECT sum(lesson_time) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";
How long is the total lesson time taught by staff with first name as Janessa and last name as Sawayn?
driving_school
SELECT avg(price) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";
What is average lesson price taught by staff with first name as Janessa and last name as Sawayn?
driving_school
SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Ray"
How many lessons did customer with first name Ray take?
driving_school
SELECT last_name FROM Customers INTERSECT SELECT last_name FROM Staff
Which last names are both used by customers and by staff?
driving_school
SELECT first_name FROM Staff EXCEPT SELECT T2.first_name FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id
What are the first names of staff who did not give any lesson?
driving_school
SELECT T1.vehicle_id , T1.vehicle_details FROM Vehicles AS T1 JOIN Lessons AS T2 ON T1.vehicle_id = T2.vehicle_id GROUP BY T1.vehicle_id ORDER BY count(*) DESC LIMIT 1
What is the id and detail of the vehicle used in lessons for most of the times?
driving_school
SELECT date_of_birth FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
What is the birthday of the staff member with first name as Janessa and last name as Sawayn?
driving_school
SELECT date_joined_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
When did the staff member with first name as Janessa and last name as Sawayn join the company?
driving_school
SELECT date_left_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
When did the staff member with first name as Janessa and last name as Sawayn leave the company?
driving_school
SELECT nickname FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
What is the nickname of staff with first name as Janessa and last name as Sawayn?
driving_school
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";
Which city does staff with first name as Janessa and last name as Sawayn live?
driving_school
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";
In which country and state does staff with first name as Janessa and last name as Sawayn live?
driving_school
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";
How long is the total lesson time took by customer with first name as Rylan and last name as Goodwin?
driving_school
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";
What is the zip code of staff with first name as Janessa and last name as Sawayn?
driving_school
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";
Find out the first name and last name of staff living in city Damianfort.
driving_school
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;
In which city live the most staff? List the city name and number of staff.
driving_school
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;
List the states which have between 2 to 4 staff living there.
driving_school
SELECT customer_status_code , cell_mobile_phone_number , email_address FROM Customers WHERE first_name = "Marina" OR last_name = "Kohler"
What is the status code, mobile phone number and email address of the customer with last name as Kohler or first name as Marina?
driving_school
SELECT date_became_customer FROM Customers WHERE first_name = "Carole" AND last_name = "Bernhard";
When did customer with first name as Carole and last name as Bernhard became a customer?
driving_school
SELECT customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY count(*) ASC LIMIT 1;
Which customer status code has least number of customers?