Question: Can you give me a list of aircraft IDs less than 5, excluding any aircraft IDs less than 3 that are also found in the airport aircraft list?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID < 5 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID < 3


Question: What is the highest branch ID from purchases where the total pounds are less than 321.13, and also the highest branch ID from purchases where the total pounds are not equal to 988.09?

SELECT MAX(Branch_ID) FROM purchase WHERE "Total_pounds" < 321.13 UNION SELECT MAX(Branch_ID) FROM purchase WHERE "Total_pounds" != 988.09


Question: Can you give me a list of driver IDs, including those from the driver table excluding driver ID 3, and those from the school bus table with driver IDs up to and including 7?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 3 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 7


Question: Which driver IDs are equal to 3 in the driver table, but not greater than 3 in the school_bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 3 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 3


Question: Which driver IDs are both not equal to 3 and also less than or equal to 10?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 3 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 10


Question: How many lessons have either a price greater than 167 or a vehicle ID greater than 2, excluding the number of vehicles that are not trucks?

SELECT COUNT(vehicle_id) FROM Lessons WHERE "price" > 167.0 OR "vehicle_id" > 2 EXCEPT SELECT COUNT(vehicle_id) FROM Vehicles WHERE vehicle_details <> "Truck"


Question: Can you give me the age, city, and employee ID of employees who are both under 32 and named Andrew Sheridan, and also not named Steve Borthwick?

SELECT Age, City, Employee_ID FROM employee WHERE "Age" < 32 AND Name = "Andrew Sheridan" INTERSECT SELECT Age, City, Employee_ID FROM employee WHERE Name <> "Steve Borthwick"


Question: Can you give me a list of driver IDs, excluding driver ID 9, that are not also driver IDs in the school bus table, excluding driver ID 4?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 9 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 4


Question: Which driver IDs, excluding 9, are also driver IDs that are greater than or equal to 3 in the school bus list?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 9 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 3


Question: Can you give me a list of driver IDs, including those from the driver table that are greater than 6, and those from the school bus table that are not equal to 9?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 6 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 9


Question: Can you give me a list of employee IDs from the certificate table where the employee ID is less than 269734834, combined with a list of employee IDs from the employee table where the employee's name is not Joseph Thompson and their salary is not 48090?

SELECT eid FROM certificate WHERE "eid" < 269734834 UNION SELECT eid FROM employee WHERE name <> "Joseph Thompson" AND "salary" <> 48090


Question: Can you give me a list of driver IDs from the driver table that are greater than or equal to 4, excluding any driver IDs from the school_bus table that are greater than or equal to 9?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 4 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 9


Question: Can you list all environmental allergies and allergies that are not tree pollen, along with all allergies that are not grass pollen?

SELECT Allergy FROM Allergy_Type WHERE AllergyType = "environmental" OR Allergy <> "Tree Pollen" UNION ALL SELECT Allergy FROM Has_Allergy WHERE Allergy <> "Grass Pollen"


Question: Can you give me a list of driver IDs, combining those from the driver table excluding driver ID 8, with those from the school bus table that are less than or equal to 4?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 8 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 4


Question: Can you give me a list of driver IDs that are 12 or greater, excluding those driver IDs that are less than 10 and are also in the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 12 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 10


Question: Can you give me the customer address ID, mobile number, email, amount outstanding, phone number, the sum of customer IDs, and the count of dates they became customers for all customers, combining two sets of results: first, those who are "Good Customers" and either not named Carole, or have an amount outstanding less than or equal to $1000 and an email of "huel.jana@example.org", or have a customer address ID less than 2; and second, those who are not named Jordy or whose birthdate is not March 8th, 1993 at 8:48:42 AM?

SELECT customer_address_id, cell_mobile_phone_number, email_address, amount_outstanding, phone_number, SUM(customer_id), COUNT(date_became_customer) FROM Customers WHERE customer_status_code = "Good Customer" AND first_name != "Carole" OR "amount_outstanding" <= 1000.0 AND email_address = "huel.jana@example.org" OR "customer_address_id" < 2 UNION ALL SELECT customer_address_id, cell_mobile_phone_number, email_address, amount_outstanding, phone_number, SUM(customer_id), COUNT(date_became_customer) FROM Customers WHERE first_name <> "Jordy" OR date_of_birth <> "1993-03-08 08:48:42"


Question: Can you give me a list of user IDs from the review table, excluding user ID 2, combined with a list of user IDs from the user accounts table where the user ID is less than or equal to 1 or the name is not Helen?

SELECT u_id FROM review WHERE "u_id" <> 2 UNION SELECT u_id FROM useracct WHERE "u_id" <= 1 OR name <> "Helen"


Question: Can you give me the driver IDs that are both in the driver list with IDs up to 10 and in the school bus list with IDs up to 3?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 10 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 3


Question: Can you give me a list of driver IDs that are both greater than 4 and also not equal to 9, considering only the driver IDs present in both the driver and school bus tables?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 4 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 9


Question: Can you give me a list of driver IDs, including those from the driver table that are 10 or greater, and those from the school bus table that are less than 9?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 10 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 9


Question: For each club position, can you tell me the club ID for clubs where student ID 1007 is a member?

SELECT T1.ClubID, T2.ClubID FROM Club as T1 JOIN Member_of_club as T2 ON T1.ClubID == T2.ClubID GROUP BY Position HAVING StuID = 1007


Question: Could you give me a list of driver IDs that are not 10 and are also less than 9, considering drivers and school buses separately?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 10 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 9


Question: Which aircraft IDs are both greater than or equal to 3 (when considering all aircraft) and not equal to 2 (when considering aircraft at airports)?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID >= 3 INTERSECT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID != 2


Question: Can you give me a list of aircraft IDs that are greater than 4, excluding those aircraft IDs greater than 5 that are also found in the airport aircraft list?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID > 4 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID > 5


Question: Can you give me a list of driver IDs from the driver table that are less than 4, combined with a list of driver IDs from the school_bus table that are not equal to 4?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 4 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 4


Question: Could you list the branch IDs from the branch table where the ID is 8 and the membership amount isn't 7, or where the road isn't Cecilia Avenue, the name isn't Taverner, and the opening year isn't 2012, combined with a list of branch IDs from the purchase table where the branch ID isn't 5, or the total pounds are greater than 988.09 and the member ID is greater than 2, or the year isn't 2017?

SELECT Branch_ID FROM branch WHERE "Branch_ID" = 8 AND membership_amount != "7" OR Address_road != "Cecilia Avenue" AND Name != "Taverner" AND Open_year != "2012" UNION ALL SELECT Branch_ID FROM purchase WHERE Branch_ID <> "5" OR "Total_pounds" > 988.09 AND "Member_ID" > 2 OR Year != "2017"


Question: Can you give me a list of driver IDs that are not 7, and also exclude any driver IDs that are less than 9 from the school bus list?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 7 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 9


Question: Can you give me a list of driver IDs less than 10, combining the IDs from both the driver and school bus lists, removing any duplicates?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 10 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 10


Question: Which aircraft IDs, excluding aircraft ID 4, are also aircraft IDs less than or equal to 2 in the airport aircraft list?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <> 4 INTERSECT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <= 2


Question: What are the shipping agent codes and their counts, excluding US codes, minus the shipping agent codes and their counts where the description is "k"?

SELECT shipping_agent_code, COUNT(shipping_agent_name) FROM Ref_Shipping_Agents WHERE shipping_agent_code != "US" EXCEPT SELECT shipping_agent_code, COUNT(shipping_agent_name) FROM Ref_Shipping_Agents WHERE shipping_agent_description = "k"


Question: Can you give me a list of driver IDs, including those from the driver table that are greater than 10 and those from the school bus table that are not equal to 9?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 10 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 9


Question: Can you give me a list of driver IDs, excluding driver ID 2, that are not also driver IDs, excluding driver ID 4, found in the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 2 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 4


Question: Can you give me a list of driver IDs that are not 4 and are also less than 9, considering only the driver IDs that appear in both the driver and school_bus tables?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 4 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 9


Question: Can you give me a list of driver IDs, excluding driver ID 11, that are not also driver IDs greater than 7 in the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 11 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 7


Question: Which driver IDs are both greater than or equal to 10 in the driver table and greater than 4 in the school_bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 10 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 4


Question: What is the smallest aid number from the certificate table where the aid is greater than 3, excluding the smallest aid number from the flight table where the flight number is greater than 33, the distance is not 7487, the origin is Los Angeles, the arrival date is not 04/12/2005 09:40, or the price is greater than or equal to 202.45?

SELECT MIN(aid) FROM certificate WHERE "aid" > 3 EXCEPT SELECT MIN(aid) FROM flight WHERE "flno" > 33 OR "distance" <> 7487 OR origin = "Los Angeles" OR arrival_date != "04/12/2005 09:40" OR "price" >= 202.45


Question: Can you give me a list of driver IDs, including driver ID 6 from the driver table and any driver IDs greater than 10 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 6 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 10


Question: Can you give me a list of driver IDs, including those from the driver table that are less than or equal to 1, and those from the school_bus table that are greater than 7?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 1 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 7


Question: Can you give me a list of driver IDs that are 12 or less from the driver table, excluding those driver IDs that are greater than 4 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 12 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 4


Question: Can you give me the member IDs that are both from years other than 2016 and also either have a member ID less than 1 from 2016 or are not from branch 5?

SELECT Member_ID FROM membership_register_branch WHERE Register_Year != "2016" INTERSECT SELECT Member_ID FROM membership_register_branch WHERE "Member_ID" < 1 AND Register_Year = "2016" OR Branch_ID != "5"


Question: Can you give me a list of school IDs, including those from schools that are either not in Elkhart County or are in football class A and named "Knox Community", along with school IDs from the budget table where either the year is not 2004 and the invested amount is not 146102, or the budgeted amount is less than 113531, or the total budget percent budgeted is not 2.0, or the budget invested percent is 146.9, or the school ID is less than or equal to 5 and the total budget percent invested is 2.7?

SELECT School_id FROM School WHERE County != "20 Elkhart" OR IHSAA_Football_Class != "A" AND School_name = "Knox Community" UNION ALL SELECT School_id FROM budget WHERE "Year" <> 2004 AND "Invested" != 146102 OR "Budgeted" < 113531 OR "total_budget_percent_budgeted" != 2.0 OR Budget_invested_percent = "146.9" OR "School_id" <= 5 AND "total_budget_percent_invested" = 2.7


Question: Can you give me the Aircraft ID from the aircraft table, where the Aircraft ID is 1, excluding any Aircraft IDs from the airport_aircraft table that are less than 1?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID = 1 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID < 1


Question: How many people from Bulgaria, or with specific final table, best finish, money rank, or birth date information, are linked to poker players, specifically those with a Poker_Player_ID of 1 and a height under 196, and what are the Poker_Player_IDs, grouped by best finish, where the earnings are exactly 104871, or the height is less than 196 and best finish is less than 3, or the nationality isn't Russia and the birth date isn't April 17, 1987 and the name isn't Maksim Botin, or the final table made isn't 42 and the Poker_Player_ID is greater than or equal to 1?

SELECT COUNT(T1.People_ID), T2.Poker_Player_ID FROM people as T1 JOIN poker_player as T2 ON T1.People_ID = T2.People_ID WHERE Nationality = "Bulgaria" OR "Final_Table_Made" <> 26.0 OR "Best_Finish" = 1.0 OR "Money_Rank" <> 68.0 OR Birth_Date <> "April 17, 1987" AND "Poker_Player_ID" = 1 AND "Height" < 196.0 GROUP BY Best_Finish HAVING Earnings = 104871.0 OR Height < 196.0 AND Best_Finish < 3.0 OR Nationality <> "Russia" AND Birth_Date <> "April 17, 1987" AND Name <> "Maksim Botin" OR Final_Table_Made <> 42.0 AND Poker_Player_ID >= 1


Question: Can you give me a list of customer IDs for those who either made a payment greater than 4032.33 or paid with a credit card on March 20, 2018, at 9:38 PM, combined with a list of customer IDs for those who were born on May 7, 1994, at 1:32 AM and don't have the mobile number 848-099-2095x785 and aren't classified as a "Bad Customer", or became a customer on November 30, 2016, at 10:37 AM?

SELECT customer_id FROM Customer_Payments WHERE "amount_payment" > 4032.33 OR datetime_payment = "2018-03-20 21:38:41" AND payment_method_code = "Credit Card" UNION ALL SELECT customer_id FROM Customers WHERE date_of_birth = "1994-05-07 01:32:16" AND cell_mobile_phone_number <> "848-099-2095x785" AND customer_status_code <> "Bad Customer" OR date_became_customer = "2016-11-30 10:37:41"


Question: Can you list the makers and models from the model list where the maker is 19, the model ID is not 14, or the model is not a Buick, combined with the makers and models where the model is not a Volvo, the model ID is greater than 35, and the maker is less than 14?

SELECT Maker, Model FROM model_list WHERE "Maker" = 19 OR "ModelId" <> 14 OR Model != "buick" UNION SELECT Maker, Model FROM model_list WHERE Model != "volvo" AND "ModelId" > 35 AND "Maker" < 14


Question: Which aircraft IDs, excluding aircraft ID 5, are also aircraft IDs less than 3 and present in the airport aircraft table?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <> 5 INTERSECT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID < 3


Question: Can you give me a list of driver IDs, including those from the driver table that are 3 or greater, and those from the school bus table that are 7 or less?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 3 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 7


Question: Can you give me a list of driver IDs, including driver ID 1 from the driver table and all driver IDs less than or equal to 9 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 1 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 9


Question: Can you list the aircraft IDs that appear in the aircraft table with an ID of 4 or higher, combined with the aircraft IDs that appear in the airport_aircraft table with an ID greater than 2?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID >= 4 UNION SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID > 2


Question: What starting years are common to both coach 1 and players who have a player ID of 1 or higher, a starting year other than 2012, or a coach ID less than 3?

SELECT Starting_year FROM player_coach WHERE "Coach_ID" = 1 INTERSECT SELECT Starting_year FROM player_coach WHERE "Player_ID" >= 1 OR "Starting_year" <> 2012 OR "Coach_ID" < 3


Question: Can you give me a list of driver IDs, including those from the driver table excluding ID 12, and those from the school bus table with IDs greater than 10?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 12 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 10


Question: Can you give me the number of products, name, manager's name, location, and district for all shops in Helsinki that aren't named "FC Lahti", along with the same information for all shops that aren't named "FC Inter"?

10770
HJK
Antti Muurinen
Helsinki
Finnair Stadium

3516
FC Haka
Olli Huttunen
Valkeakoski
Tehtaan kenttä

10770
HJK
Antti Muurinen
Helsinki
Finnair Stadium

6000
FC Honka
Mika Lehkosuo
Espoo
Tapiolan Urheilupuisto

5000
FF Jaro
Mika Laurikainen
Jakobstad
Jakobstads Centralplan

4780
FC KooTeePee
Tommi Kautonen
Kotka
Arto Tolsa Areena

3500
KuPS
Kai Nyyssönen
Kuopio
Magnum Areena

15000
FC Lahti
Ilkka Mäkelä
Lahti
Lahden Stadion

1600
IFK Mariehamn
Pekka Lyyski
Mariehamn
Wiklöf Holding Arena

SELECT Number_products, Name, Manager_name, Location, District FROM shop WHERE Name <> "FC Lahti" AND Location = "Helsinki" UNION ALL SELECT Number_products, Name, Manager_name, Location, District FROM shop WHERE Name != "FC Inter"


Question: Can you give me a list of driver IDs from the driver table that are greater than 7, excluding any driver IDs that also appear in the school_bus table with a driver ID of 3?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 7 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID = 3


Question: Which driver IDs are both not equal to 8 and also greater than or equal to 3?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 8 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 3


Question: Can you give me a list of driver IDs that are less than 10, excluding those driver IDs that are also less than or equal to 3 and appear in the school bus records?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 10 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 3


Question: Which driver IDs are both greater than 9 and present in the driver table, and also greater than or equal to 4 and present in the school_bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 9 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 4


Question: Can you give me a list of driver IDs that are less than 11, excluding the driver ID 10, considering only unique driver IDs from the driver and school_bus tables?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 11 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID = 10


Question: Can you give me a list of driver IDs that are less than 3 from the driver table, combined with a list of driver IDs that are less than or equal to 3 from the school bus table, removing any duplicates?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 3 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 3


Question: Can you give me a list of driver IDs that are less than 1 from the driver table, combined with a list of driver IDs that are not equal to 4 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 1 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 4


Question: Can you give me a list of driver IDs that are less than 12, excluding any driver IDs that are also 9 or greater and associated with a school bus?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 12 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 9


Question: Can you give me a list of driver IDs, including all driver IDs from the driver table except for driver ID 3, and also including driver ID 3 from the school_bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 3 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID = 3


Question: What are the maximum distance, minimum name, and average aid for aircraft, excluding Boeing 777-300s, where either the aid is 7 or the distance is at least 2605, but excluding any results where the distance is 1530 and the name is Airbus A319?

SELECT MAX(distance), MIN(name), AVG(aid) FROM aircraft WHERE name <> "Boeing 777-300" AND "aid" = 7 OR "distance" >= 2605 EXCEPT SELECT MAX(distance), MIN(name), AVG(aid) FROM aircraft WHERE "distance" = 1530 AND name = "Airbus A319"


Question: Could you list the shop IDs from the hiring information, including those with a Shop ID of 6, or an Employee ID not equal to 4, or those that are full-time, or those that didn't start in 2012, but exclude any shop IDs that are located in Turku?

SELECT Shop_ID FROM hiring WHERE "Shop_ID" = 6 OR "Employee_ID" != 4 OR Is_full_time = "T" OR Start_from <> "2012" EXCEPT SELECT Shop_ID FROM shop WHERE Location = "Turku"


Question: Which car makers from countries other than country code 6 are not listed as makers with a value greater than 18 in the model list?

SELECT Maker FROM car_makers WHERE Country <> "6" EXCEPT SELECT Maker FROM model_list WHERE "Maker" > 18


Question: What is the maximum aircraft ID associated with each airport, along with the total number of passengers at that airport?

SELECT T1.Total_Passengers, MAX(T2.Aircraft_ID) FROM airport as T1 JOIN airport_aircraft as T2 ON T1.Airport_ID = T2.Airport_ID


Question: Which aircraft IDs are not equal to 2 and are also greater than 2 when considering aircraft and airport aircraft separately?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <> 2 INTERSECT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID > 2


Question: Can you give me a list of driver IDs, where each ID is greater than 7, and exclude any driver IDs that also appear in the school bus list, unless that driver ID is 3?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 7 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 3


Question: Can you give me a list of driver IDs less than or equal to 9 from the driver table, excluding any driver IDs less than 10 that are in the school_bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 9 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 10


Question: Can you give me a list of driver IDs, combining those from the driver table excluding driver ID 4, and those from the school bus table excluding driver ID 7?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 4 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 7


Question: Can you give me a list of driver IDs that are 5 or greater, excluding those driver IDs that are greater than 9 and are also in the school bus list?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 5 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 9


Question: Can you give me a list of driver IDs from the driver table that are greater than or equal to 9, excluding any driver IDs that appear in the school bus table where the driver ID is not equal to 3?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 9 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 3


Question: Can you tell me the highest Club ID, earliest start year, club name, and region for clubs that either started after 1998 and have an ID less than 5, or are located in the USA and aren't named "Gefle IF", combined with the same information for clubs with a Club ID of 4?

SELECT MAX(Club_ID), MIN(Start_year), Club_name, Region FROM club WHERE "Start_year" > 1998 AND "Club_ID" < 5 OR Region = "USA" AND Club_name != "Gefle IF" UNION SELECT MAX(Club_ID), MIN(Start_year), Club_name, Region FROM club WHERE "Club_ID" = 4


Question: Could you give me the store IDs for stores that either have an ID of 4 and an area size of at least 28.74 and aren't named Rogersville, or have a number of product categories that isn't 990, or aren't a City Mall, or have a ranking greater than 1, but excluding any store IDs that are greater than 5 in the store_product table?

SELECT Store_ID FROM store WHERE "Store_ID" = 4 AND "Area_size" >= 28.74 AND Store_Name <> "Rogersville" OR "Number_of_product_category" <> 990.0 OR Type != "City Mall" OR "Ranking" > 1 EXCEPT SELECT Store_ID FROM store_product WHERE "Store_ID" > 5


Question: What are the counts of draft numbers from circulation history for employees with IDs of 1 or greater, combined with the counts of draft numbers from draft copies for documents with ID 2 or copies with number 10?

SELECT COUNT(draft_number) FROM Circulation_History WHERE "employee_id" >= 1 UNION SELECT COUNT(draft_number) FROM Draft_Copies WHERE "document_id" = 2 OR "copy_number" = 10


Question: Can you give me a list of driver IDs that are greater than 10, excluding any driver IDs greater than or equal to 7 that are also in the school bus list?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 10 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 7


Question: Can you give me a list of student IDs from the Member_of_club table, including those who aren't presidents or whose student ID is greater than 1001, but excluding any student IDs from the Student table where the student isn't 18, doesn't live in YYZ, and isn't male?

SELECT StuID FROM Member_of_club WHERE Position != "President" OR "StuID" > 1001 EXCEPT SELECT StuID FROM Student WHERE "Age" <> 18 AND city_code != "YYZ" AND Sex <> "M"


Question: Can you list the aircraft IDs, excluding 5, from the aircraft table, and also list the aircraft IDs less than or equal to 2 from the airport_aircraft table, combining the two lists?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <> 5 UNION SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <= 2


Question: Can you give me a list of school IDs, combining those from the budget table where the budget invested percentage isn't 127.6, the budgeted amount is more than 61283, and the year is after 2004, with those from the endowment table where the school ID isn't 6, the amount is 8.53 or less, and the endowment ID is 8 or less?

SELECT School_id FROM budget WHERE Budget_invested_percent <> "127.6" AND "Budgeted" > 61283 AND "Year" > 2004 UNION ALL SELECT School_id FROM endowment WHERE "School_id" <> 6 AND "amount" <= 8.53 AND "endowment_id" <= 8


Question: Which driver IDs are equal to 11 in the driver table, but not equal to 4 in the school_bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 11 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID = 4


Question: Can you give me a list of driver IDs, including those from the driver table excluding driver ID 3, and those from the school bus table with driver IDs of 10 or greater?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 3 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 10


Question: Can you give me a list of school IDs, including those from the School table where the ID isn't "2" and either the enrollment is at least 852 and the IHSAA class is "AAA", or the mascot isn't "Jimmies" and the location isn't "New Carlisle", as well as those from the Budget table where the total budget percent invested is greater than 2.0, or the invested amount isn't 5840, or the budget invested percent isn't "159.3"?

SELECT School_id FROM School WHERE School_id <> "2" AND "Enrollment" >= 852 AND IHSAA_Class = "AAA" OR Mascot <> "Jimmies" AND Location != "New Carlisle" UNION ALL SELECT School_id FROM budget WHERE "total_budget_percent_invested" > 2.0 OR "Invested" != 5840 OR Budget_invested_percent != "159.3"


Question: Can you list the assets, names, sales, profits, and industries for companies that meet either of these conditions: having a market value of at least 79.5 billion, or a company ID of at least 17 and sales less than 87.6 billion, or assets of exactly 2039.1 billion and profits of exactly 15.7 billion, along with companies that meet any of these other conditions: having a market value of at most 154.8 billion and not headquartered in France and not named Citigroup, or sales not equal to 433.5 billion, or assets of at least 304.7 billion, or a company ID not equal to 8, or profits not equal to 25.7 billion?

SELECT Assets_in_Billion, Name, Sales_in_Billion, Profits_in_Billion, Industry FROM company WHERE "Market_Value_in_Billion" >= 79.5 OR "Company_ID" >= 17.0 AND "Sales_in_Billion" < 87.6 OR "Assets_in_Billion" = 2039.1 AND "Profits_in_Billion" = 15.7 UNION ALL SELECT Assets_in_Billion, Name, Sales_in_Billion, Profits_in_Billion, Industry FROM company WHERE "Market_Value_in_Billion" <= 154.8 AND Headquarters != "France" AND Name != "Citigroup" OR "Sales_in_Billion" != 433.5 OR "Assets_in_Billion" >= 304.7 OR "Company_ID" != 8.0 OR "Profits_in_Billion" != 25.7


Question: Can you give me the driver IDs that are both less than or equal to 7 in the driver table and greater than or equal to 3 in the school_bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 7 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 3


Question: Can you give me a list of driver IDs that are both less than or equal to 6 and are not equal to 3, considering only unique driver IDs from the driver and school bus lists?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 6 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 3


Question: Can you give me a list of driver IDs, including driver ID 6 from the driver table and any driver IDs less than or equal to 10 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 6 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 10


Question: Can you give me a list of driver IDs that are not 10 from the driver table, but only include those IDs that are also not 7 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 10 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 7


Question: Can you give me the Driver ID, School ID, and full-time status for school bus drivers who either aren't full-time, have worked for 3 years or less, are assigned to school ID 5 or lower, or have a Driver ID less than 9, but only if their Driver ID is also 3 or greater?

SELECT Driver_ID, School_ID, If_full_time FROM school_bus WHERE If_full_time <> "T" OR "Years_Working" <= 3 OR "School_ID" <= 5 OR "Driver_ID" < 9 INTERSECT SELECT Driver_ID, School_ID, If_full_time FROM school_bus WHERE "Driver_ID" >= 3


Question: Which driver IDs appear in the driver table, excluding driver ID 1, and also appear in the school bus table as driver ID 7?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 1 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID = 7


Question: Can you give me the IDs of drivers who are both either 37 years old or have an ID of 12 or greater and are not named Timothy Ackert, and also either not full-time or not ID 4 and drive for school ID 1?

SELECT Driver_ID FROM driver WHERE "Age" = 37 OR "Driver_ID" >= 12 AND Name != "Timothy Ackert" INTERSECT SELECT Driver_ID FROM school_bus WHERE If_full_time <> "T" OR "Driver_ID" <> 4 AND "School_ID" = 1


Question: Can you give me a list of employee IDs for employees named Louis Deacon, or who live in Leicester, or are not 23 years old, or have an employee ID greater than 2, excluding those employee IDs that are also in the hiring table where the shop ID is 8 or greater?

SELECT Employee_ID FROM employee WHERE Name = "Louis Deacon" OR City = "Leicester" OR "Age" != 23 OR "Employee_ID" > 2 EXCEPT SELECT Employee_ID FROM hiring WHERE "Shop_ID" >= 8


Question: Which head IDs are associated with heads aged 43 or older, and also associated with management positions in departments other than department 7?

SELECT head_ID FROM head WHERE "age" >= 43.0 INTERSECT SELECT head_ID FROM management WHERE "department_ID" <> 7


Question: Can you give me a list of driver IDs that are less than 2, and combine that with a list of driver IDs from the school bus database that are greater than or equal to 4?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 2 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 4


Question: Can you give me a list of aircraft IDs, excluding aircraft ID 3, that are present in the aircraft table but not in the airport_aircraft table, where aircraft ID 2 is excluded from the airport_aircraft table?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID != 3 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID != 2


Question: Can you give me a list of names, including employee names that aren't George Chuter or are from employees who aren't 30 years old and don't live in Wasps, combined with shop names where the manager isn't Mika Lehkosuo and the shop ID is 4 or greater and the number of products is 10000 or greater, or the district is Finnair Stadium, or the location isn't Valkeakoski and the shop name isn't FC Haka?

SELECT Name FROM employee WHERE Name <> "George Chuter" OR "Age" <> 30 AND City != "Wasps" UNION SELECT Name FROM shop WHERE Manager_name != "Mika Lehkosuo" AND "Shop_ID" >= 4 AND "Number_products" >= 10000 OR District = "Finnair Stadium" OR Location != "Valkeakoski" AND Name != "FC Haka"


Question: Which driver IDs are both greater than or equal to 9 in the driver table and less than or equal to 9 in the school_bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 9 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 9


Question: Can you list the aircraft IDs that are greater than or equal to 4, excluding those aircraft IDs that are not equal to 5 and are found in the airport aircraft table?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID >= 4 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID != 5


Question: Can you give me a list of employee IDs for employees who are either younger than 32, not named Andrew Sheridan, or don't live in Bristol, excluding employee ID 6, but then remove any employee IDs that are not full-time or are not employee ID 1 from that list?

SELECT Employee_ID FROM employee WHERE "Age" < 32 OR Name != "Andrew Sheridan" OR City != "Bristol" AND "Employee_ID" <> 6 EXCEPT SELECT Employee_ID FROM hiring WHERE Is_full_time <> "F" OR "Employee_ID" <> 1


Question: Can you list all the driver IDs, including those from the driver table that are greater than or equal to 2, and those from the school bus table that are less than 7?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 2 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 7


Question: Can you give me a list of driver IDs that are both greater than or equal to 5 and not equal to 9, considering drivers from both the driver and school bus tables?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 5 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 9


Question: Can you list all the aircraft IDs, including aircraft ID 2 from the aircraft table and any aircraft IDs greater than 1 from the airport_aircraft table?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID = 2 UNION SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID > 1


Question: Could you list the store IDs from the store table where either the number of product categories is 17811 or less, or the ranking isn't 2, the area size is at least 28.74, and the store ID is less than 2, or the store name is "Doaktown" and the type is not "City Mall", combined with the store IDs from the store_product table where the store ID is greater than 1?

SELECT Store_ID FROM store WHERE "Number_of_product_category" <= 17811.0 OR "Ranking" != 2 AND "Area_size" >= 28.74 AND "Store_ID" < 2 OR Store_Name = "Doaktown" AND Type <> "City Mall" UNION SELECT Store_ID FROM store_product WHERE "Store_ID" > 1


Question: Which aircraft have an ID of 1 and are also not associated with an airport having an ID of 2?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID = 1 INTERSECT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID != 2


Question: Can you give me a list of driver IDs from the driver table that are less than or equal to 1, excluding any driver IDs that appear in the school_bus table and are less than 10?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 1 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 10


Question: Can you give me a list of driver IDs, combining those from the driver table where the ID is not 7 with those from the school bus table where the ID is greater than 3?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 7 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 3


Question: Can you give me the publication date, ID, publisher, book ID, and price for publications that satisfy both of these conditions: first, the publication ID is less than 7 or the book ID is less than 9; and second, the publication ID is 2, or the publisher is not Pearson, or the book ID is greater than or equal to 7, or the price is not 4100000?

SELECT Publication_Date, Publication_ID, Publisher, Book_ID, Price FROM publication WHERE "Publication_ID" < 7 OR "Book_ID" < 9 INTERSECT SELECT Publication_Date, Publication_ID, Publisher, Book_ID, Price FROM publication WHERE "Publication_ID" = 2 OR Publisher != "Pearson" OR "Book_ID" >= 7 OR "Price" <> 4100000.0


Question: Can you give me a list of driver IDs less than or equal to 9 that are in the driver table, but not in the school bus table, excluding driver ID 9 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 9 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 9


Question: Can you list the aircraft IDs that appear in the aircraft table, excluding aircraft ID 5, but then remove any aircraft IDs that also appear in the airport_aircraft table with an aircraft ID of 1?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <> 5 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID = 1


Question: Can you list all the driver IDs from the driver table that are 11 or greater, and combine that with a list of all driver IDs from the school_bus table that are less than 10?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 11 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 10


Question: Can you give me a list of driver IDs that are not equal to 2 from the driver table, excluding any driver IDs greater than 9 that are also in the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 2 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 9


Question: Can you give me a list of driver IDs from the driver table that are less than or equal to 1, combined with a list of driver IDs from the school_bus table that are greater than or equal to 9?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 1 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 9


Question: Can you list all the feature type codes from the Other_Available_Features table where the feature ID is not 3, or the feature name is not "BurglarAlarm", and the feature type code is not "Amenity", and the feature description is not "Air Conditioning.", along with all the feature type codes from the Ref_Feature_Types table where the feature type code is not "Amenity" and the feature type name is "Securiyt, eg Burglar Alarm."?

SELECT feature_type_code FROM Other_Available_Features WHERE "feature_id" != 3 OR feature_name <> "BurglarAlarm" AND feature_type_code <> "Amenity" AND feature_description != "Air Conditioning." UNION ALL SELECT feature_type_code FROM Ref_Feature_Types WHERE feature_type_code <> "Amenity" AND feature_type_name = "Securiyt, eg Burglar Alarm."


Question: Which driver IDs, excluding driver ID 7, are present in both the driver list and the school bus list?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 7 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 7


Question: Can you give me a list of driver IDs, excluding driver ID 12, and combine that with a list of school bus driver IDs, excluding driver ID 7?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 12 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 7


Question: Can you give me a list of driver IDs that are both greater than or equal to 9 and also not equal to 7, considering only drivers who appear in both the driver and school bus records?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 9 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 7


Question: What is the difference between the total number of airports that are not LEBL and the total number of flights that either have an ID greater than or equal to 9 and an airport ID greater than or equal to 1 and an altitude not equal to 3650, or are flown by pilot Thompson on August 30, 1965, or have a company ID less than or equal to 5, or have a velocity less than or equal to 240?

SELECT COUNT(id) FROM airport WHERE ICAO != "LEBL" EXCEPT SELECT COUNT(id) FROM flight WHERE "id" >= 9 AND "airport_id" >= 1 AND "Altitude" <> 3650.0 OR Pilot = "Thompson" AND Date = "August 30, 1965" OR "company_id" <= 5 OR "Velocity" <= 240.0


Question: Which aircraft have an ID of 3 and are also associated with airports that don't have an aircraft ID of 1?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID = 3 INTERSECT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID != 1


Question: Can you list all aircraft IDs that are greater than or equal to 5, and also list aircraft ID 1 from the airport aircraft?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID >= 5 UNION SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID = 1


Question: Could you give me the IDs of car makers that are either not from country 6 and are not Peugeaut, or have an ID less than 7 and are not Kia, combined with the IDs of cars that either have an engine displacement of 302 and were not made in 1977 and weigh less than 3365, or accelerate faster than 16.4 and have an ID of 125 or greater and have horsepower that isn't 68 and get 24 MPG, or have 4 cylinders?

SELECT Id FROM car_makers WHERE Country != "6" AND FullName != "Peugeaut" OR "Id" < 7 AND Maker <> "kia" UNION ALL SELECT Id FROM cars_data WHERE "Edispl" = 302.0 AND "Year" <> 1977 AND "Weight" < 3365 OR "Accelerate" > 16.4 AND "Id" >= 125 AND Horsepower != "68" AND MPG = "24" OR "Cylinders" = 4


Question: Can you give me the company name, sales in billions, and company ID for companies that meet certain criteria, excluding those that meet other criteria? Specifically, first find companies that either have profits not equal to 15.9 billion and a company ID of 6 or greater, or are named "JPMorgan Chase" and have sales of 68.7 billion or less. Then, from that list, remove any companies that either have sales of 310.1 billion or more, or are not named "Gazprom" and have assets of 328.7 billion or less and are not headquartered in the USA, or have a company ID of 18 or less and a market value not equal to 227.6 billion and are not in the Banking industry, or have profits greater than 11.1 billion.

SELECT Name, Sales_in_Billion, Company_ID FROM company WHERE "Profits_in_Billion" <> 15.9 AND "Company_ID" >= 6.0 OR Name = "JPMorgan Chase" AND "Sales_in_Billion" <= 68.7 EXCEPT SELECT Name, Sales_in_Billion, Company_ID FROM company WHERE "Sales_in_Billion" >= 310.1 OR Name != "Gazprom" AND "Assets_in_Billion" <= 328.7 AND Headquarters <> "USA" OR "Company_ID" <= 18.0 AND "Market_Value_in_Billion" <> 227.6 AND Industry != "Banking" OR "Profits_in_Billion" > 11.1


Question: Can you give me a list of aircraft IDs that are less than 5, and also appear in a list of aircraft IDs from the airport, excluding aircraft ID 1?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID < 5 INTERSECT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <> 1


Question: Can you give me a list of driver IDs, combining those from the driver table that are not 11 with those from the school bus table that are less than 3, removing any duplicates?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 11 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 3


Question: Can you give me a list of driver IDs, excluding driver ID 3, from the driver table, but then remove any driver IDs that are also driver ID 7 in the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 3 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID = 7


Question: Can you give me a list of driver IDs, including driver ID 9 from the driver table and all driver IDs except 7 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 9 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 7


Question: Can you give me a list of driver IDs that are both less than 11 and appear in the driver table, and also less than or equal to 10 and appear in the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 11 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 10


Question: Can you give me a list of driver IDs that are less than 6 from the driver table, combined with a list of driver IDs that are less than 3 from the school bus table, making sure to remove any duplicates?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 6 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 3


Question: What is the sum of student IDs from the Has_Pet table where the pet ID is greater than or equal to 2001 or the student ID is less than or equal to 1002, combined with the sum of student IDs from the Student table where the major is less than 600 and the last name is not Smith, or the city code is PIT, the student ID is 1009, and the sex is male?

SELECT SUM(StuID) FROM Has_Pet WHERE "PetID" >= 2001 OR "StuID" <= 1002 UNION SELECT SUM(StuID) FROM Student WHERE "Major" < 600 AND LName != "Smith" OR city_code = "PIT" AND "StuID" = 1009 AND Sex = "M"


Question: Can you give me a list of student IDs from the Has_Pet table where the pet ID is greater than 2001 and the student ID is less than 1002, combined with a list of student IDs from the Student table where the student ID is less than or equal to 1018, or the first name is George and the last name is not Kim, or the city code is not PHL and the sex is not female and the age is less than 17, or the major is less than or equal to 600?

SELECT StuID FROM Has_Pet WHERE "PetID" > 2001 AND "StuID" < 1002 UNION SELECT StuID FROM Student WHERE "StuID" <= 1018 OR Fname = "George" AND LName != "Kim" OR city_code != "PHL" AND Sex <> "F" AND "Age" < 17 OR "Major" <= 600


Question: What is the average aircraft ID for aircraft that either aren't ID 3, aren't named Boeing 777-300, or have a distance greater than 6475, combined with the average aircraft ID for flights where the aircraft ID is less than 3, the origin is not Los Angeles, the price is not 278.56, and the destination is not Chicago?

SELECT AVG(aid) FROM aircraft WHERE "aid" != 3 OR name != "Boeing 777-300" OR "distance" > 6475 UNION ALL SELECT AVG(aid) FROM flight WHERE "aid" < 3 AND origin <> "Los Angeles" AND "price" <> 278.56 AND destination != "Chicago"


Question: Can you give me a list of driver IDs that are greater than 4 from the driver table, combined with driver IDs that are exactly 7 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 4 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID = 7


Question: Which driver IDs are both less than or equal to 8 and also equal to 7?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 8 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID = 7


Question: What aircraft IDs are present in the aircraft table, excluding aircraft ID 2, but not present in the airport_aircraft table where the aircraft ID is greater than 1?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID != 2 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID > 1


Question: Can you give me a list of aircraft IDs where the ID is greater than 4 from the aircraft table, combined with a list of aircraft IDs that are not equal to 3 from the airport_aircraft table?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID > 4 UNION SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID != 3


Question: What are the average draft details and document IDs for drafts with "m" as draft details and either a draft number less than 14 or a document ID greater than or equal to 13, excluding the average draft details and document IDs for drafts with a draft number less than 17 and a document ID greater than or equal to 2?

SELECT AVG(draft_details), document_id FROM Document_Drafts WHERE draft_details = "m" AND "draft_number" < 14 OR "document_id" >= 13 EXCEPT SELECT AVG(draft_details), document_id FROM Document_Drafts WHERE "draft_number" < 17 AND "document_id" >= 2


Question: Can you give me a list of driver IDs from the driver table that are greater than or equal to 8, excluding any driver IDs from the school_bus table that are equal to 7?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 8 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID = 7


Question: Can you give me a list of driver IDs from the driver table, excluding driver ID 6, but then remove any driver IDs that also appear in the school_bus table with a driver ID of 7?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 6 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID = 7


Question: What aircraft IDs are greater than 2, when considering each unique aircraft ID, excluding those aircraft IDs from airport aircraft that are not equal to 3, when considering each unique aircraft ID?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID > 2 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <> 3


Question: Can you list the aircraft IDs that are less than or equal to 1, and also list the aircraft IDs from the airport aircraft table that are greater than 3?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <= 1 UNION SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID > 3


Question: Can you give me a list of branch IDs, excluding those with a Branch ID that isn't "5" in the membership register, from branches that are not in London, or opened in 2001, or have a Branch ID less than or equal to 2, or have a membership amount that isn't 112, or are named Cochrane?

SELECT Branch_ID FROM branch WHERE City != "London" OR Open_year = "2001" OR "Branch_ID" <= 2 OR membership_amount <> "112" OR Name = "Cochrane" EXCEPT SELECT Branch_ID FROM membership_register_branch WHERE Branch_ID != "5"


Question: Can you give me the document ID, average draft number, and draft details for documents with an ID of 2 or less, draft details equal to "p", and a draft number not equal to 8, excluding those documents with an ID of 20 or less, a draft number of 14 or greater, and draft details not equal to "r"?

SELECT document_id, AVG(draft_number), draft_details FROM Document_Drafts WHERE "document_id" <= 2 AND draft_details = "p" AND "draft_number" != 8 EXCEPT SELECT document_id, AVG(draft_number), draft_details FROM Document_Drafts WHERE "document_id" <= 20 AND "draft_number" >= 14 AND draft_details != "r"


Question: Can you give me the album IDs that meet these conditions: either the album title is not "Radio Brasil (O Som da Jovem Vanguarda) - Seleccao de Henrique Amaro" and the ID is greater than or equal to 153, or the artist ID is not 254, but exclude any IDs that also appear in a list of employee IDs where the employee's last name is "Park", their first name is not "Jane", or their ID is greater than 1?

SELECT id FROM albums WHERE title != "Radio Brasil (O Som da Jovem Vanguarda) - Seleccao de Henrique Amaro" AND "id" >= 153 OR "artist_id" != 254 EXCEPT SELECT id FROM employees WHERE last_name = "Park" OR first_name <> "Jane" OR "id" > 1


Question: Can you give me a list of driver IDs that are less than 3 from the driver table, combined with a list of driver IDs that are less than or equal to 7 from the school bus table, removing any duplicates?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 3 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 7


Question: Which driver IDs are both greater than 6 and present in the driver table, and also greater than or equal to 9 and present in the school_bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 6 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 9


Question: What is the highest bonus amount, excluding those where the employee ID is 10, after removing the highest bonus amounts where the employee ID is not 7 or the year awarded is not 2016?

SELECT MAX(Bonus) FROM evaluation WHERE Employee_ID != "10" EXCEPT SELECT MAX(Bonus) FROM evaluation WHERE Employee_ID <> "7" OR Year_awarded != "2016"


Question: Could you list the draft numbers from the Document Drafts table where the draft details are "b" or the document ID is greater than 10 and the draft number is not 14, combined with the draft numbers from the Draft Copies table where the draft number is greater than or equal to 12 and the copy number is not 5?

SELECT draft_number FROM Document_Drafts WHERE draft_details = "b" OR "document_id" > 10 AND "draft_number" != 14 UNION ALL SELECT draft_number FROM Draft_Copies WHERE "draft_number" >= 12 AND "copy_number" <> 5


Question: Can you give me the total branch ID and year from the purchase table, first for purchases where the member ID is greater than 3 or the total pounds is not equal to 321.13 and the branch ID is not "3", and then also for purchases where the member ID is 3 or the year is not "2018" and the branch ID is "2" and the total pounds is less than 2013.32?

SELECT SUM(Branch_ID), Year FROM purchase WHERE "Member_ID" > 3 OR "Total_pounds" <> 321.13 AND Branch_ID != "3" UNION ALL SELECT SUM(Branch_ID), Year FROM purchase WHERE "Member_ID" = 3 OR Year != "2018" AND Branch_ID = "2" AND "Total_pounds" < 2013.32


Question: Which driver has an ID of 5, but is not a driver with an ID other than 4 in the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 5 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 4


Question: Can you list the aircraft IDs, excluding aircraft ID 5, that appear in the aircraft table but not in the airport_aircraft table where the aircraft ID is less than or equal to 1?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID != 5 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <= 1


Question: Can you give me the ID, country, total maker count, and full name of car makers that meet these two conditions: first, they're not Peugeaut and their maker is "gm", or their ID is less than or equal to 18, or their country isn't "1"; and second, they're not Subaru and their ID isn't 12?

SELECT Id, Country, SUM(Maker), FullName FROM car_makers WHERE FullName != "Peugeaut" AND Maker = "gm" OR "Id" <= 18 OR Country <> "1" INTERSECT SELECT Id, Country, SUM(Maker), FullName FROM car_makers WHERE FullName != "Subaru" AND "Id" <> 12


Question: Can you give me the zip codes, cities, and address IDs that are both not from address ID 2, zip code 85954, South Richieport, or 376 Kallie Tunnel Apt. 784, and also not from Washington, South Richieport, or the USA, or 2291 Larkin Ports?

SELECT zip_postcode, city, address_id FROM Addresses WHERE "address_id" != 2 AND zip_postcode != "85954" AND city != "South Richieport" AND line_1_number_building <> "376 Kallie Tunnel Apt. 784" INTERSECT SELECT zip_postcode, city, address_id FROM Addresses WHERE state_province_county != "Washington" AND city <> "South Richieport" OR country <> "USA" OR line_1_number_building <> "2291 Larkin Ports"


Question: Can you give me the actor ID and rating from the review table where either the item ID is 1, or the actor ID is not 4 and the rating is 5 or less, but only if they also appear in the review table where the rating is 5, or the user ID is less than 1, or the actor ID is 3, the item ID is 7 or greater, and the rank is 7 or greater?

SELECT a_id, rating FROM review WHERE "i_id" = 1 OR "a_id" <> 4 AND "rating" <= 5 INTERSECT SELECT a_id, rating FROM review WHERE "rating" = 5 OR "u_id" < 1 OR "a_id" = 3 AND "i_id" >= 7 AND "rank" >= 7


Question: Could you give me the customer ID and customer address ID for customers, grouped by the date they became a customer, where the payment datetime is exactly "2018-03-12 13:31:36" and their last name is "Ortiz", or where the date they became a customer is exactly "2016-09-04 23:08:20", or where the payment method is not "Direct Debit", the phone number is "1-875-045-0806", the payment amount is less than 5475.26, the outstanding amount is less than 3900.0, and the customer status is not "Bad Customer"?

SELECT T1.customer_id, T2.customer_address_id FROM Customer_Payments as T1 JOIN Customers as T2 ON T1.customer_id == T2.customer_id GROUP BY date_became_customer HAVING datetime_payment = "2018-03-12 13:31:36" AND last_name = "Ortiz" OR date_became_customer = "2016-09-04 23:08:20" OR payment_method_code <> "Direct Debit" AND phone_number = "1-875-045-0806" AND amount_payment < 5475.26 AND amount_outstanding < 3900.0 AND customer_status_code <> "Bad Customer"


Question: Which driver IDs are both not equal to 6 and greater than or equal to 9?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 6 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 9


Question: What aircraft IDs are greater than or equal to 2, excluding those aircraft IDs that are also greater than or equal to 5 and found in the airport aircraft table?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID >= 2 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID >= 5


Question: Can you give me a list of driver IDs less than or equal to 8, excluding any driver IDs that are not equal to 7 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 8 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 7


Question: Can you give me a list of vehicle IDs that either belong to completed lesson number 5 or are cars?

SELECT vehicle_id FROM Lessons WHERE lesson_status_code = "Completed" AND "lesson_id" = 5 UNION SELECT vehicle_id FROM Vehicles WHERE vehicle_details = "Car"


Question: Can you give me a list of driver IDs that are not 5 and also not 10, considering drivers from both the driver and school bus lists?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 5 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 10


Question: Can you give me a list of driver IDs from the driver table that are greater than or equal to 3, excluding any driver IDs that are not equal to 9 from the school_bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 3 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 9


Question: Can you give me a list of driver IDs that are not equal to 1 from the driver table, but only include those driver IDs that are also not equal to 4 from the school_bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 1 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 4


Question: What is the smallest People ID from the employment table where the Company ID is greater than 15, and also, what is the smallest People ID from the people table where the People ID is 2 and either the Graduation College is California, the name is not David Butler, the age is not 25, or the nationality is United Kingdom?

SELECT MIN(People_ID) FROM employment WHERE "Company_ID" > 15 UNION ALL SELECT MIN(People_ID) FROM people WHERE "People_ID" = 2 AND Graduation_College = "California" OR Name != "David Butler" OR "Age" <> 25 OR Nationality = "United Kindom"


Question: What vehicle details and IDs are available for vehicles that are not vehicle ID 2, excluding those that are also not vehicle ID 1?

SELECT vehicle_details, vehicle_id FROM Vehicles WHERE "vehicle_id" <> 2 EXCEPT SELECT vehicle_details, vehicle_id FROM Vehicles WHERE "vehicle_id" <> 1


Question: Can you give me a list of driver IDs less than or equal to 6, excluding any driver IDs that are not equal to 9, based on the driver and school bus records?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 6 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 9


Question: Can you give me the mailing date, average address ID, and document ID for all mailings where the document ID is greater than 13 or the address ID is less than 3, combined with the mailing date, average address ID, and document ID for all mailings where the address ID is not 4?

SELECT mailing_date, AVG(mailed_to_address_id), document_id FROM Documents_Mailed WHERE "document_id" > 13 OR "mailed_to_address_id" < 3 UNION ALL SELECT mailing_date, AVG(mailed_to_address_id), document_id FROM Documents_Mailed WHERE "mailed_to_address_id" <> 4


Question: What are the Book IDs and the total Publisher values for publications with Publication ID 6, excluding those that also appear for publications with Publication ID 3?

SELECT Book_ID, SUM(Publisher) FROM publication WHERE "Publication_ID" = 6 EXCEPT SELECT Book_ID, SUM(Publisher) FROM publication WHERE "Publication_ID" = 3


Question: Can you give me a list of driver IDs from the driver table where the ID is less than or equal to 12, combined with a list of driver IDs from the school_bus table where the ID is exactly 10?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 12 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID = 10


Question: Can you give me the age, nationality, and people ID for individuals who either aren't from the United States and didn't graduate from California, or are 34 or younger, or have a people ID of 3 and are named Tom Sheehey; combined with the age, nationality, and people ID for individuals who aren't named Brad Lohaus, don't have a people ID of 3, are 37 years old, are from the United States, and didn't graduate from California?

SELECT Age, Nationality, People_ID FROM people WHERE Nationality <> "United States" AND Graduation_College != "California" OR "Age" <= 34 OR "People_ID" = 3 AND Name = "Tom Sheehey" UNION SELECT Age, Nationality, People_ID FROM people WHERE Name != "Brad Lohaus" AND "People_ID" != 3 AND "Age" = 37 AND Nationality = "United States" AND Graduation_College != "California"


Question: Which driver has an ID of 10 and also drives a school bus, but not one with an ID of 4?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 10 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 4


Question: What aircraft have an ID of 3 when considering aircraft IDs in the aircraft table, excluding those aircraft IDs from the airport_aircraft table that are greater than 5?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID = 3 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID > 5


Question: Can you list the aircraft IDs, first from the aircraft table excluding aircraft ID 5, and then from the airport_aircraft table including only aircraft IDs less than 3, removing any duplicates?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID != 5 UNION SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID < 3


Question: Can you give me a list of driver IDs from the driver table that are greater than 6, excluding any driver IDs that also appear in the school_bus table where the driver ID is not 10?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 6 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 10


Question: Can you give me a list of driver IDs, including those from the driver table where the ID is not 1, and those from the school bus table where the ID is 9 or greater?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 1 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 9


Question: Can you give me a list of driver IDs less than 8 from the driver table, excluding any driver IDs greater than or equal to 9 that are in the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 8 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 9


Question: Can you list the trust values and target user IDs from the trust table where the source user ID is 6, or the target user ID is 5 or less, or the trust value is 8, and also include all trust values and target user IDs where the trust value is 1 or greater?

SELECT trust, target_u_id FROM trust WHERE "source_u_id" = 6 OR "target_u_id" <= 5 OR "trust" = 8 UNION ALL SELECT trust, target_u_id FROM trust WHERE "trust" >= 1


Question: Can you give me a list of driver IDs that are 3 or greater, excluding those driver IDs that are 7 or greater and are also in the school bus list?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 3 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 7


Question: Could you give me the Aircraft IDs for all aircraft that are either a "Robinson R-22", or have a total disk area of "4,900 ft² (460 m²)" but not a max disk loading of "3.7 lb/ft² (18 kg/m²)", or have an Aircraft ID of 2 but not a max gross weight of "73,500 lb (33,300 kg)", except for those Aircraft IDs that are associated with an ID of 3 or with an Aircraft ID of 5 and an Airport ID of 6 in the airport aircraft table?

SELECT Aircraft_ID FROM aircraft WHERE Aircraft = "Robinson R-22" OR Total_disk_area = "4,900 ft² (460 m²)" AND Max_disk_Loading <> "3.7 lb/ft² (18 kg/m²)" OR "Aircraft_ID" = 2 AND Max_Gross_Weight <> "73,500 lb (33,300 kg)" EXCEPT SELECT Aircraft_ID FROM airport_aircraft WHERE "ID" = 3 OR "Aircraft_ID" = 5 AND "Airport_ID" = 6


Question: Can you give me a list of driver IDs, excluding driver ID 4, that are not also driver IDs less than 7 in the school bus list?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 4 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 7


Question: Can you give me a list of all driver IDs, excluding driver ID 7 from the driver table and driver ID 3 from the school_bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 7 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 3


Question: Can you show me the earnings and final table appearances for poker players if their ID is 1 or higher, or their earnings are at least $476,090 and their money rank is at least 58, or they've made 42 or fewer final tables; and also show me the earnings and final table appearances for poker players if their best finish isn't first place, or their earnings are greater than $596,462, or their people ID is not 6?

SELECT Earnings, Final_Table_Made FROM poker_player WHERE "Poker_Player_ID" >= 1 OR "Earnings" >= 476090.0 AND "Money_Rank" >= 58.0 OR "Final_Table_Made" <= 42.0 UNION ALL SELECT Earnings, Final_Table_Made FROM poker_player WHERE "Best_Finish" <> 1.0 OR "Earnings" > 596462.0 OR "People_ID" != 6


Question: Can you give me a list of driver IDs that are less than or equal to 3 from the driver table, combined with a list of driver IDs that are less than or equal to 10 from the school bus table, removing any duplicates?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 3 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 10


Question: Can you list all the driver IDs that are less than 9 from the driver table, and combine that with a list of all driver IDs that are less than or equal to 9 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 9 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 9


Question: What are the maximum gross weights of aircraft and the corresponding airport IDs they are associated with?

SELECT T1.Max_Gross_Weight, T2.Airport_ID FROM aircraft as T1 JOIN airport_aircraft as T2 ON T1.Aircraft_ID = T2.Aircraft_ID


Question: Can you tell me the age, driver ID, and party for Jason Rojas, and also for anyone who either doesn't live in Bethel and is named Dan Carter, or is in the Dem party, or whose age is not 45, or whose driver ID is 6 or higher?

SELECT Age, Driver_ID, Party FROM driver WHERE Name = "Jason Rojas" UNION SELECT Age, Driver_ID, Party FROM driver WHERE Home_city != "Bethel" AND Name = "Dan Carter" OR Party = "Dem" AND "Age" != 45 OR "Driver_ID" >= 6


Question: Can you give me a list of driver IDs less than or equal to 12, excluding any driver IDs that are not equal to 3 from the school bus list?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 12 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 3


Question: Can you give me a list of store IDs, including those from the store district table where the store ID is not 1 and the district ID is 15 or greater, and also those from the store product table where the store ID is greater than 1 or the product ID is less than or equal to 2?

SELECT Store_ID FROM store_district WHERE "Store_ID" != 1 AND "District_ID" >= 15 UNION ALL SELECT Store_ID FROM store_product WHERE "Store_ID" > 1 OR "Product_ID" <= 2


Question: Can you give me a list of aircraft IDs that are not equal to 1, excluding those aircraft IDs less than 2 that are also found in the airport aircraft table?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <> 1 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID < 2


Question: Can you list the party, name, driver ID, age, and home city for all drivers who are not 46 years old or are not in the Dem party, along with the party, name, driver ID, age, and home city for all drivers in the Rep party who are not driver ID 4?

SELECT Party, Name, Driver_ID, Age, Home_city FROM driver WHERE "Age" <> 46 OR Party != "Dem" UNION ALL SELECT Party, Name, Driver_ID, Age, Home_city FROM driver WHERE Party = "Rep" AND "Driver_ID" != 4


Question: Can you give me the school IDs for schools that either don't have "Cavaliers" as their mascot, aren't located in "50 Marshall" county, or are not classified as "AAA" but are classified as "AA" in IHSAA football, combined with the school IDs from endowments where the donator's name is "Monte Plata" or the endowment ID is less than or equal to 5 and the amount is greater than or equal to 8.43?

SELECT School_id FROM School WHERE Mascot != "Cavaliers" OR County <> "50 Marshall" OR IHSAA_Class <> "AAA" AND IHSAA_Football_Class = "AA" UNION SELECT School_id FROM endowment WHERE donator_name = "Monte Plata" OR "endowment_id" <= 5 AND "amount" >= 8.43


Question: Which driver IDs are equal to 2 in the driver table, excluding any driver IDs that are not equal to 10 in the school_bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 2 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 10


Question: Which driver IDs are both not equal to 2 and less than or equal to 4?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 2 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 4


Question: Can you list the aircraft IDs, including those from the aircraft table that are greater than or equal to 2, and those from the airport_aircraft table that are less than or equal to 1?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID >= 2 UNION SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <= 1


Question: How many certificates are associated with employee ID 141582651, and how many employees have an ID greater than 489221823 or a name other than Michael Miller and a salary greater than 48090?

SELECT COUNT(eid) FROM certificate WHERE "eid" = 141582651 UNION ALL SELECT COUNT(eid) FROM employee WHERE "eid" > 489221823 OR name != "Michael Miller" AND "salary" > 48090


Question: Can you list the aircraft IDs that are greater than or equal to 2, excluding those aircraft IDs that are also greater than 5 in the airport aircraft list?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID >= 2 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID > 5


Question: Can you give me the lowest People ID, highest age, earliest graduation college, earliest name, and average nationality for people, excluding those who are 34 years old or named David Butler or graduated from Northeastern, but including those whose nationality isn't United Kingdom and whose People ID is greater than 2, then remove from that result the lowest People ID, highest age, earliest graduation college, earliest name, and average nationality for people who graduated from Iowa, or whose People ID is 7 or less and nationality isn't United Kingdom, or are named Jerry Corcoran?

SELECT MIN(People_ID), MAX(Age), MIN(Graduation_College), MIN(Name), AVG(Nationality) FROM people WHERE "Age" <> 34 AND Name != "David Butler" AND Graduation_College <> "Northeastern" OR Nationality != "United Kindom" AND "People_ID" > 2 EXCEPT SELECT MIN(People_ID), MAX(Age), MIN(Graduation_College), MIN(Name), AVG(Nationality) FROM people WHERE Graduation_College = "Iowa" OR "People_ID" <= 7 AND Nationality <> "United Kindom" OR Name = "Jerry Corcoran"


Question: Can you give me a list of driver IDs, including driver ID 10 from the driver table, and all driver IDs except 4 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 10 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 4


Question: Can you give me a list of driver IDs, including those from the driver table that are greater than 5, and those from the school bus table that are greater than or equal to 4?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 5 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 4


Question: Can you give me a list of driver IDs, including driver ID 11 from the driver table and any driver IDs greater than or equal to 10 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 11 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 10


Question: Can you give me a list of driver IDs that are greater than 7 from the driver table, combined with a list of driver IDs that are greater than or equal to 3 from the school bus table, removing any duplicates?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 7 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 3


Question: Could you list all the store IDs from the store_district table that are less than 1, and also list all the store IDs from the store_product table where the product ID is not 2 and the store ID is 5 or greater?

SELECT Store_ID FROM store_district WHERE "Store_ID" < 1 UNION ALL SELECT Store_ID FROM store_product WHERE "Product_ID" <> 2 AND "Store_ID" >= 5


Question: Can you list the names from the branch table where either the Branch ID is 1 and the membership amount isn't 6, or the road isn't Glebe Street, the city is Oxford, and the name isn't Popert, or the opening year isn't 2015, combined with the names from the member table where either the level isn't 6, or the member ID is less than 9, the name isn't Johnny Williams, and the hometown isn't Jacksonville, Florida?

SELECT Name FROM branch WHERE "Branch_ID" = 1 AND membership_amount <> "6" OR Address_road != "Glebe Street" AND City = "Oxford" AND Name != "Popert" OR Open_year != "2015" UNION SELECT Name FROM member WHERE "Level" <> 6 OR "Member_ID" < 9 AND Name <> "Johnny Williams" AND Hometown != "Jacksonville, Florida"


Question: Can you give me a list of driver IDs that are less than 1 from the driver table, combined with a list of driver IDs that are not equal to 4 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 1 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 4


Question: Can you give me a list of driver IDs, excluding those equal to 3, that are greater than 5 and appear more than once in the driver table but not in the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 5 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 3


Question: Could you list the driver IDs that are both less than or equal to 10 and appear in the driver table, and also less than 7 and appear in the school_bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 10 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 7


Question: Can you give me the IDs of drivers with IDs less than 4, excluding those who drive school buses and have IDs not equal to 4?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 4 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 4


Question: Can you list all the driver IDs that are less than or equal to 3, combining the IDs from both the driver and school_bus lists, but only showing each ID once?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 3 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 3


Question: Can you give me a list of driver IDs, including those that are exactly 12 from the driver table, and those that are 3 or less from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 12 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 3


Question: Can you give me the name, ID, and description of all clubs, excluding those with an ID of 4 or higher, but also excluding any clubs that either aren't named "Tennis Club", don't have a description of "A competitive tennis club.", or aren't located in "HHH"?

Refurbish computers; teach kids and adults about computer basics.

Venture capital fund for student business.

Pen and Paper Gaming
3
Play pen and paper games on campus.

SELECT ClubName, ClubID, ClubDesc FROM Club WHERE "ClubID" != 4 AND ClubName != "Tennis Club" OR ClubDesc != "A competitive tennis club." OR ClubLocation <> "HHH" EXCEPT SELECT ClubName, ClubID, ClubDesc FROM Club WHERE "ClubID" >= 4


Question: Which driver IDs are both not equal to 7 and also greater than or equal to 9?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 7 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 9


Question: Can you give me a list of aircraft IDs that are either aircraft ID 2 from the aircraft table or aircraft ID 5 from the airport_aircraft table?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID = 2 UNION SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID = 5


Question: Could you list the template type codes and descriptions that are both not "Paper" and have a template type code of "AD"?

SELECT Template_Type_Code, Template_Type_Description FROM Ref_Template_Types WHERE Template_Type_Description <> "Paper" INTERSECT SELECT Template_Type_Code, Template_Type_Description FROM Ref_Template_Types WHERE Template_Type_Code = "AD"


Question: Can you give me a list of driver IDs that are greater than 2, excluding those driver IDs that are also greater than 7 and appear in the school bus records?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 2 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 7


Question: Which driver IDs appear in the driver table, excluding driver ID 4, and also appear in the school_bus table only with driver ID 10?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 4 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID = 10


Question: Can you give me a list of employee IDs, including those who have worked with copy numbers other than 15, along with employee IDs from the employee table where either their other details are not "b", or their employee ID is 5 or greater and their role code is not "ED", or their name is "Clemens"?

SELECT employee_id FROM Circulation_History WHERE "copy_number" <> 15 UNION ALL SELECT employee_id FROM Employees WHERE other_details <> "b" OR "employee_id" >= 5 AND role_code <> "ED" OR employee_name = "Clemens"


Question: Can you give me the IDs of aircraft that are less than or equal to 1, excluding those aircraft IDs that are equal to 3 in the airport aircraft table?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <= 1 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID = 3


Question: Can you give me a list of driver IDs that are not equal to 8, excluding any driver IDs less than 9 that are also in the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 8 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 9


Question: Can you give me a list of driver IDs, including those from the driver table that are not 9, and those from the school bus table that are specifically 4?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 9 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID = 4


Question: Can you give me a list of driver IDs that are both greater than or equal to 10 and not equal to 3, considering only the driver IDs that appear in both the driver and school bus tables?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 10 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 3


Question: What aircraft IDs appear exactly once in the aircraft table with an ID of 4, but do not appear in the airport_aircraft table with an ID less than 3?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID = 4 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID < 3


Question: Can you give me a list of driver IDs that are not 5, and are also not driver IDs greater than 3 that are used on school buses?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 5 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 3


Question: Can you give me a list of member names, including those who don't have a Member ID of 1 and those who are from Louisville, Kentucky?

SELECT Name FROM member WHERE "Member_ID" != 1 UNION SELECT Name FROM member WHERE Hometown = "Louisville, Kentucky"


Question: Can you give me a list of driver IDs that are less than 12 from the driver table, combined with a list of driver IDs that are less than 7 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 12 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 7


Question: Can you give me a list of aircraft IDs that are less than 4, excluding any aircraft IDs that also appear in the airport aircraft list, except for aircraft ID 3?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID < 4 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID != 3


Question: Can you give me a list of driver IDs that are not equal to 1 from the driver table, but also less than or equal to 3 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 1 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 3


Question: Can you give me a list of driver IDs that are greater than 4, excluding any driver IDs that are not equal to 4 and are also in the school bus list?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 4 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 4


Question: Which aircraft IDs are both greater than or equal to 2 when grouped in the aircraft table, and equal to 5 when grouped in the airport_aircraft table?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID >= 2 INTERSECT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID = 5


Question: Can you give me a list of driver IDs, excluding driver ID 6, that are not also driver IDs less than 4 in the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 6 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 4


Question: Which driver IDs, excluding driver ID 12, are also driver IDs of school buses where the driver ID is 3?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 12 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID = 3


Question: Can you list the writers of books that either don't have the title "Bloody Mary : Lady Liberty", or have an "Issues" value greater than 1.0 and are not written by Howard Chaykin for books with a "Book_ID" of 2 or greater?

SELECT Writer FROM book WHERE Title != "Bloody Mary : Lady Liberty" OR "Issues" > 1.0 NOT IN (SELECT Writer FROM book WHERE "Book_ID" >= 2 AND Writer = "Howard Chaykin")


Question: Can you give me the Driver ID of drivers with ID 1, excluding any driver IDs greater than 10 that are also in the school bus list?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 1 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 10


Question: Which driver IDs are both not equal to 5 and less than or equal to 10?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 5 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 10


Question: Can you give me the Aircraft IDs that are both less than or equal to 1 when looking at the aircraft table and less than 2 when looking at the airport_aircraft table?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <= 1 INTERSECT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID < 2


Question: Can you give me a list of driver IDs that are greater than or equal to 1 from the driver table, excluding any driver IDs that are not equal to 4 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 1 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 4


Question: Can you give me a list of driver IDs, excluding driver ID 10, that are not also driver IDs greater than or equal to 3 in the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 10 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 3


Question: What is the smallest driver ID from all drivers with an ID of 1 or greater, excluding the smallest driver ID from school bus drivers who either have worked for a number of years other than 10 and are not associated with school ID 4, or are not full-time?

SELECT MIN(Driver_ID) FROM driver WHERE "Driver_ID" >= 1 EXCEPT SELECT MIN(Driver_ID) FROM school_bus WHERE "Driver_ID" < 3 AND "Years_Working" <> 10 AND "School_ID" != 4 OR If_full_time != "T"


Question: Can you give me the driver ID that appears exactly once as 8 in the driver table, but not in the school_bus table where the driver ID is 3 or greater?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 8 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 3


Question: Can you give me a list of driver IDs that are less than 3, excluding any driver IDs that are also 9 or greater and are associated with school buses?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 3 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 9


Question: Can you give me a list of driver IDs, including those from the driver table excluding ID 9, and those from the school bus table with IDs 9 or higher?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 9 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 9


Question: Can you give me a list of driver IDs, including those from the driver table excluding ID 9, and those from the school bus table with IDs of 7 or higher?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 9 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 7


Question: Can you give me a list of shipping agent codes from the Documents table where the document ID is less than 20, or the receipt date isn't May 31st, 1996 at 6:51:58 AM and the receipt number isn't 189, but excluding any shipping agent codes from the Ref_Shipping_Agents table where the shipping agent code isn't "FE" and the shipping agent name isn't "USPS"?

SELECT shipping_agent_code FROM Documents WHERE "document_id" < 20 OR receipt_date <> "1996-05-31 06:51:58" AND receipt_number <> "189" EXCEPT SELECT shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_code <> "FE" AND shipping_agent_name != "USPS"


Question: Can you give me a list of driver IDs, including those that are not equal to 1 from the driver table, and those that are equal to 3 from the school_bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 1 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID = 3


Question: Can you give me a list of driver IDs, excluding those equal to 7, that are greater than 8 and appear more than once in the driver table but not in the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 8 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 7


Question: Can you list the aircraft IDs that are greater than or equal to 3, excluding those aircraft IDs that are equal to 5 in the airport aircraft table?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID >= 3 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID = 5


Question: Can you give me a list of driver IDs, excluding driver ID 3, from the driver table, but only those driver IDs that are not in the school bus table where the driver ID is less than or equal to 3?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 3 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 3


Question: What is the average feature type name for feature types that are not security or are named "Securiyt, eg Burglar Alarm.", and also have a feature type code of "Amenity"?

SELECT AVG(feature_type_name) FROM Ref_Feature_Types WHERE feature_type_code <> "Security" OR feature_type_name = "Securiyt, eg Burglar Alarm." INTERSECT SELECT AVG(feature_type_name) FROM Ref_Feature_Types WHERE feature_type_code = "Amenity"


Question: Can you give me a list of driver IDs, excluding driver ID 10, that are not also driver IDs less than 10 found in the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 10 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 10


Question: Which driver has an ID of 4, but is not a driver with an ID less than 4 in the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 4 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 4


Question: Which driver IDs are both not equal to 5 and greater than 9, considering drivers from both the driver and school bus lists?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 5 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 9


Question: Can you give me a list of driver IDs that are either driver ID 8 from the driver table or driver IDs greater than 4 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 8 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 4


Question: Which aircraft IDs are both greater than 3 and also less than or equal to 5?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID > 3 INTERSECT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <= 5


Question: Can you give me the IDs of aircraft, excluding ID 11, that have a distance of 8430 or less, where the ID is greater than 10, but only if those IDs are not also found among aircraft that aren't named "Airbus A320" with a distance of 2128 and an ID of 6 or less?

SELECT aid FROM aircraft WHERE "aid" <> 11 AND "distance" <= 8430 GROUP BY aid HAVING aid > 10 EXCEPT SELECT aid FROM aircraft WHERE name <> "Airbus A320" AND "distance" = 2128 GROUP BY aid HAVING aid <= 6


Question: Which driver IDs, excluding 11, are also driver IDs of school buses where those IDs are 7 or greater?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 11 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 7


Question: Can you give me a list of driver IDs that are less than 4, but not if they are also driver IDs less than or equal to 4 in the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 4 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 4


Question: What is the average coach ID for coaches who are not male or have a rank greater than 2, combined with the average coach ID for player coaches who started in or before 2013 and have a player ID of 6 or less?

SELECT AVG(Coach_ID) FROM coach WHERE Gender <> "M" OR "Rank" > 2 UNION ALL SELECT AVG(Coach_ID) FROM player_coach WHERE "Starting_year" <= 2013 AND "Player_ID" <= 6


Question: Can you give me a list of driver IDs, including those from the driver table that aren't 5, and those from the school bus table that are 10?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <> 5 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID = 10