Question: Which driver IDs are both greater than 2 and also equal to 10?

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 = 10


Question: Can you give me a list of all the district IDs, including duplicates, where the store ID is not 1, and also include all district IDs where the store ID is not 2 or the district ID is 3 or less?

SELECT District_ID FROM store_district WHERE "Store_ID" <> 1 UNION ALL SELECT District_ID FROM store_district WHERE "Store_ID" <> 2 OR "District_ID" <= 3


Question: Can you give me a list of driver IDs, including those from the driver table where the ID is 3 or greater, 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 >= 3 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 9


Question: Can you tell me the name, minimum party affiliation, age, sum of driver IDs, and home city for all drivers named Henry Genga, excluding those with a Driver ID of 10, combined with the same information for all drivers who are not affiliated with the Dem party?

SELECT Name, MIN(Party), Age, SUM(Driver_ID), Home_city FROM driver WHERE "Driver_ID" != 10 AND Name = "Henry Genga" UNION ALL SELECT Name, MIN(Party), Age, SUM(Driver_ID), Home_city FROM driver WHERE Party != "Dem"


Question: Which driver IDs are not equal to 8 and are also less than or equal to 9?

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 <= 9


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

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 > 3


Question: Could you give me the draft numbers and document IDs that are both in the Document_Drafts table where the draft details are "k" or the draft number is less than or equal to 1 and the document ID is not 12, and also in the Draft_Copies table where the document ID is 10?

SELECT draft_number, document_id FROM Document_Drafts WHERE draft_details = "k" OR "draft_number" <= 1 AND "document_id" <> 12 INTERSECT SELECT draft_number, document_id FROM Draft_Copies WHERE "document_id" = 10


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 greater than 7?

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 > 7


Question: Could you give me a list of employee IDs from the circulation history where the copy number isn't 4, the document ID is 10, the draft number isn't 20, or the employee ID is 2 or greater, combined with the employee ID of anyone named Kenyon from the employees table?

SELECT employee_id FROM Circulation_History WHERE "copy_number" != 4 OR "document_id" = 10 OR "draft_number" <> 20 OR "employee_id" >= 2 UNION SELECT employee_id FROM Employees WHERE employee_name = "Kenyon"


Question: Can you give me the aircraft IDs that satisfy both of these conditions: first, the ID is less than or equal to 10, the distance is greater than 3383, or the name is Airbus A320, but the ID is not 9; and second, the distance is greater than 1805, the name is not Airbus A319, or the ID is not 5, and the ID is 3?

SELECT aid FROM aircraft WHERE "aid" <= 10 OR "distance" > 3383 OR name = "Airbus A320" GROUP BY aid HAVING aid <> 9 INTERSECT SELECT aid FROM aircraft WHERE "distance" > 1805 OR name != "Airbus A319" OR "aid" <> 5 GROUP BY aid HAVING aid = 3


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

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 = 10


Question: Which driver IDs, other than driver ID 4, are in the driver table but not 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 greater than or equal to 2 and also less than or equal to 7, considering only the unique driver IDs from the driver and school_bus tables?

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 <= 7


Question: Can you list all the "Other Details" from documents that have "None" as their other details, a Document ID of 82, and the name "How to write a CV", combined with all the "Other Details" from paragraphs that either don't have "None" as their other details, have a Document ID less than or equal to 80, or have paragraph text that is not "Ukraine"?

SELECT Other_Details FROM Documents WHERE Other_Details = "None" AND "Document_ID" = 82 AND Document_Name = "How to write a CV" UNION ALL SELECT Other_Details FROM Paragraphs WHERE Other_Details <> "None" OR "Document_ID" <= 80 OR Paragraph_Text <> "Ukraine"


Question: Can you give me a list of driver IDs, up to and including 9, that are in the driver table but not in the school bus table, where the school bus table only includes driver ID 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: Which aircraft IDs, excluding ID 4, are present in the aircraft table and also, excluding ID 5, are present in the airport_aircraft table?

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 <> 5


Question: Which driver IDs, excluding driver ID 11, are also driver IDs excluding driver ID 7 in the school bus list?

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: What grades, types, and schools are both not "St. Francis Assisi" and also not "Public" and not "State Elementary School Menteng 01"?

Freshman–Sophomore year
Private
Occidental College

Junior–Senior year
Private
Columbia University

SELECT Grade, Type, School FROM school WHERE School != "St. Francis Assisi" INTERSECT SELECT Grade, Type, School FROM school WHERE Type <> "Public" AND School <> "State Elementary School Menteng 01"


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

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 the joining date, last name, nickname, staff ID, staff address ID, first name, and leaving date for all staff members, including those whose nickname isn't norma73 or whose birthdate isn't April 27, 1998 at 12:55:05, as well as those whose first name isn't Titus or whose address ID isn't 1, last name isn't Mertz, and middle name isn't Stephania?

SELECT date_joined_staff, last_name, nickname, staff_id, staff_address_id, first_name, date_left_staff FROM Staff WHERE nickname <> "norma73" OR date_of_birth <> "1998-04-27 12:55:05" UNION SELECT date_joined_staff, last_name, nickname, staff_id, staff_address_id, first_name, date_left_staff FROM Staff WHERE first_name != "Titus" OR "staff_address_id" <> 1 AND last_name != "Mertz" AND middle_name <> "Stephania"


Question: Can you give me the sum of the maximum disk loading, the maximum gross weight, the count of the total disk area, the sum of aircraft, the count of descriptions, and the aircraft ID for all aircraft, first excluding aircraft ID 3, and then separately for only aircraft with ID 4 that are not "CH-53E Super Stallion"?

SELECT SUM(Max_disk_Loading), MAX(Max_Gross_Weight), COUNT(Total_disk_area), SUM(Aircraft), COUNT(Description), Aircraft_ID FROM aircraft WHERE "Aircraft_ID" <> 3 UNION ALL SELECT SUM(Max_disk_Loading), MAX(Max_Gross_Weight), COUNT(Total_disk_area), SUM(Aircraft), COUNT(Description), Aircraft_ID FROM aircraft WHERE "Aircraft_ID" = 4 AND Aircraft <> "CH-53E Super Stallion"


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

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 <= 7


Question: Can you give me a list of driver IDs, including those from the driver table that are not 5, and those from the school_bus table that are 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 list all the Shop IDs and Start From dates from the hiring table, including entries where the Employee ID is not 1 or the Start From date is not 2003, and also including entries where the Start From date is not 2003, or the Employee ID is 7 or less, or the Shop ID is not 6?

SELECT Shop_ID, Start_from FROM hiring WHERE "Employee_ID" <> 1 OR Start_from != "2003" UNION ALL SELECT Shop_ID, Start_from FROM hiring WHERE Start_from != "2003" OR "Employee_ID" <= 7 OR "Shop_ID" <> 6


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

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: Can you give me the driver ID that is equal to 12, excluding any driver IDs 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 = 12 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, combining those from the driver table that are greater than 7 with those from the school_bus table that are not equal to 9?

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 <> 9


Question: What aircraft IDs, excluding ID 4, are present in the aircraft table and also, excluding ID 2, are present in the airport_aircraft table?

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: Which driver IDs are not equal to 7 and are also not equal to 4?

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 != 4


Question: Can you give me the IDs of drivers that are less than or equal to 1, excluding those with an ID of 4 who are also school bus drivers?

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, including those from the driver table excluding driver ID 5, and those from the school bus table that are less than 9?

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 < 9


Question: Can you tell me the alphabetically first aircraft name, excluding "Schwitzer 2-33" where the aircraft ID isn't 3 or the distance is greater than 520, combined with the alphabetically first employee name where the salary isn't 256481 or the name is "James Smith"?

SELECT MIN(name) FROM aircraft WHERE name <> "Schwitzer 2-33" AND "aid" != 3 OR "distance" > 520 UNION SELECT MIN(name) FROM employee WHERE "salary" <> 256481 OR name = "James Smith"


Question: Can you give me a list of driver IDs that are less than 10 from the driver table, combined with a list of driver IDs that are less than or equal to 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: Could you give me a list of driver IDs, including driver ID 2 from the driver table and driver ID 10 from the school_bus table?

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 = 10


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

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: Which driver IDs are both less than 12 and also greater than 9?

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 > 9


Question: Which driver IDs are both not equal to 4 and greater than 9, considering only unique driver IDs from 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 greater than 7, and those from the school bus table that are not equal to 7?

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 != 7


Question: Which driver IDs are both greater than or equal to 2 and also not equal to 7, considering only unique driver IDs from the driver and school_bus tables?

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 != 7


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 not equal to 7?

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 <> 7


Question: Can you give me a list of driver IDs from the driver table that are greater than or equal to 5, excluding any 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 >= 5 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 4


Question: Could you list the car makers from the car_makers table that are either "renault" or not from country "8" and have an "Id" of 6 and a FullName of "Chrysler", but exclude any car makers that also appear in the model_list table with a model that isn't "cadillac"?

SELECT Maker FROM car_makers WHERE Maker = "renault" OR Country != "8" AND "Id" = 6 AND FullName = "Chrysler" EXCEPT SELECT Maker FROM model_list WHERE Model != "cadillac"


Question: Which driver has an ID of 7 and is not a school bus driver with an ID other than 7?

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 != 7


Question: Can you list the rank and club ID for coaches who are either not female or not named Smith Brown, and whose coach ID is not 5, and have a rank of 2, or have a club ID greater than 1, combined with the rank and club ID for match results where bronze is at least 7, small silver is less than 16, and rank is at most 3, or gold is less than 20, or big silver is at least 7, or club ID is at least 3?

SELECT Rank, Club_ID FROM coach WHERE Gender != "F" OR Coach_name != "Smith Brown" AND "Coach_ID" != 5 AND "Rank" = 2 OR "Club_ID" > 1 UNION SELECT Rank, Club_ID FROM match_result WHERE "Bronze" >= 7 AND "Small_Silver" < 16 AND "Rank" <= 3 OR "Gold" < 20 OR "Big_Silver" >= 7 OR "Club_ID" >= 3


Question: Which driver IDs appear in both the driver table where the ID is 10 and the school_bus table where the ID is greater than 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 not equal to 1, but only if those driver IDs are not also greater than or equal to 7 in 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 >= 7


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

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 people in the employment table have IDs greater than or equal to 2, work for company 17, and have worked for at least 2 years, plus how many people in the people table either aren't ID 7, aren't from the United States, aren't named Jerry Corcoran, and graduated from California, or are younger than 37?

SELECT COUNT(People_ID) FROM employment WHERE "People_ID" >= 2 AND "Company_ID" = 17 AND "Year_working" >= 2 UNION ALL SELECT COUNT(People_ID) FROM people WHERE "People_ID" != 7 AND Nationality != "United States" AND Name <> "Jerry Corcoran" AND Graduation_College = "California" OR "Age" < 37


Question: Can you give me a list of driver IDs, excluding driver ID 6, that are not also on a list of driver IDs less than or equal to 3 from 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 <= 3


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

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 > 3


Question: What aircraft IDs are present in the aircraft table, excluding ID 4, and also present in the airport_aircraft table with IDs less than 3?

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 < 3


Question: Can you list the aircraft IDs from the aircraft table, including only those less than or equal to 5, and combine that with a list of aircraft IDs from the airport_aircraft table, including only those that are not equal to 1?

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: Can you give me a list of driver IDs, including those from the driver table that are greater than 7 and those from the school bus table that are not equal to 10?

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 <> 10


Question: Which driver IDs are both greater than or equal to 10 in the driver list and greater than 7 in the school bus list?

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 a list of driver IDs, including those from the driver table where the ID is not 9, and those from the school bus table where the ID is 3 or less?

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 <= 3


Question: Can you list the aircraft IDs, excluding aircraft ID 4, that are present in the aircraft table but not in the airport_aircraft table where the aircraft ID is 5 or greater?

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, including driver ID 9 and any driver IDs from the school bus list that are greater than 3?

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 > 3


Question: Can you give me the names that appear in both of these lists: one where the name isn't Jeff Maggert and the age is under 69, and another where the person wasn't born in Connecticut and is named Sergio García, or their age is 69 or less?

SELECT name FROM head WHERE name != "Jeff Maggert" AND "age" < 69.0 INTERSECT SELECT name FROM head WHERE born_state != "Connecticut" AND name = "Sergio García" OR "age" <= 69.0


Question: Which driver IDs are both less than or equal to 10 and equal to 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: Which driver IDs are both less than 11 and also equal to 3?

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 = 3


Question: Can you give me a list of driver IDs that are greater than 2, but exclude any driver IDs that are equal to 3 from 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 = 3


Question: Can you give me the school IDs for schools that either have "Redskins" as their mascot and aren't named "Culver Community," or are not located in "Walkerton" and have a school ID other than "1," along with the school IDs from the budget table where the invested amount is less than 95542 and the budget invested percentage is "127.6"?

SELECT School_id FROM School WHERE Mascot = "Redskins" AND School_name != "Culver Community" OR Location != "Walkerton" AND School_id <> "1" UNION ALL SELECT School_id FROM budget WHERE "Invested" < 95542 AND Budget_invested_percent = "127.6"


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

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 the IDs of drivers with IDs less than or equal to 5, excluding the IDs of school bus drivers with IDs less than or equal to 9?

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: What aircraft IDs are both greater than or equal to 2 in the aircraft table and not equal to 1 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 != 1


Question: Can you tell me the smallest number of beds, the largest room name, and the count of maximum occupancy, all grouped by bed type, for rooms where either the room ID isn't "RTE" and the room name isn't "Thrift and accolade", or the number of beds isn't 2 and the maximum occupancy is at least 4, combined with the same information for rooms where either the maximum occupancy is greater than 2 and the number of beds isn't 2, or the room ID isn't "HBB" and the base price is 175?

bedType MIN(beds) MAX(roomName) COUNT(maxOccupancy)

SELECT bedType, MIN(beds), MAX(roomName), COUNT(maxOccupancy) FROM Rooms WHERE RoomId <> "RTE" AND roomName <> "Thrift and accolade" OR "beds" != 2 AND "maxOccupancy" >= 4 UNION ALL SELECT bedType, MIN(beds), MAX(roomName), COUNT(maxOccupancy) FROM Rooms WHERE "maxOccupancy" > 2 AND "beds" <> 2 OR RoomId <> "HBB" AND "basePrice" = 175


Question: Could you list all the document type codes that are "CD", along with all the document type codes from the reference table that either have a description of "u" or a code of "CD"?

SELECT document_type_code FROM Documents WHERE document_type_code = "CD" UNION ALL SELECT document_type_code FROM Ref_Document_Types WHERE document_type_description = "u" OR document_type_code = "CD"


Question: Can you list all the driver IDs that are greater than or equal to 3 from the driver table, combined with all the driver IDs that are greater than or equal to 4 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 >= 4


Question: Can you give me a list of city codes for students who either have the first name Charles, or are not 17 years old and live in PEK and don't have the last name Jones, or are not male, or whose major is not greater than 600 and StuID is not greater than 1020; combined with city codes for students who don't have the last name Adams, or don't have the first name Paul, or are not 22 years old and have a StuID greater than 1001, or don't live in NYC, or don't have 8772 as their advisor, or are not male?

SELECT city_code FROM Student WHERE Fname = "Charles" OR "Age" != 17 AND city_code = "PEK" AND LName != "Jones" OR Sex <> "M" OR "Major" <= 600 AND "StuID" <= 1020 UNION SELECT city_code FROM Student WHERE LName != "Adams" OR Fname != "Paul" OR "Age" != 22 AND "StuID" > 1001 OR city_code <> "NYC" OR "Advisor" != 8772 OR Sex <> "M"


Question: Which driver IDs, excluding driver ID 6, are not also driver IDs of school buses where the driver ID is less than 9?

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 a list of driver IDs, including driver ID 9 from the driver table, and any driver IDs greater than or equal to 4 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 >= 4


Question: Can you list the driver IDs that are less than or equal to 11 from the driver table, and combine that with a list of driver IDs that are less than or equal to 4 from the school bus table, 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 <= 4


Question: What is the highest document ID from the circulation history where the copy number is 4 and the draft number is 20 or less, combined with the highest document ID from the documents table where the receipt date is April 17, 1999 at 2:19:32 PM, the document status is overdue, and the receipt number is 69?

SELECT MAX(document_id) FROM Circulation_History WHERE "copy_number" = 4 AND "draft_number" <= 20 UNION SELECT MAX(document_id) FROM Documents WHERE receipt_date = "1999-04-17 14:19:32" AND document_status_code = "overdue" AND receipt_number = "69"


Question: Which driver has the ID 6, but is not a driver with an ID other than 9 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 <> 9


Question: Can you give me a list of driver IDs that are greater than 1, excluding those driver IDs that are less than or equal to 10 and 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: Can you give me a list of driver IDs from the driver table where each ID is less than or equal to 8, combined with a list of driver IDs from the school_bus table where the ID is exactly 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, excluding driver ID 10, that are in the driver table but not in the school_bus table, where we also exclude driver ID 9 from 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 != 9


Question: Which driver IDs are both not equal to 2 and greater than 9, considering only unique driver IDs from the driver and school_bus tables?

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 > 9


Question: Can you give me a list of driver IDs that are 10 or greater from the driver table, 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 >= 10 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 7


Question: What is the highest working year for company IDs up to 15 and people IDs up to 4, specifically when the working year is 1, excluding the highest working years that are 3 or greater?

SELECT MAX(Year_working) FROM employment WHERE "Company_ID" <= 15 AND "People_ID" <= 4 AND "Year_working" = 1 EXCEPT SELECT MAX(Year_working) FROM employment WHERE "Year_working" >= 3


Question: Can you give me the city, building number, and address ID for all addresses in the USA that are not in West Virginia and do not have the building number "3904 Stroman Passage", combined with the city, building number, and address ID for all addresses with zip code "14445" that are not in Buckridgehaven or in the USA, or that do not have the building number "9260 Streich Mountain"?

Damianfort
4834 Schaefer Light Suite 947
14

Ericamouth
43235 Jazmin Mountain Suite 251
13

Lake Rafaela
29085 Dejah Pine Suite 059
8

Lockmanfurt
56461 Baumbach Well Suite 634
7

South Eugene
37698 Hahn Curve Apt. 572
11

West Edmondview
9260 Streich Mountain
15

SELECT city, line_1_number_building, address_id FROM Addresses WHERE state_province_county <> "WestVirginia" AND line_1_number_building != "3904 Stroman Passage" AND country = "USA" UNION SELECT city, line_1_number_building, address_id FROM Addresses WHERE zip_postcode = "14445" AND city <> "Buckridgehaven" AND country <> "USA" OR line_1_number_building != "9260 Streich Mountain"


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

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 >= 10


Question: Can you give me a list of driver IDs that appear in the driver table, excluding driver ID 2, but also excluding any driver IDs that appear in the school_bus table and are greater than or equal to 3?

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 >= 3


Question: Can you give me a list of driver IDs, excluding driver ID 1 from the driver table and driver ID 10 from the school_bus table, showing each unique driver ID only once?

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 <> 10


Question: Could you give me a list of member IDs that meet these conditions: either the member's name isn't Braxton Kelley, or they're from Hiram, Georgia and their member ID is greater than 9, or their level isn't 6, or their card number isn't MLB4; and also meet these conditions: their member ID is less than or equal to 8, or their branch ID isn't 1 and the register year isn't 2016?

SELECT Member_ID FROM member WHERE Name <> "Braxton Kelley" OR Hometown = "Hiram, Georgia" AND "Member_ID" > 9 OR "Level" != 6 OR Card_Number != "MLB4" INTERSECT SELECT Member_ID FROM membership_register_branch WHERE "Member_ID" <= 8 OR Branch_ID != "1" AND Register_Year <> "2016"


Question: What aircraft IDs are not equal to 2 and are also greater than or equal to 1?

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 >= 1


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

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 < 9


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 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: Could you give me a list of driver IDs from the driver table that are greater than or equal to 10, excluding any driver IDs that are equal to 9 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 = 9


Question: Can you give me a list of driver IDs less than or equal to 7, excluding any driver IDs that are not equal to 10 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 <> 10


Question: Could you list the driver IDs that are greater than or equal to 7, and also list the driver IDs from the school bus table that are less than 10?

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 < 10


Question: Can you give me a list of driver IDs that are greater than 4, excluding those driver IDs that are also greater than 9 and appear 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 > 9


Question: Could you please provide the template details, version number, template ID, template type code, and effective date from the Templates table, combining two sets of results? The first set should include entries where the template type code is not "BK", or where the effective date is not "1975-05-20 22:51:19", and the template ID is less than 7, and the version number is 2. The second set should include entries where the template ID is less than or equal to 21, or the template details are empty, or the version number is greater than or equal to 7, or the expiry date is not "1989-11-24 19:06:06" and the effective date is not "1975-05-20 22:51:19"?

SELECT Template_Details, Version_Number, Template_ID, Template_Type_Code, Date_Effective_From FROM Templates WHERE Template_Type_Code <> "BK" OR Date_Effective_From != "1975-05-20 22:51:19" AND "Template_ID" < 7 AND "Version_Number" = 2 UNION SELECT Template_Details, Version_Number, Template_ID, Template_Type_Code, Date_Effective_From FROM Templates WHERE "Template_ID" <= 21 OR Template_Details = "" AND "Version_Number" >= 7 OR Date_Effective_To != "1989-11-24 19:06:06" AND Date_Effective_From <> "1975-05-20 22:51:19"


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

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 != 10


Question: Can you give me a list of aircraft IDs, excluding aircraft ID 2, that are not also aircraft IDs, excluding aircraft ID 5, found 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 a list of driver IDs, excluding driver ID 8, that are not also driver IDs less than 7 found 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 location and enrollment for all schools that don't have "Jimmies" as their mascot, combined with the location and enrollment for schools that are either in football class A and are not named "Jimtown" and don't have "Lions" as their mascot, or are not in class AAA and don't have an ID of "1"?

SELECT Location, Enrollment FROM School WHERE Mascot <> "Jimmies" UNION SELECT Location, Enrollment FROM School WHERE IHSAA_Football_Class = "A" AND School_name <> "Jimtown" AND Mascot != "Lions" OR IHSAA_Class != "AAA" AND School_id <> "1"


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

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 = 3


Question: Can you give me a list of driver IDs, excluding driver ID 8, that are not also driver IDs greater than or equal to 10 found 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 >= 10


Question: Can you show me the full-time status, the lowest driver ID, years working, and school ID for all school bus drivers who are not full-time, combined with the same information for all drivers where the school ID is less than 7?

SELECT If_full_time, MIN(Driver_ID), Years_Working, School_ID FROM school_bus WHERE If_full_time <> "T" UNION SELECT If_full_time, MIN(Driver_ID), Years_Working, School_ID FROM school_bus WHERE "School_ID" < 7


Question: Can you give me a list of driver IDs, including driver ID 4 from the driver table, and all driver IDs less than or equal to 3 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 <= 3


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

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 tell me, for each department, the number of heads and the earliest temporary acting status, considering both cases where the head ID is not 5 or the temporary acting status is not "Yes", and also cases where the temporary acting status is not "Yes" or the head ID is 4 or less?

SELECT COUNT(head_ID), MIN(temporary_acting), department_ID FROM management WHERE "head_ID" != 5 OR temporary_acting != "Yes" UNION SELECT COUNT(head_ID), MIN(temporary_acting), department_ID FROM management WHERE temporary_acting <> "Yes" OR "head_ID" <= 4


Question: Which driver IDs, that are at least 9 or higher, are present in both the driver list and 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 >= 9


Question: Which aircraft IDs, excluding ID 2, are also aircraft ID 5 in the airport?

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 that are either exactly 6 from the driver table, or greater than or equal to 4 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 >= 4


Question: Can you give me a list of driver IDs that are greater than 4, where each ID appears at least once in the driver table, excluding any driver IDs greater than 3 that appear at least once 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 > 3


Question: Can you give me a list of aircraft IDs that either have a distance of 6441 or less and an ID of 5 or greater, or have a name that isn't Airbus A340-300, combined with a list of certificate IDs that are not 13?

SELECT aid FROM aircraft WHERE "distance" <= 6441 AND "aid" >= 5 OR name <> "Airbus A340-300" UNION SELECT aid FROM certificate WHERE "aid" != 13


Question: Could you list the cities that are both headquartered in Bahawalnagar City, have a city population of at least 172073, or are in Dera Ghazi Khan District or have a District ID greater than 8, and also have a District ID greater than 12, or are not in Chiniot District, or have a city area of at least 147, or have a city population of at most 365198?

SELECT Headquartered_City FROM district WHERE Headquartered_City = "Bahawalnagar City" AND "City_Population" >= 172073.0 AND District_name = "Dera Ghazi Khan District" OR "District_ID" > 8 INTERSECT SELECT Headquartered_City FROM district WHERE "District_ID" > 12 OR District_name <> "Chiniot District" OR "City_Area" >= 147.0 OR "City_Population" <= 365198.0


Question: Can you list all the aircraft IDs, first from the aircraft table excluding aircraft ID 5, and then from the airport_aircraft table including only aircraft IDs greater than or equal to 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 11 or greater, excluding any driver IDs that appear in the school_bus table and are greater than 3?

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 > 3


Question: Which driver IDs appear in the driver table, excluding driver ID 9, but do not appear in the school_bus table for driver IDs greater than or equal to 9?

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 points from the match results where the rank isn't 1, the big silver isn't 11, the small silver isn't 10, and the points are at least 139, combined with the points from match results where either the gold is less than 13 and the bronze is at least 8, or the big silver is at least 7 and the points are exactly 89 and the club ID is less than 6, or the rank is at most 4?

SELECT Points FROM match_result WHERE "Rank" != 1 AND "Big_Silver" != 11 AND "Small_Silver" <> 10 AND "Points" >= 139 UNION SELECT Points FROM match_result WHERE "Gold" < 13 AND "Bronze" >= 8 OR "Big_Silver" >= 7 AND "Points" = 89 AND "Club_ID" < 6 OR "Rank" <= 4


Question: Can you give me the address IDs that are both not equal to 8 and greater than or equal to 1, and also have address details that are not "IE"?

SELECT address_id FROM Addresses WHERE "address_id" <> 8 AND address_details != "IE" INTERSECT SELECT address_id FROM Addresses WHERE "address_id" >= 1 AND address_details != "IE"


Question: Can you list the aircraft IDs, including those from the aircraft table that are greater than or equal to 4, and those from the airport_aircraft table that are less 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: Can you list the allergy types where the allergy is milk, or the allergy type is not food and also not an allergy type where the allergy type is not food or the allergy is not nuts?

SELECT AllergyType FROM Allergy_Type WHERE Allergy = "Milk" OR AllergyType != "food" NOT IN (SELECT AllergyType FROM Allergy_Type WHERE AllergyType != "food" OR Allergy != "Nuts")


Question: Could you list the member IDs of those who registered in years other than 2016, excluding those who registered with branch ID 4 in years other than 2016?

SELECT Member_ID FROM membership_register_branch WHERE Register_Year <> "2016" EXCEPT SELECT Member_ID FROM membership_register_branch WHERE Branch_ID = "4" AND Register_Year <> "2016"


Question: Can you give me the customer ID, staff ID, lesson status code, and lesson ID from the Lessons table, including all records that meet at least one of these conditions: either the staff ID is less than 12, or the lesson time is 9 and the lesson status is not Cancelled, or the lesson date is 2018-02-28 10:55:36 and the customer ID is 13, or the vehicle ID is greater than or equal to 1 and the price is not 277.0, or the lesson ID is greater than 14, combined with all records where either the lesson time is not 6, or the price is 306.0 and the lesson date is not 2018-03-17 19:02:07 and the staff ID is not 5 and the customer ID is greater than or equal to 10?

SELECT customer_id, staff_id, lesson_status_code, lesson_id FROM Lessons WHERE "staff_id" < 12 OR lesson_time = "9" AND lesson_status_code != "Cancelled" OR lesson_date = "2018-02-28 10:55:36" AND "customer_id" = 13 OR "vehicle_id" >= 1 AND "price" <> 277.0 OR "lesson_id" > 14 UNION ALL SELECT customer_id, staff_id, lesson_status_code, lesson_id FROM Lessons WHERE lesson_time != "6" OR "price" = 306.0 AND lesson_date <> "2018-03-17 19:02:07" AND "staff_id" <> 5 AND "customer_id" >= 10


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

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 = 9


Question: Can you list all the driver IDs from the driver table that are less than or equal to 5, and combine that with a list of all 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 <= 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 from the driver table that are greater than or equal to 1, excluding driver ID 9 if it appears in 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 = 9


Question: Can you show me the source user ID and trust values from the trust table, excluding entries where the source user ID is 7 and including only those where the target user ID is at least 2, combined with all source user IDs and trust values where the source user ID is 1, or the target user ID is at least 5, or the trust value is greater than 10?

SELECT source_u_id, trust FROM trust WHERE "source_u_id" <> 7 AND "target_u_id" >= 2 UNION ALL SELECT source_u_id, trust FROM trust WHERE "source_u_id" = 1 OR "target_u_id" >= 5 OR "trust" > 10


Question: Which aircraft have an ID of 5, excluding any aircraft that also have an ID less than or equal to 2 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 <= 2


Question: Can you give me a list of driver IDs, including those with the ID 11 from the driver table, and those with IDs less than 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 list the populations of counties, excluding those with a population of 79000, a County ID of 3, or the name Mansfield, but then remove any populations that also exist in counties that don't have a population of 21000, are named Manning, have a zip code that isn't D09, or have a County ID less than or equal to 1?

SELECT Population FROM county WHERE "Population" <> 79000.0 OR "County_Id" <> 3 OR County_name != "Mansfield" EXCEPT SELECT Population FROM county WHERE "Population" != 21000.0 AND County_name = "Manning" OR Zip_code != "D09" OR "County_Id" <= 1


Question: Can you list all driver IDs from the driver table that are greater than or equal to 3, and combine that with a list of all driver IDs from the school_bus table that are not equal to 9?

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 <> 9


Question: Can you give me a list of driver IDs that are not equal to 2 from the driver table, but only include those driver IDs that are also less than 9 from the school bus table?

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 < 9


Question: Can you list all the driver IDs from the driver table that are less than 6, and combine that with a list of all driver IDs from the school bus table that are less than or equal to 9, removing 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 <= 9


Question: Can you give me a list of driver IDs that are less than 7 and are also driver IDs of school bus drivers that are less than or equal to 7?

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 4, that are not also driver IDs, excluding driver ID 7, found 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 != 7


Question: Which driver IDs are both less than 7 and also greater than 3?

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: Could you list the aircraft IDs that are greater than or equal to 4 from the aircraft table, and combine that with a list of aircraft IDs that are greater than or equal to 5 from the airport_aircraft table, removing any duplicates?

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 >= 5


Question: Can you give me a list of 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 not 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 the ID, city, and country for all airports that meet either of these conditions: they're not KBOS, don't have an ID of 3, aren't in Boston, and aren't named Akureyri Airport, or they are in Belgium; or they're not EHAM, or have an IATA code of AMS and aren't named Akureyri Airport and are in Barcelona, or have an ID of 9, or are in Belgium?

SELECT id, City, Country FROM airport WHERE ICAO <> "KBOS" AND "id" <> 3 AND City <> "Boston" AND name <> "Akureyri Airport" OR Country = "Belgium" UNION SELECT id, City, Country FROM airport WHERE ICAO != "EHAM" OR IATA = "AMS" AND name != "Akureyri Airport" AND City = "Barcelona" OR "id" = 9 OR Country = "Belgium"


Question: Can you list the aircraft IDs that are greater than 3, excluding any aircraft IDs that are also equal to 2 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 = 2


Question: Can you give me a list of driver IDs, including those from the driver table that are less than or equal to 4, 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 <= 4 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 7, and those from the school bus table excluding ID 10?

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 != 10


Question: Can you give me a list of driver IDs, including all driver IDs from the driver table that are not 9, and also including driver ID 4 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 = 4


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 from the school bus table that are not equal to 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, excluding driver ID 3, that are not also driver ID 4 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 = 4


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

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 <= 4


Question: Which driver has an ID of 7 and also drives a school bus, but not one with an ID of 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 driver IDs, excluding driver ID 5, that are not also driver IDs greater than or equal to 7 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 >= 7


Question: Could you list all Branch IDs that are either "1" from the membership register branch, or from the purchase table where the total pounds are at least 20.99, or the Branch ID is not "3" and the year is not "2018"?

SELECT Branch_ID FROM membership_register_branch WHERE Branch_ID = "1" UNION ALL SELECT Branch_ID FROM purchase WHERE "Total_pounds" >= 20.99 OR Branch_ID <> "3" AND Year <> "2018"


Question: Can you give me a list of employee names and shop names, where the employee ID is 3 or less, combined with shop names where the number of products isn't 10000, or the location isn't Valkeakoski and the name isn't FC Honka, or the manager's name isn't Tommi Kautonen, or the shop ID isn't 7 and the district isn't Wiklöf Holding Arena?

SELECT Name FROM employee WHERE "Employee_ID" <= 3 UNION ALL SELECT Name FROM shop WHERE "Number_products" <> 10000 OR Location <> "Valkeakoski" AND Name != "FC Honka" OR Manager_name <> "Tommi Kautonen" OR "Shop_ID" != 7 AND District != "Wiklöf Holding Arena"


Question: Can you give me the total earnings, average player ID, sum of best finishes, money rank, and the lowest people ID, along with the final table appearances for poker players, combining two sets of players: first, those whose best finish is less than 1, people ID is less than 6, earnings are no more than 189233, or those who have made a final table other than 10 times and have a player ID less than 4, or whose money rank is not 68; and second, those whose best finish is not 1, player ID is more than 2 and people ID is not 2, earnings are no more than 189233, or money rank is no more than 166?

SELECT Final_Table_Made, Earnings, AVG(Poker_Player_ID), SUM(Best_Finish), Money_Rank, MIN(People_ID) FROM poker_player WHERE "Best_Finish" < 1.0 OR "People_ID" < 6 OR "Earnings" <= 189233.0 OR "Final_Table_Made" <> 10.0 AND "Poker_Player_ID" < 4 OR "Money_Rank" <> 68.0 UNION SELECT Final_Table_Made, Earnings, AVG(Poker_Player_ID), SUM(Best_Finish), Money_Rank, MIN(People_ID) FROM poker_player WHERE "Best_Finish" <> 1.0 OR "Poker_Player_ID" > 2 AND "People_ID" != 2 OR "Earnings" <= 189233.0 OR "Money_Rank" <= 166.0


Question: Can you give me a list of driver IDs that are greater than or equal to 1 from the driver table, excluding 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 that are less than 10 from the driver table, combined with a list of driver IDs that are 3 or greater 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 >= 3


Question: Could you give me the IDs of airlines that both have certificates with ID 1 and an employee ID less than or equal to 269734834, and also have flights arriving on "04/12/2005 12:02" with a flight number less than or equal to 7, where the airline ID is not 6 or the price is less than or equal to 780.99?

SELECT aid FROM certificate WHERE "aid" = 1 AND "eid" <= 269734834 INTERSECT SELECT aid FROM flight WHERE arrival_date = "04/12/2005 12:02" AND "flno" <= 7 AND "aid" != 6 OR "price" <= 780.99


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 that are equal to 3 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 = 3


Question: Can you list the Aircraft IDs from the aircraft table that are less than or equal to 4, and also include the Aircraft ID from the airport_aircraft table that is equal to 5?

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 = 5


Question: Can you list all the driver IDs, first from the driver table excluding driver ID 2, and then from the school bus table including only driver IDs up to 3, removing any duplicates?

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 <= 3


Question: Can you give me the IDs of drivers with an ID of 3 or less, excluding those driver IDs that are also associated with school buses and are less than 7?

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 less than or equal to 8, excluding those driver IDs that are also greater than or equal to 4 in the school bus list?

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 >= 4


Question: Can you give me a list of aircraft IDs that are less than 3, excluding any aircraft IDs from the airport aircraft list that are not equal to 2?

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 driver IDs that are both less than or equal to 12 and also greater than 3, considering only the unique driver IDs from the driver and school bus tables?

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 give me a list of driver IDs from the driver table that are less than or equal to 8, combined with a list of driver IDs from the school_bus table that are less than or equal to 7?

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 <= 7


Question: Can you give me a list of driver IDs, including those from the driver table excluding driver ID 2, and those from the school bus table where the driver ID is greater 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, including those from the driver table that are 4 or greater, and those from the school bus table that are less than 10?

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 < 10


Question: Can you list all the continents named "America", and also list the continents of all countries except the USA where the CountryId is not 10 and the Continent is greater than or equal to 3?

SELECT Continent FROM continents WHERE Continent = "america" UNION ALL SELECT Continent FROM countries WHERE CountryName <> "usa" AND "CountryId" != 10 AND "Continent" >= 3


Question: Can you tell me, for each country, the number of addresses with a building number, the number of cities, the sum of the address IDs, but only if the number of addresses with a building number is exactly 15 or the number of cities is not 15; and also, can you tell me the same information for each country, but only if the number of addresses with a building number is exactly 15 or the sum of the address IDs is not 120 and the number of cities is greater than 15, combining the results into a single list?

SELECT COUNT(line_1_number_building), COUNT(city), SUM(address_id), country FROM Addresses GROUP BY country HAVING COUNT(line_1_number_building) = 15 OR COUNT(city) != 15 UNION SELECT COUNT(line_1_number_building), COUNT(city), SUM(address_id), country FROM Addresses GROUP BY country HAVING COUNT(line_1_number_building) = 15 OR SUM(address_id) <> 120 AND COUNT(city) > 15


Question: Could you list the club IDs from the club table where the start year is not 1998 and the club ID is less than or equal to 1, or where the club name is not Halmstads BK, combined with the club IDs from the coach table where the rank is greater than or equal to 4?

SELECT Club_ID FROM club WHERE "Start_year" <> 1998 AND "Club_ID" <= 1 OR Club_name <> "Halmstads BK" UNION SELECT Club_ID FROM coach WHERE "Rank" >= 4


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

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 >= 3


Question: Can you give me a list of driver IDs that are greater than or equal to 4, excluding any driver IDs 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 >= 4 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 4


Question: Can you give me a list of member IDs for members with card number RE95 or who don't live in Hiram, Georgia, combined with a list of member IDs from the membership register branch that are greater than 4?

SELECT Member_ID FROM member WHERE Card_Number = "RE95" OR Hometown <> "Hiram, Georgia" UNION SELECT Member_ID FROM membership_register_branch WHERE "Member_ID" > 4


Question: Can you give me a list of driver IDs that are less than 7 from the driver table, combined with a list of driver IDs that are 9 or less 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 <= 9


Question: Can you give me the price, flight number, arrival date, destination, distance, and aircraft ID for flights where the price is no more than $278.56, but only if they also have a price that isn't $278.56, or a distance of 7487 miles or less, or a destination other than Honolulu, or an arrival date of 04/12/2005 at 11:10 AM, or a flight number that isn't 99 and an aircraft ID of 9 or greater, and an origin other than Los Angeles?

price flno arrival_date destination distance aid

SELECT price, flno, arrival_date, destination, distance, aid FROM flight WHERE "price" <= 278.56 INTERSECT SELECT price, flno, arrival_date, destination, distance, aid FROM flight WHERE "price" != 278.56 OR "distance" <= 7487 OR destination <> "Honolulu" OR arrival_date = "04/12/2005 11:10" OR "flno" != 99 AND "aid" >= 9 AND origin <> "Los Angeles"


Question: Can you give me a list of driver IDs, including those from the driver table where the ID is not 8, and those from the school_bus table where the ID is 3 or greater?

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 >= 3


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

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 <= 10


Question: Can you list all the parties from the election table, excluding those with the "Environmental Matters (Vice-Chair)" committee, where the election ID is 4 or greater and the party is 1, or the first elected year was 2003, combined with all the parties from the party table where the Lieutenant Governor isn't Dennis Mehiel, or the year is 1998, the Attorney General isn't Jeanine Pirro, the US Senate isn't "(no election)", the party is "Democratic", the party ID is 1 or greater, and the Governor isn't Carl McCall?

SELECT Party FROM election WHERE Committee <> "Environmental Matters (Vice-Chair)" AND "Election_ID" >= 4 AND "Party" = 1 OR "First_Elected" = 2003.0 UNION ALL SELECT Party FROM party WHERE Lieutenant_Governor != "Dennis Mehiel" OR "Year" = 1998.0 AND Attorney_General <> "Jeanine Pirro" AND US_Senate <> "(no election)" AND Party = "Democratic" AND "Party_ID" >= 1 AND Governor <> "Carl McCall"


Question: Can you give me the Member ID, Hometown, and Card Number for members who have a card number other than LCB7, but also either live in Louisville, Kentucky, or have a card number of LCB7?

SELECT Member_ID, Hometown, Card_Number FROM member WHERE Card_Number != "LCB7" INTERSECT SELECT Member_ID, Hometown, Card_Number FROM member WHERE Hometown = "Louisville, Kentucky" OR Card_Number = "LCB7"


Question: Which driver IDs appear in the driver table, excluding driver ID 2, and also appear in the school_bus table as driver ID 10?

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 = 10


Question: Which driver IDs, excluding driver ID 9, appear in the driver table but not in the school_bus table, also excluding driver IDs less than 4 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 < 4


Question: Could you list the club IDs for clubs located in France or with a Club ID less than or equal to 3, and also list the club IDs from the match results where the Small Silver is less than 6 and the Rank is greater than or equal to 1, or where the Club ID is less than 1 and the Gold is greater than 6, or where the Bronze is less than or equal to 8?

SELECT Club_ID FROM club WHERE Region = "France" OR "Club_ID" <= 3 UNION ALL SELECT Club_ID FROM match_result WHERE "Small_Silver" < 6 AND "Rank" >= 1 OR "Club_ID" < 1 AND "Gold" > 6 OR "Bronze" <= 8


Question: Can you list the aircraft IDs that appear at least twice in the aircraft table, combined with the aircraft IDs that appear more than once in 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: Which driver IDs, excluding driver 6, are also school bus driver IDs, excluding driver 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: Can you give me a list of driver IDs that are greater than 9, but not including those driver IDs that are greater than or equal to 4 from the school bus list?

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: Can you list the aircraft IDs that appear at least once in the aircraft table with an ID of 2 or greater, combined with the aircraft IDs that appear at least once in the airport_aircraft table with an ID greater than 5?

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: Which driver IDs are greater than 4 and also greater than 7 in the school bus records?

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 > 7


Question: Can you give me a list of driver IDs, including driver ID 9 from the driver table and all driver IDs less than 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: Can you give me a list of driver IDs, including those that are exactly 12 from the driver table, and those that are 4 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 <= 4


Question: Can you give me a list of driver IDs, where each ID is greater than 2, but excluding any driver IDs that also appear in the school bus table, unless that driver ID is 10?

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: Can you list all department IDs and their temporary acting status from the management table, including entries where the temporary acting status is not "Yes" and also entries where the temporary acting status is not equal to "Yes"?

SELECT department_ID, temporary_acting FROM management WHERE temporary_acting != "Yes" UNION ALL SELECT department_ID, temporary_acting FROM management WHERE temporary_acting <> "Yes"


Question: Can you give me the Aircraft IDs that are both less than or equal to 2 in the aircraft table and greater than or equal to 1 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 >= 1


Question: Can you list all the aircraft IDs from the aircraft table, excluding those with ID 1, and combine that with a list of aircraft IDs from the airport_aircraft table that only includes aircraft ID 1?

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 = 1


Question: Can you give me a list of staff IDs, including those associated with lessons where the vehicle ID is 1 or higher, and also those from the staff records where either the birth date isn't May 19, 2004, at 2:11 PM, or the middle name isn't Stephania, or the first name isn't Ludie and the last name isn't Durgan, or the nickname isn't norma73, or the date they joined isn't June 5, 2016, at 10:22 PM, or their staff address ID is less than 2, or their staff ID is 12 or less?

SELECT staff_id FROM Lessons WHERE "vehicle_id" >= 1 UNION SELECT staff_id FROM Staff WHERE date_of_birth != "2004-05-19 14:11:13" OR middle_name <> "Stephania" OR first_name != "Ludie" AND last_name <> "Durgan" OR nickname != "norma73" OR date_joined_staff <> "2016-06-05 22:22:23" OR "staff_address_id" < 2 OR "staff_id" <= 12


Question: Can you give me a list of driver IDs, including those from the driver table that are 8 or higher, and those from the school bus table that are not 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: Which driver IDs, excluding driver ID 11, are not also driver IDs in the school bus list, excluding driver ID 3?

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 != 3


Question: Can you give me a list of driver IDs, excluding driver ID 8, that are not also driver IDs, excluding driver ID 10, found 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 != 10


Question: Can you give me a list of driver IDs that are less than or equal to 12 from the driver table, combined with a list of driver IDs that are less than 9 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 < 9


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

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 the employee IDs that are common between employees who are either older than 29 or not from Bath and also have an ID less than 1, and employees who are not full-time?

SELECT Employee_ID FROM employee WHERE "Age" > 29 OR City != "Bath" AND "Employee_ID" < 1 INTERSECT SELECT Employee_ID FROM hiring WHERE Is_full_time = "F"


Question: What is the smallest document ID from the drafts that don't have "x" as draft details, and also the smallest document ID from the documents that don't have "61" as a receipt number and aren't of the "Hard Drive" type?

SELECT MIN(document_id) FROM Document_Drafts WHERE draft_details != "x" UNION ALL SELECT MIN(document_id) FROM Documents WHERE receipt_number != "61" AND document_type_code <> "Hard Drive"


Question: Can you give me the average draft number for each document in the circulation history where the draft number is at least 20 and the employee ID is greater than 1, excluding the average draft number for each document in the document drafts where the draft details are "r" or the document ID is not 10?

SELECT document_id, AVG(draft_number) FROM Circulation_History WHERE "draft_number" >= 20 AND "employee_id" > 1 EXCEPT SELECT document_id, AVG(draft_number) FROM Document_Drafts WHERE draft_details = "r" OR "document_id" != 10


Question: Which aircraft IDs are not equal to 5 and are also less than 2?

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 < 2


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

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 > 9


Question: Can you give me the driver ID that is exactly 8, but only if that driver ID is not also a driver ID less than 10 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 < 10


Question: Can you give me the grade, location, and school for entries that are either not 4th grade or not in Jakarta, Indonesia, but are Noelani Elementary School, and also either Occidental College, or in Cambridge, Massachusetts, or not of type Private, and not Freshman-Sophomore year, and have a School_ID of 4?

College
Cambridge, Massachusetts
Harvard Law School

Freshman–Sophomore year
Los Angeles, California
Occidental College

SELECT Grade, Location, School FROM school WHERE Grade != "4th grade" OR Location != "Jakarta, Indonesia" AND School = "Noelani Elementary School" INTERSECT SELECT Grade, Location, School FROM school WHERE School = "Occidental College" OR Location = "Cambridge, Massachusetts" OR Type <> "Private" AND Grade != "Freshman–Sophomore year" AND "School_ID" = 4


Question: Which driver IDs, excluding driver ID 4, are not also driver IDs in the school bus table, excluding driver ID 10?

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 <> 10


Question: Can you give me a list of driver IDs that are greater than 1, but not in the list of driver IDs less than or equal to 9 that are associated with school buses?

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 <= 9


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

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 >= 9


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

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 <= 9


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 not 9?

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 != 9


Question: What are the count of pet IDs, the maximum weight, and the pet age for pets that are at least 2 years old and have a pet ID of 2001, excluding the count of pet IDs, maximum weight, and pet age for pets that are not cats, are 3 years old, and weigh 9.3?

SELECT COUNT(PetID), MAX(weight), pet_age FROM Pets WHERE "pet_age" >= 2 AND "PetID" = 2001 EXCEPT SELECT COUNT(PetID), MAX(weight), pet_age FROM Pets WHERE PetType != "cat" AND "pet_age" = 3 AND "weight" = 9.3


Question: Can you give me a list of driver IDs from the driver table where the ID is 4 or greater, combined with a list of driver IDs from the school_bus table where the ID is not 10?

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 <> 10


Question: Can you give me a list of driver IDs, combining those from the driver table where the ID is not 11, with those from the school_bus table where the ID is less than 7, making sure to only list each ID once?

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 < 7


Question: Can you give me a list of driver IDs, excluding driver ID 2, that are not also driver IDs less than or equal to 9 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: What aircraft IDs are less than or equal to 5, excluding those aircraft IDs that are also greater than or equal to 1 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 >= 1


Question: Could you give me the member IDs from the membership register branch table where the member ID is 2, but only if those member IDs are not also in the purchase table where the member ID is greater than 3 and the total pounds is at least 20.99?

SELECT Member_ID FROM membership_register_branch WHERE "Member_ID" = 2 EXCEPT SELECT Member_ID FROM purchase WHERE "Member_ID" > 3 AND "Total_pounds" >= 20.99


Question: Which driver IDs are greater than 4 and also greater than 7 in the school bus records?

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 > 7


Question: Can you give me a list of aircraft IDs that are greater than 3, excluding any aircraft IDs from the airport aircraft list that are not equal to 2?

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 driver IDs that are greater than 12 from the driver table, combined with a list of driver IDs that are greater than 9 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 > 9


Question: Can you give me a list of driver IDs, combining those from the driver table that are greater than 6 with those from the school bus table that are not equal to 7, removing 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 != 7


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

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 >= 9


Question: Can you give me a list of driver IDs, including those from the driver table excluding driver ID 2, and those from the school bus table excluding driver ID 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, including those from the driver table excluding ID 12, and those from the school bus table with IDs greater than 9?

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 > 9


Question: Can you give me a list of driver IDs that are less than 9 from the driver table, combined with a list of driver IDs that are less than 3 from the school_bus table, removing any duplicates?

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 < 3


Question: Can you list whether the positions are full-time for those that started in 2003, and also list whether the positions are full-time for those that are not part-time or have a Shop ID less than or equal to 1 and didn't start in 2003?

SELECT Is_full_time FROM hiring WHERE Start_from = "2003" UNION ALL SELECT Is_full_time FROM hiring WHERE Is_full_time != "F" OR "Shop_ID" <= 1 AND Start_from != "2003"


Question: Can you give me a list of driver IDs that are not 12 and are also less than or equal to 4, 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 != 12 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 4


Question: Can you show me the city, the number of open years, the number of names, the smallest branch ID, the address road, and the membership amount for all branches where the membership amount is not 6, combined with the same information for branches where the membership amount is 56, or the branch ID is less than or equal to 3 and the city is not London, or the address road is not Concord Road, or the name is Popert and the open year is not 2009?

SELECT City, COUNT(Open_year), COUNT(Name), MIN(Branch_ID), Address_road, membership_amount FROM branch WHERE membership_amount <> "6" UNION SELECT City, COUNT(Open_year), COUNT(Name), MIN(Branch_ID), Address_road, membership_amount FROM branch WHERE membership_amount = "56" OR "Branch_ID" <= 3 AND City != "London" OR Address_road <> "Concord Road" OR Name = "Popert" AND Open_year <> "2009"


Question: Which driver IDs, less than 9, are present in both the driver list and 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 < 9


Question: Which driver IDs, excluding driver 11, are also school bus driver IDs, excluding driver 7?

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 list the driver IDs that are less than 1 from the driver table, and combine that 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 list the shipping agent description, name, and code for all shipping agents, combining those that don't have a description of "g" and a code of "UP" with those that don't have the name "Airline" or have a description of "q"?

SELECT shipping_agent_description, shipping_agent_name, shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_description != "g" AND shipping_agent_code <> "UP" UNION SELECT shipping_agent_description, shipping_agent_name, shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_name != "Airline" OR shipping_agent_description = "q"


Question: Can you give me a list of employee IDs, shop IDs, start dates, and full-time status for employees, including those who are not full-time or have an employee ID of 5, started before 2003, and work in a shop with an ID less than 8, combined with those who don't have an employee ID of 4 and work in shop 1, or are not full-time, or started before 2010?

SELECT Employee_ID, Shop_ID, Start_from, Is_full_time FROM hiring WHERE Is_full_time != "T" OR "Employee_ID" = 5 AND Start_from <> "2003" AND "Shop_ID" < 8 UNION SELECT Employee_ID, Shop_ID, Start_from, Is_full_time FROM hiring WHERE "Employee_ID" <> 4 AND "Shop_ID" = 1 OR Is_full_time != "T" OR Start_from <> "2010"


Question: Can you give me a list of driver IDs that are less than or equal to 11, but not including those driver IDs that are less than or equal to 10 and are also 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 <= 10


Question: Can you give me a list of driver IDs that are less than 9 and also less than or equal to 10, 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 < 9 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 10


Question: What are the average payment date, payment amount, and customer ID, along with the payment method, for payments of at least $9570.93, combined with the same averages and payment method for payments that were not made with a credit card and not on "2018-02-21 05:28:49", or were made by a customer with an ID of 2 or less?

SELECT AVG(datetime_payment), AVG(amount_payment), AVG(customer_id), payment_method_code FROM Customer_Payments WHERE "amount_payment" >= 9570.93 UNION SELECT AVG(datetime_payment), AVG(amount_payment), AVG(customer_id), payment_method_code FROM Customer_Payments WHERE payment_method_code != "Credit Card" AND datetime_payment != "2018-02-21 05:28:49" OR "customer_id" <= 2


Question: Can you give me a list of driver IDs that are both greater than 7 and not equal to 10, considering only the unique driver IDs from the driver and school_bus tables?

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 <> 10


Question: Could you list all car models, including those from the car names table that aren't Volvos, and also models from the model list table where the ModelId is less than 11?

SELECT Model FROM car_names WHERE Model != "volvo" UNION ALL SELECT Model FROM model_list WHERE "ModelId" < 11


Question: Can you list all the aircraft IDs, first from the aircraft table excluding ID 2, and then from the airport_aircraft table including only those greater than 5?

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: Can you give me a list of driver IDs, combining those from the driver table excluding driver ID 6 with those from the school bus table that are greater than 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 all employee IDs from the certificate table, excluding the ID 269734834, combined with a list of all employee IDs from the employee table that are less than or equal to 348121549?

SELECT eid FROM certificate WHERE "eid" <> 269734834 UNION ALL SELECT eid FROM employee WHERE "eid" <= 348121549


Question: Can you give me a list of driver IDs, first from the driver table excluding driver ID 8, and then from the school bus table including only driver IDs up to 3, removing any duplicates?

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 <= 3


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

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 driver IDs, including those from the driver table that are less than 11, combined with those from the school bus table that are not equal to 4?

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 <> 4


Question: Can you give me a list of driver IDs, excluding driver ID 8, that are in the driver table but not in the school bus table, also excluding driver ID 3 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 != 3


Question: Can you give me a list of driver IDs that are less than 6, but exclude the driver ID 4 if it appears in the 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 = 4


Question: Can you give me a list of driver IDs, excluding driver ID 12, that are not also driver IDs less than or equal to 10 found 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 sum of school IDs from the budget table, considering entries where the budget invested percentage isn't 71.3, the budgeted value isn't 3666, or the total budget percent invested isn't 2.0, or the year isn't 2001, or the invested amount isn't 146102, or the school ID is greater than 1, combined with the sum of school IDs from the endowment table, considering entries where the endowment ID is less than or equal to 11, or the donator name isn't La Vega, and the amount is less than 8.99?

SELECT SUM(School_id) FROM budget WHERE Budget_invested_percent <> "71.3" AND "Budgeted" != 3666 AND "total_budget_percent_invested" != 2.0 OR "Year" != 2001 AND "Invested" <> 146102 OR "School_id" > 1 UNION ALL SELECT SUM(School_id) FROM endowment WHERE "endowment_id" <= 11 OR donator_name != "La Vega" AND "amount" < 8.99


Question: Can you list all the aircraft IDs from the aircraft table, but only if the aircraft ID is 1, and also list all the aircraft IDs from the airport_aircraft table, but only if the aircraft ID is less than 5, and combine these two lists?

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 < 5


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

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 give me a list of driver IDs, including those that are not 12 from the driver table, and also those that are exactly 4 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 = 4


Question: Can you give me the Club ID, average Club Name, and Club Description for all clubs, combining those located in AKW or with a Club ID greater than 2 with those that don't have the description "Play pen and paper games on campus." or aren't located in AKW?

Refurbish computers; teach kids and adults about computer basics.

SELECT ClubID, AVG(ClubName), ClubDesc FROM Club WHERE ClubLocation = "AKW" OR "ClubID" > 2 UNION SELECT ClubID, AVG(ClubName), ClubDesc FROM Club WHERE ClubDesc != "Play pen and paper games on campus." OR ClubLocation != "AKW"


Question: How many books are there for each writer, along with the price, where the book title is "The Dome: Ground Zero", or the publication date isn't August 2008, or the price isn't 2000000, or the writer isn't Garth Ennis and the publication ID is greater than 5, grouped by writer, but only showing results where the publisher is Thomson Reuters?

SELECT COUNT(T1.Book_ID), T2.Price FROM book as T1 JOIN publication as T2 ON T1.Book_ID = T2.Book_ID WHERE Title = "The Dome: Ground Zero" OR Publication_Date <> "August 2008" OR "Price" <> 2000000.0 OR Writer <> "Garth Ennis" AND "Publication_ID" > 5 GROUP BY Writer HAVING Publisher = "Thomson Reuters"


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

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 = 7


Question: Which aircraft have an ID of 2 and also have an ID less than 3 at the airport?

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 < 3


Question: Can you give me a list of driver IDs, combining those from the driver table excluding driver ID 2, with those from the school bus table that are less than 10?

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 < 10


Question: What is the average name from the branch table, excluding branches opened in 2009, those not on Concord Road in Oxford, those with a membership amount other than 6, and those not named Zytogorski, combined with the average name from the member table, excluding members with card number LCB7 and member ID 2?

SELECT AVG(Name) FROM branch WHERE Open_year <> "2009" OR Address_road <> "Concord Road" AND City <> "Oxford" AND membership_amount <> "6" AND Name != "Zytogorski" UNION ALL SELECT AVG(Name) FROM member WHERE Card_Number != "LCB7" AND "Member_ID" <> 2


Question: Can you give me a list of driver IDs that are 10 or less from the driver table, excluding those driver IDs that are less than 9 from 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 < 9


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 less than or equal to 3?

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 <= 3


Question: Can you give me a list of aircraft IDs, up to and including 4, that appear in the aircraft table but not in the airport_aircraft table, considering only aircraft IDs up to and including 3 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 <= 3


Question: Can you give me the total Department IDs for each ranking, but only for departments with a budget less than 77.6 billion, or a ranking that isn't 8 and wasn't created in 1789, or doesn't have 109832 employees, or has a Department ID greater than 1, showing only those totals greater than 6? Also, include the total Department IDs for each ranking where the creation year isn't 1979, but only showing totals that are 10 or greater.

SELECT Ranking, SUM(Department_ID) FROM department WHERE "Budget_in_Billions" < 77.6 OR "Ranking" != 8 AND Creation != "1789" OR "Num_Employees" != 109832.0 OR "Department_ID" > 1 GROUP BY Ranking HAVING SUM(Department_ID) > 6 UNION SELECT Ranking, SUM(Department_ID) FROM department WHERE Creation <> "1979" GROUP BY Ranking HAVING SUM(Department_ID) >= 10