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

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: Which driver IDs are both less than or equal to 3 in the driver table and less than or equal to 7 in 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 <= 7


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

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


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


Question: Can you give me a list of driver IDs where the driver ID is greater than 5 from the driver table, combined with a list of driver IDs that are equal to 4 from the school bus table?

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: For properties with feature IDs less than 4, can you tell me the property ID, the number of property feature descriptions, and the feature ID, excluding those properties where the feature ID is not 3 and the property feature description is not "hic"?

SELECT property_id, COUNT(property_feature_description), feature_id FROM Other_Property_Features WHERE "feature_id" < 4 EXCEPT SELECT property_id, COUNT(property_feature_description), feature_id FROM Other_Property_Features WHERE "feature_id" <> 3 AND property_feature_description != "hic"


Question: Can you give me a list of driver IDs, including those from the driver table where the ID is greater than 2, and those from the school bus table where the ID is not 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: For each aircraft, what is the smallest ID associated with it in the airport aircraft table?

SELECT T1.Aircraft_ID, MIN(T2.ID) FROM aircraft as T1 JOIN airport_aircraft as T2 ON T1.Aircraft_ID = T2.Aircraft_ID


Question: Can you list the aircraft IDs that appear in the aircraft table, excluding aircraft ID 2, but only if they are not aircraft IDs that appear in the airport_aircraft table with an ID greater than 2?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID != 2 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 greater than or equal to 1 and also not equal to 10, considering drivers from both the driver and school bus lists?

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: 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 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 less than 10 from the driver table, excluding any driver IDs less than 4 that are also 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 < 4


Question: Can you give me the address details and IDs from the Addresses table where the ID is 3 or less and the address details are not "IE", but exclude any entries where the address details are not "MX" or the ID is 0?

SELECT address_details, address_id FROM Addresses WHERE "address_id" <= 3 AND address_details <> "IE" EXCEPT SELECT address_details, address_id FROM Addresses WHERE address_details != "MX" OR "address_id" = 0


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

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 are not equal to 1 and are also greater than 4, considering drivers and school buses separately?

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


Question: Which aircraft IDs, excluding ID 1, are present in both the aircraft and airport_aircraft tables?

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


Question: Can you give me a list of driver IDs, including those drivers who are not driver 5, and also including driver 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 list all the driver IDs from the driver table that are less than or equal to 4, combined with all the driver IDs from the school_bus table that are less than 7?

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


Question: Can you give me a list of all driver IDs, excluding driver ID 7 from the driver table and excluding driver ID 3 from the school_bus table, making sure there are no duplicates in the final list?

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


Question: Can you give me a list of driver IDs that are both greater than or equal to 2 and also not equal to 7, considering only drivers that appear in both 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 that are equal to 6 from the driver table and those that are less than or equal to 7 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 <= 7


Question: Which driver IDs are greater than 3 and also not equal to 3, considering drivers and school buses separately?

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


Question: Could you give me the document IDs and other details from the Documents table, excluding those that have a document name of "A history of Arts" or other details that are not "None" and a document description that is not "b" or a Template ID that is not 10, and then remove any document IDs and other details that also appear in the Paragraphs table where the paragraph text is not "Brazil", the paragraph ID is greater than 571212310, and the document ID is less than 2394?

SELECT Document_ID, Other_Details FROM Documents WHERE Document_Name <> "A history of Arts" OR Other_Details != "None" AND Document_Description != "b" OR "Template_ID" <> 10 EXCEPT SELECT Document_ID, Other_Details FROM Paragraphs WHERE Paragraph_Text <> "Brazil" AND "Paragraph_ID" > 571212310 AND "Document_ID" < 2394


Question: Could you give me the driver IDs that are both less than 12 and also equal to 7?

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


Question: What is the average branch ID for branches not located on Valleys Place, combined with the average branch ID for purchases not made at branch 6 by members with IDs less than 4?

SELECT AVG(Branch_ID) FROM branch WHERE Address_road <> "Valleys Place" UNION ALL SELECT AVG(Branch_ID) FROM purchase WHERE Branch_ID != "6" AND "Member_ID" < 4


Question: Can you give me a list of driver IDs from the driver table, where the driver ID is 1 or greater, excluding any driver IDs that appear in the school_bus table, unless that driver ID is 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: Which customers with ID 3 have both made payments and either have lessons taught by staff other than staff ID 8 with customer ID greater than or equal to 13, or have cancelled lessons with lesson ID greater than 14?

SELECT customer_id FROM Customer_Payments WHERE "customer_id" = 3 INTERSECT SELECT customer_id FROM Lessons WHERE "staff_id" <> 8 AND "customer_id" >= 13 OR "lesson_id" > 14 AND lesson_status_code = "Cancelled"


Question: Can you list the aircraft IDs that are less than or equal to 3, excluding aircraft ID 1 if it's associated with any airport?

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


Question: Could you please list the branch IDs from the branch table where the membership amount is 56 and the city is London, or the branch ID is 3 and the opening year is not 2015, and also include the branch IDs from the purchase table where the member ID is greater than 2 and the total pounds is not 430.29, or the branch ID is not 5?

SELECT Branch_ID FROM branch WHERE membership_amount = "56" AND City = "London" OR "Branch_ID" = 3 AND Open_year != "2015" UNION ALL SELECT Branch_ID FROM purchase WHERE "Member_ID" > 2 AND "Total_pounds" <> 430.29 OR Branch_ID != "5"


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

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 give me a list of driver IDs, including those from the driver table excluding driver ID 2, and those from the school_bus table with driver IDs 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 that are greater than 9 from the driver table, excluding any driver IDs that are greater than or equal to 9 from the school bus table?

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


Question: Can you give me the other details from the Documents table where the receipt number is 80, or where the other details are not "u", the document status code is not "overdue", the shipping agent code is not "SH", and the receipt date is November 5th, 1973 at 9:48:53 PM, but exclude any other details that are also found in the Employees table where the employee name is not "Kenyon", or the employee ID is greater than 7, or the other details are not "f", or the role code is not "PR"?

SELECT other_details FROM Documents WHERE receipt_number = "80" OR other_details <> "u" AND document_status_code <> "overdue" AND shipping_agent_code <> "SH" AND receipt_date = "1973-11-05 21:48:53" EXCEPT SELECT other_details FROM Employees WHERE employee_name <> "Kenyon" OR "employee_id" > 7 AND other_details != "f" OR role_code != "PR"


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

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 both less than or equal to 5 and appear in the driver table, and also less than 9 and appear in the school_bus table?

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


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

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


Question: Can you list the aircraft IDs that appear in the aircraft table, excluding aircraft ID 2, but only if they are not aircraft ID 3 in the airport_aircraft table?

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


Question: Can you list the aircraft IDs from the aircraft table that are less than 1, and combine that with a list of aircraft IDs from the airport_aircraft table that are greater than or equal to 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 driver IDs, excluding driver ID 8, that are not also driver ID 10 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 = 10


Question: Can you give me the IDs of drivers, up to ID 5, excluding any driver with ID 9 who drives a school bus?

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


Question: Can you list the aircraft IDs that are greater than 5 from the aircraft table, and also include the aircraft IDs that are exactly 5 from the airport_aircraft table?

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


Question: Can you list the aircraft IDs that are less than 2 from the aircraft table, and combine that with a list of aircraft IDs that are not equal to 3 from the airport_aircraft table?

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


Question: What aircraft IDs are both greater than or equal to 5 in the aircraft table and greater than 3 in the airport_aircraft table?

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


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


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

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


Question: Can you give me a list of driver IDs, combining those from the driver table where the ID is not 2, with those from the school_bus table where the ID is greater than 10, 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 > 10


Question: What is the total freight in metric tonnes and the corresponding ID for each airport, considering the relationship between the airport and airport_aircraft tables?

SELECT SUM(T1.Freight_Metric_Tonnes), T2.ID FROM airport as T1 JOIN airport_aircraft as T2 ON T1.Airport_ID = T2.Airport_ID


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

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


Question: Which driver IDs are both not equal to 2 and also greater than 3, considering drivers and school buses separately?

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


Question: Can you list the aircraft IDs that are 3 or greater, excluding those aircraft IDs from the airport aircraft table 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 the IDs of aircraft that have an ID of 3, excluding any aircraft IDs less than or equal to 2 that are also listed 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, excluding driver ID 9 from the driver table and excluding driver ID 10 from the school_bus table, combining the results and 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 != 10


Question: Can you list the property IDs from the Other_Property_Features table where the feature ID is not 3, combined with property IDs from the Properties table where apt_feature_1 is "aut", the property type code is not "Other", apt_feature_3 is not "None" and the room count is 5, or apt_feature_2 is not "sit"?

SELECT property_id FROM Other_Property_Features WHERE "feature_id" != 3 UNION SELECT property_id FROM Properties WHERE apt_feature_1 = "aut" OR property_type_code <> "Other" OR apt_feature_3 <> "None" AND "room_count" = 5 OR apt_feature_2 <> "sit"


Question: Can you list the aircraft IDs, excluding aircraft ID 3, that are not aircraft ID 2 in the airport aircraft list?

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 list all the property type codes, excluding "Field" and those described as "Other, to be determined," and also excluding those described as "Apartment, Flat, Condo, etc." and again excluding the code "Field"?

SELECT property_type_code FROM Ref_Property_Types WHERE property_type_code <> "Field" AND property_type_description <> "Other, to be determined." UNION SELECT property_type_code FROM Ref_Property_Types WHERE property_type_description <> "Apartment, Flat, Condo, etc." AND property_type_code != "Field"


Question: Can you give me the IDs that are both in the flight table where the altitude is 3650 or less, the ID is not 8, the date is not January 29, 1964, the airport ID is not 4, the company ID is 11 or greater, the vehicle flight number is not M2-F1 #70, the velocity is 240 or greater, or the pilot is not Thompson, and in the operate_company table where the type is Subsidiary and the incorporated location is not Hong Kong, or the ID is not 10, or the name is not Cathay Pacific Services Limited and the principal activities are Catering services and the group equity shareholding is 100 or greater?

SELECT id FROM flight WHERE "Altitude" <= 3650.0 OR "id" <> 8 OR Date <> "January 29, 1964" OR "airport_id" <> 4 OR "company_id" >= 11 OR Vehicle_Flight_number <> "M2-F1 #70" OR "Velocity" >= 240.0 OR Pilot != "Thompson" INTERSECT SELECT id FROM operate_company WHERE Type = "Subsidiary" AND Incorporated_in <> "Hong Kong" OR "id" != 10 OR name <> "Cathay Pacific Services Limited" AND Principal_activities = "Catering services" AND "Group_Equity_Shareholding" >= 100.0


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

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


Question: Can you give me a list of aircraft IDs that are not equal to 3, and are also less than 2 when looking at the aircraft IDs associated with airports?

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


Question: Can you give me a list of driver IDs, including those from the driver table that are greater than 4, 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 > 4 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 7


Question: Which driver IDs, excluding driver ID 1, are also driver ID 3 in the school bus records?

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


Question: Can you give me the IDs of drivers that are both less than 7 and also less than or equal to 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: Can you list all the driver IDs from the driver table that are less than or equal to 9, combined with all 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 <= 9 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 10


Question: Can you list all Aircraft IDs that are greater than or equal to 2, combining the IDs from both the aircraft and airport_aircraft tables, but only showing each ID once?

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


Question: Which aircraft have an ID of 3 and also appear in the airport aircraft list with an ID of 1 or greater?

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


Question: Can you give me a list of driver IDs, including those from the driver table that are 11 or higher, and also those from the school bus table that are exactly 10?

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


Question: Can you list the aircraft IDs that are greater than or equal to 3 from the aircraft table, and also list the aircraft IDs that are not equal to 5 from the airport_aircraft table, combining both lists into one?

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


Question: Can you give me a list of IDs from car makers that are not from country 3, combined with a list of IDs from car data that are from the year 1981?

SELECT Id FROM car_makers WHERE Country <> "3" UNION ALL SELECT Id FROM cars_data WHERE "Year" = 1981


Question: Can you give me a list of driver IDs that are less than or equal to 12, and also include driver ID 7 from the school bus list?

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


Question: Can you list the aircraft IDs that are less than 4 from the aircraft table, combined with the aircraft IDs that are at least 3 from the airport_aircraft table?

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


Question: Can you give me a list of aircraft IDs that appear in the aircraft table, excluding aircraft ID 5, but only if they are not also in the airport_aircraft table, excluding aircraft ID 1?

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


Question: Can you list the driver IDs, including driver ID 1 from the driver table and any driver IDs less than 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: Could you list the Aircraft IDs that are less than 4 and appear in the aircraft table, and also are less than 2 and appear 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: Can you give me the IDs of drivers with IDs less than 5, excluding those driver IDs that are also school bus driver IDs less than 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: Can you give me a list of driver IDs, including those from the driver table that are greater than 1, and those 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 > 1 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 7


Question: Can you list the property and feature IDs for all entries where the property feature description is not "hic", excluding those entries where the description is not "doloribus" and the property ID is greater than 15?

SELECT property_id, feature_id FROM Other_Property_Features WHERE property_feature_description != "hic" EXCEPT SELECT property_id, feature_id FROM Other_Property_Features WHERE property_feature_description != "doloribus" AND "property_id" > 15


Question: Can you give me a list of aircraft IDs that appear in the aircraft table, excluding aircraft ID 2, but then remove any aircraft IDs that also appear in the airport_aircraft table with an ID of 2 or less?

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


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

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, excluding driver ID 4 from the driver table and excluding driver ID 9 from the school bus table, combining the results into a single list?

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: Which driver has an ID of 10 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 = 10 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 excluding ID 9, and those from the school bus table with IDs 10 or greater?

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: What is the smallest document ID from the Documents table, considering only documents where the document name is not "Learning French" or the "Template_ID" is less than 20 and also included in the smallest document IDs where other details are not "None"?

SELECT MIN(Document_ID) FROM Documents WHERE Document_Name != "Learning French" OR "Template_ID" < 20 IN (SELECT MIN(Document_ID) FROM Documents WHERE Other_Details != "None")


Question: Can you give me a list of driver IDs, combining those from the driver table that aren't 5 with those from the school bus table that are less than 10, making sure to only list each ID once?

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


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


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

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 the driver ID that appears exactly once as 7 in the driver table but does not appear as a driver ID greater than or equal to 10 in the school bus table?

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: Can you give me the driver ID that appears exactly once as 6 in the driver table, but does not appear as 9 or greater 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 5, excluding any driver IDs that are less than or equal to 7 from 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: Which driver IDs, excluding driver 9, are also driver IDs, excluding driver 7, in the school bus list?

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


Question: What is the total draft number and document ID for circulation history entries where the copy number is 5 or less, the draft number is not 1, and the document ID is less than 20, excluding the total draft number and document ID from document drafts where the draft number is greater than 9?

SELECT SUM(draft_number), document_id FROM Circulation_History WHERE "copy_number" <= 5 AND "draft_number" != 1 AND "document_id" < 20 EXCEPT SELECT SUM(draft_number), document_id FROM Document_Drafts WHERE "draft_number" > 9


Question: How many countries are named "new zealand" and have a continent value less than 4, excluding the count of countries that are not named "mexico" or have a CountryId of 13?

SELECT COUNT(CountryId) FROM countries WHERE CountryName = "new zealand" AND "Continent" < 4 EXCEPT SELECT COUNT(CountryId) FROM countries WHERE CountryName != "mexico" OR "CountryId" = 13


Question: What are the aircraft IDs that are not equal to 1 and are also not equal to 2 in the airport aircraft?

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


Question: Which store and product combinations are such that the product ID is not 1 and the store ID is less than 2, and also the store ID is not 5 and the product ID is not 2?

SELECT Store_ID, Product_ID FROM store_product WHERE "Product_ID" <> 1 AND "Store_ID" < 2 INTERSECT SELECT Store_ID, Product_ID FROM store_product WHERE "Store_ID" <> 5 AND "Product_ID" != 2


Question: Can you list the aircraft IDs that are greater than 3, grouped by aircraft ID, from the aircraft table, excluding any aircraft IDs that are also greater than 5, grouped by aircraft ID, from the airport_aircraft table?

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


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


Question: Can you give me a list of driver IDs, combining those from the driver table excluding driver ID 4, with those 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 != 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 that are greater than 6 from the driver table, combined with a list of driver IDs that are greater than 10 from the school bus table?

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


Question: Can you show me the year, total pounds, and member ID for all purchases where the member ID is less than or equal to 1, combined with the year, total pounds, and member ID for all purchases where the branch ID is not 5?

SELECT Year, Total_pounds, Member_ID FROM purchase WHERE "Member_ID" <= 1 UNION SELECT Year, Total_pounds, Member_ID FROM purchase WHERE Branch_ID != "5"


Question: What are the counts of document IDs and their corresponding draft numbers from the circulation history, considering only entries where the draft number is less than 17 and the document ID is at least 20, or the employee ID is greater than 2, or the copy number is not equal to 10, excluding the counts of document IDs and their draft numbers from document drafts where the draft details are not "a", or the document ID is at least 7, or the draft number is 9?

SELECT COUNT(document_id), draft_number FROM Circulation_History WHERE "draft_number" < 17 AND "document_id" >= 20 OR "employee_id" > 2 OR "copy_number" <> 10 EXCEPT SELECT COUNT(document_id), draft_number FROM Document_Drafts WHERE draft_details <> "a" OR "document_id" >= 7 OR "draft_number" = 9


Question: Which driver IDs are both greater than 4 and not equal to 3, considering only the driver IDs that appear in both the driver and school_bus tables?

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


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

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


Question: Which driver IDs are present in the driver table, excluding driver ID 2, and are also present in the school_bus table with 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: Can you give me a list of driver IDs, including driver ID 9 from the driver table, and all driver IDs except 4 from the school bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 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 less than 12, excluding any driver IDs that are not equal to 4 and are also in the school bus list?

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


Question: Can you give me the IDs of albums that are not by artist 147 and are not album 102, or have a title different from "Heroes, Season 1", excluding any IDs that also appear in the media types table where the name is not "Protected AAC audio file"?

SELECT id FROM albums WHERE "artist_id" != 147 AND "id" <> 102 OR title <> "Heroes, Season 1" EXCEPT SELECT id FROM media_types WHERE name != "Protected AAC audio file"


Question: Can you list the aircraft IDs that appear in the aircraft table, excluding aircraft ID 3, but only show those that do not appear in the airport_aircraft table with an aircraft ID less than 5?

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


Question: Can you give me a list of all certificate IDs where the event ID is 573284895 or the certificate ID is greater than 5, combined with a list of all certificate IDs from flights that departed on a date other than December 4th, 2005 at 11:50 AM?

SELECT aid FROM certificate WHERE "eid" = 573284895 OR "aid" > 5 UNION SELECT aid FROM flight WHERE departure_date != "04/12/2005 11:50"


Question: Which driver IDs less than 5 are also driver IDs of school buses, specifically driver ID 4?

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


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

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


Question: Can you give me the IDs of drivers with IDs less than or equal to 3, 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 <= 3 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 9


Question: Which aircraft IDs are not equal to 5 and are also greater than 2 when considering aircraft IDs from both the aircraft and airport_aircraft tables?

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, including those from the driver table where the ID is greater than 8, and those from the school bus table where the ID is 7 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 >= 7


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

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


Question: Can you give me the IDs of drivers, where each ID is less than 4, excluding any driver IDs that are also less than or equal to 7 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: Can you give me a list of driver IDs, excluding driver ID 8, that are not also driver IDs less than 9 in the school bus table?

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


Question: Which driver IDs appear in both the list of drivers with an ID of 1 or greater and the list of school bus drivers with an ID of 3?

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


Question: Can you give me a list of aircraft names, including those that aren't 'SAAB 340' or have a distance of at least 2128 and an aid less than 10, combined with a list of employee names, including those with a salary of at least 54921, or who aren't 'Lisa Walker', or whose eid isn't 159542516?

SELECT name FROM aircraft WHERE name <> "SAAB 340" OR "distance" >= 2128 AND "aid" < 10 UNION SELECT name FROM employee WHERE "salary" >= 54921 OR name <> "Lisa Walker" OR "eid" != 159542516


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

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


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

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


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

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


Question: Can you tell me, for each district, how many cities are headquartered there, excluding those districts where the headquarters aren't in Dera Ghazi Khan City or the district name isn't Bhakkar District, or the city area is greater than 25, only showing districts with a headquarters count not equal to one, combined with the count of headquartered cities for each district where the district ID is less than 5, the district name isn't Faisalabad District, and the city population is less than or equal to 365198, and the headquarters are in Khanewal City, or the city area is less than 13, only showing districts with a headquarters count of one or more?

SELECT COUNT(Headquartered_City), District_ID FROM district WHERE Headquartered_City != "Dera Ghazi Khan City" OR District_name <> "Bhakkar District" OR "City_Area" > 25.0 GROUP BY District_ID HAVING COUNT(Headquartered_City) != 1 UNION SELECT COUNT(Headquartered_City), District_ID FROM district WHERE "District_ID" < 5 AND District_name <> "Faisalabad District" AND "City_Population" <= 365198.0 AND Headquartered_City = "Khanewal City" OR "City_Area" < 13.0 GROUP BY District_ID HAVING COUNT(Headquartered_City) >= 1


Question: Can you give me a list of driver IDs, including those from the driver table excluding driver ID 1, and those from the school bus table with driver IDs less than 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 give me a list of driver IDs from the driver table that are 8 or higher, excluding any driver IDs that are also in the school_bus table and are less than 4?

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 driver IDs, including those from the driver table that are not 11, and also including driver ID 7 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 = 7


Question: Can you give me the average of Other_Details, the sum of Document_ID, the average of Paragraph_ID, and the Paragraph_Text from the Paragraphs table, combining results from two different sets of criteria: first, where the Paragraph_Text is not "UK" and Paragraph_ID is not 946335436, or where Other_Details is not "None"; and second, where the Paragraph_Text is "Micronesia" and Paragraph_ID is not 765713812, or where Other_Details is "None" and Document_ID is greater than or equal to 3830?

SELECT AVG(Other_Details), SUM(Document_ID), AVG(Paragraph_ID), Paragraph_Text FROM Paragraphs WHERE Paragraph_Text <> "UK" AND "Paragraph_ID" != 946335436 OR Other_Details != "None" UNION SELECT AVG(Other_Details), SUM(Document_ID), AVG(Paragraph_ID), Paragraph_Text FROM Paragraphs WHERE Paragraph_Text = "Micronesia" AND "Paragraph_ID" != 765713812 OR Other_Details = "None" AND "Document_ID" >= 3830


Question: Can you give me a list of driver IDs that are greater than 9, excluding any driver IDs from the school bus list that aren't equal to 3?

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


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

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 give me a list of driver IDs that are greater than 3, excluding any driver IDs that are not equal to 4 and are also found 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 list the Aircraft IDs from the aircraft table, excluding those with a maximum gross weight of 123,500 lb (56,000 kg) or a maximum disk loading of 2.6 lb/ft² (14 kg/m²), and then remove any Aircraft IDs that are also found in the airport_aircraft table where the Airport ID is less than or equal to 6 and the ID is greater than or equal to 1?

SELECT Aircraft_ID FROM aircraft WHERE Max_Gross_Weight != "123,500 lb (56,000 kg)" AND Max_disk_Loading <> "2.6 lb/ft² (14 kg/m²)" EXCEPT SELECT Aircraft_ID FROM airport_aircraft WHERE "Airport_ID" <= 6 AND "ID" >= 1


Question: Can you list the aircraft IDs that are less than 4, grouping them by ID, from both the aircraft and airport_aircraft tables, 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 < 1


Question: Which driver IDs, excluding driver ID 1, are also school bus driver IDs, excluding driver ID 4?

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


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


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

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


Question: Can you give me the continents and country IDs that are both from countries with an ID of 6 and a continent other than 4, excluding France, and also from countries with a continent other than 4 and a country ID of 13 or less?

SELECT Continent, CountryId FROM countries WHERE "CountryId" = 6 AND "Continent" != 4 AND CountryName != "france" INTERSECT SELECT Continent, CountryId FROM countries WHERE "Continent" != 4 AND "CountryId" <= 13


Question: Which aircraft have an ID of 3 and are also associated with airports, but not with an airport having an ID of 2?

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


Question: Can you give me a list of employee IDs for employees who either earn less than $105,743, have an ID of 574489456, or are not named Chad Stewart, combined with a list of employee IDs for employees who earn more than $205,187 or have an ID of 269734834?

SELECT eid FROM employee WHERE "salary" < 105743 OR "eid" = 574489456 OR name != "Chad Stewart" UNION SELECT eid FROM employee WHERE "salary" > 205187 OR "eid" = 269734834


Question: What is the average user ID for users named Emily or with a user ID of 4 or greater, combined with the average user ID for users with a user ID greater than 1?

SELECT AVG(u_id) FROM useracct WHERE name = "Emily" OR "u_id" >= 4 UNION ALL SELECT AVG(u_id) FROM useracct WHERE "u_id" > 1


Question: Can you give me a list of driver IDs from the driver table where the driver ID is greater than 5, combined with a list of driver IDs from the school_bus table where the driver ID is not equal to 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 give me a list of driver IDs from the driver table, excluding driver ID 3, that are not also driver IDs from the school_bus table where the driver ID is 10 or less?

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


Question: Could you give me a list of member IDs that are both from the membership register branch with an ID of 6 or higher and a registration year other than 2016, and also from the purchase table with an ID of 3 or higher and a branch ID other than 1?

SELECT Member_ID FROM membership_register_branch WHERE "Member_ID" >= 6 AND Register_Year <> "2016" INTERSECT SELECT Member_ID FROM purchase WHERE "Member_ID" >= 3 AND Branch_ID <> "1"


Question: What is the average product ID for products with an ID of 2 or less, and what is the average product ID for products not associated with store ID 1?

SELECT AVG(Product_ID) FROM store_product WHERE "Product_ID" <= 2 UNION ALL SELECT AVG(Product_ID) FROM store_product WHERE "Store_ID" != 1


Question: What is the total of school IDs from the budget table where the invested amount is greater than 5840, combined with the total of school IDs from the endowment table where either the endowment ID is greater than 1, or the donator name is not "San José de Ocoa" and the amount is 8.43 and the school ID is less than or equal to 1?

SELECT SUM(School_id) FROM budget WHERE "Invested" > 5840 UNION SELECT SUM(School_id) FROM endowment WHERE "endowment_id" > 1 OR donator_name <> "San José de Ocoa" AND "amount" = 8.43 AND "School_id" <= 1


Question: Can you list the aircraft IDs that are less than 2, but exclude any aircraft IDs from the airport aircraft list that are greater than or equal to 2?

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


Question: Could you give me a list of document IDs from the Documents table where the document status is not "overdue", or the document ID is not 17 and the document type is not "CD", or the receipt date is not September 27, 1982 at 2:52 PM, combined with a list of document IDs from the Draft_Copies table where the document ID is less than or equal to 4 and the draft number is less than or equal to 9, or the copy number is less than 5?

SELECT document_id FROM Documents WHERE document_status_code <> "overdue" OR "document_id" <> 17 AND document_type_code != "CD" OR receipt_date != "1982-09-27 14:52:15" UNION ALL SELECT document_id FROM Draft_Copies WHERE "document_id" <= 4 AND "draft_number" <= 9 OR "copy_number" < 5


Question: What is the total of all branch IDs from the branch table where either the membership amount is not 31 or the address road is not Valleys Place and the name is not Saint Amant, combined with the total of all branch IDs from the membership register branch table where the register year is not 2016 and the branch ID is not 5?

SELECT SUM(Branch_ID) FROM branch WHERE membership_amount <> "31" OR Address_road <> "Valleys Place" AND Name <> "Saint Amant" UNION SELECT SUM(Branch_ID) FROM membership_register_branch WHERE Register_Year <> "2016" AND Branch_ID <> "5"


Question: Can you give me a list of store IDs that are either in district 15 or sell products with an ID of 4 or less?

SELECT Store_ID FROM store_district WHERE "District_ID" = 15 UNION ALL SELECT Store_ID FROM store_product WHERE "Product_ID" <= 4


Question: Can you list the continent with ID 5 from the continents table, and also list the continents from the countries table where the continent code is less than 2, the country ID is greater than 15, and the country name is "australia"?

SELECT Continent FROM continents WHERE "ContId" = 5 UNION ALL SELECT Continent FROM countries WHERE "Continent" < 2 AND "CountryId" > 15 AND CountryName = "australia"


Question: Can you list the genders and ranks of coaches with an ID of 4 or less, excluding female coaches, combined with the genders and ranks of players who are not ranked 1st, or are male, or are not named Niki Ashton, or live in Winnipeg?

SELECT Gender, Rank FROM coach WHERE "Coach_ID" <= 4 AND Gender <> "F" UNION ALL SELECT Gender, Rank FROM player WHERE Rank != "1st" OR Gender = "M" OR Player_name != "Niki Ashton" OR Residence = "Winnipeg"


Question: Can you list the aircraft IDs that appear more than once in the aircraft table, excluding those less than or equal to 1, combined with the aircraft IDs that appear more than once in the airport_aircraft table, excluding those equal to 5?

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 vehicle IDs from lessons where either the price is greater than 231 and the lesson time is 2, or the vehicle ID is at least 1, the lesson date is March 4th, 2018 at 6:55:46 AM, and the lesson ID is greater than 4, combined with a list of vehicle IDs from vehicles where the vehicle ID is at least 3?

SELECT vehicle_id FROM Lessons WHERE "price" > 231.0 AND lesson_time = "2" OR "vehicle_id" >= 1 AND lesson_date = "2018-03-04 06:55:46" AND "lesson_id" > 4 UNION ALL SELECT vehicle_id FROM Vehicles WHERE "vehicle_id" >= 3


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


Question: Can you give me a list of template type codes, excluding "PP" and those described as "Paper", but then remove any codes that are also found in templates with a version number less than 5 and non-empty template details, specifically if that code is "PPT"?

SELECT Template_Type_Code FROM Ref_Template_Types WHERE Template_Type_Code != "PP" AND Template_Type_Description <> "Paper" EXCEPT SELECT Template_Type_Code FROM Templates WHERE "Version_Number" < 5 AND Template_Details != "" AND Template_Type_Code = "PPT"


Question: Which driver IDs are greater than 4 and appear in both the driver and school_bus tables?

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


Question: Can you find the minimum first name, average last name, and date of birth for customers meeting certain criteria, and combine that with the same information for staff members who meet different criteria?

SELECT MIN(first_name), date_of_birth, AVG(last_name) FROM Customers WHERE "customer_address_id" < 9 AND first_name != "Genevieve" AND date_became_customer != "2016-02-17 08:26:23" OR "amount_outstanding" != 9332.0 OR date_of_birth <> "1993-02-07 05:40:26" AND email_address != "nichole59@example.com" AND customer_status_code <> "Good Customer" AND last_name <> "Terry" OR phone_number = "(297)122-0086" AND cell_mobile_phone_number <> "081-097-3684" UNION ALL SELECT MIN(first_name), date_of_birth, AVG(last_name) FROM Staff WHERE date_of_birth = "2015-08-01 13:22:43" OR date_joined_staff != "2017-02-20 18:45:20" OR nickname = "edwin.hudson" AND "staff_address_id" > 14 AND last_name != "Durgan" OR date_left_staff = "2018-03-01 17:10:03" AND first_name != "Camylle" OR "staff_id" <= 10


Question: Which driver IDs are both less than 7 and also 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 a list of driver IDs, excluding driver ID 1, that are not also driver ID 4 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 = 4


Question: How many airports are associated with each number of domestic passengers?

SELECT T1.Domestic_Passengers, COUNT(T2.Airport_ID) FROM airport as T1 JOIN airport_aircraft as T2 ON T1.Airport_ID = T2.Airport_ID


Question: Which members named Micah Johnson are not registered at any branch other than branch 2, considering member ID 1?

SELECT Member_ID FROM member WHERE Name = "Micah Johnson" EXCEPT SELECT Member_ID FROM membership_register_branch WHERE Branch_ID <> "2" AND "Member_ID" = 1


Question: Can you give me a list of driver IDs that are less than 5, but only those that are not also driver IDs less than or equal to 7 in the school bus list?

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


Question: Can you list the aircraft IDs from the aircraft table that are less than or equal to 4, and combine that with a list of aircraft IDs from the airport_aircraft table that are greater than or 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: What aircraft IDs, excluding aircraft ID 1, are present in the aircraft table but not in the airport_aircraft table, considering only aircraft IDs greater than or equal to 1 in the airport_aircraft table?

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


Question: Can you list all Aircraft IDs from the aircraft table that are greater than or equal to 5, and combine that with a list of Aircraft IDs from the airport_aircraft table that are 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 greater than 7 from the driver list and those equal to 9 from the school bus list?

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 document IDs from the drafts where either the document ID is 2, or the draft number is 2 and the draft details are not "m", but exclude any document IDs that are also in the documents received on "1983-09-26 09:32:56" with a document type code other than "CD" and a shipping agent code other than "UP", or that have a receipt number of "61" and a document ID less than 23?

SELECT document_id FROM Document_Drafts WHERE "document_id" = 2 OR "draft_number" = 2 AND draft_details != "m" EXCEPT SELECT document_id FROM Documents WHERE receipt_date = "1983-09-26 09:32:56" AND document_type_code <> "CD" AND shipping_agent_code != "UP" OR receipt_number = "61" AND "document_id" < 23


Question: Can you give me a list of driver IDs that are less than 5, but exclude driver ID 3?

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


Question: What are the total mascot count, IHSAA class, highest IHSAA football class, and latest location for schools with an enrollment of 601, excluding those values for schools with a school ID of 3 or located in Knox, unless they are in St. Joseph County?

SELECT SUM(Mascot), IHSAA_Class, MAX(IHSAA_Football_Class), MAX(Location) FROM School WHERE "Enrollment" = 601 EXCEPT SELECT SUM(Mascot), IHSAA_Class, MAX(IHSAA_Football_Class), MAX(Location) FROM School WHERE School_id = "3" OR Location = "Knox" AND County <> "71 St. Joseph"


Question: Which aircraft IDs, excluding aircraft ID 5, are also aircraft IDs greater than 1 that are associated with airports?

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


Question: Which driver IDs appear in both the driver table (excluding driver ID 11) and the school_bus table (only including driver IDs up to 4)?

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: Can you give me a list of driver IDs that are not equal to 3 from the driver table, excluding 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 != 3 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 from the driver table that are greater than 6, and those from the school_bus table that are less than 4?

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 list the driver IDs that are less than 8 from the driver table, and combine that with a list of driver IDs that are less than or equal to 10 from the school bus table, removing any duplicates?

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


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

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


Question: Can you give me the total vehicle ID from the Lessons table for entries where the customer ID is 13, or the lesson ID is less than 9 and the lesson status is completed, or the staff ID is less than 1, the vehicle ID is not 2, and the price is at least 352, or the lesson time is 5, combined with the total vehicle ID from the Vehicles table where the vehicle details are not "Car" or the vehicle ID is greater than 1?

SELECT SUM(vehicle_id) FROM Lessons WHERE "customer_id" = 13 OR "lesson_id" < 9 AND lesson_status_code = "Completed" OR "staff_id" < 1 AND "vehicle_id" <> 2 AND "price" >= 352.0 OR lesson_time = "5" UNION SELECT SUM(vehicle_id) FROM Vehicles WHERE vehicle_details != "Car" OR "vehicle_id" > 1


Question: What are the IHSAA classes and the total school name counts for schools in Bourbon, excluding school ID 1 and schools in class AA, minus the IHSAA classes and total school name counts for schools with enrollment less than or equal to 852, school ID 1, and located in Elkhart?

SELECT IHSAA_Class, SUM(School_name) FROM School WHERE School_id != "1" AND Location = "Bourbon" AND IHSAA_Class <> "AA" EXCEPT SELECT IHSAA_Class, SUM(School_name) FROM School WHERE "Enrollment" <= 852 AND School_id = "1" AND Location = "Elkhart"


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

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

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


Question: Can you list the aircraft IDs from the aircraft table that are less than or equal to 3, and combine that with a list of aircraft IDs from the airport_aircraft table that are greater than or equal to 1?

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


Question: Which aircraft IDs are both less than or equal to 5 and present in the airport aircraft list with an ID of 5?

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


Question: Can you give me a list of driver IDs, including those from the driver table that are not 11, and those from the school bus table that are less than 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: Can you give me a list of aircraft IDs that are less than 5 and appear in the aircraft table, and are also less than 3 and appear in the airport_aircraft table?

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


Question: Can you give me the smallest mailed-to address ID and the corresponding document ID from the Documents_Mailed table, first for entries where the mailed-to address ID is zero or negative, and then again for entries where the mailed-to address ID is zero or positive, or the document ID is greater than 4, or the mailing date is not February 21, 1973 at 10:17:01 AM?

SELECT MIN(mailed_to_address_id), document_id FROM Documents_Mailed WHERE "mailed_to_address_id" <= 0 UNION SELECT MIN(mailed_to_address_id), document_id FROM Documents_Mailed WHERE "mailed_to_address_id" >= 0 OR "document_id" > 4 OR mailing_date <> "1973-02-21 10:17:01"


Question: Can you list all the temporary acting statuses from the management table for departments with an ID of 15 or less, removing any duplicates?

SELECT temporary_acting FROM management WHERE "department_ID" <= 15 UNION SELECT temporary_acting FROM management WHERE "department_ID" <= 15


Question: Can you give me a list of aircraft IDs, including aircraft ID 5 from the aircraft table and aircraft ID 3 from the airport_aircraft table?

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, including Driver ID 11 from the driver table and Driver ID 4 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 = 4


Question: Can you give me a list of PetIDs and StuIDs from the Has_Pet table, including those where the PetID is greater than 2001, combined with those where the StuID is greater than 1002?

SELECT PetID, StuID FROM Has_Pet WHERE "PetID" > 2001 UNION SELECT PetID, StuID FROM Has_Pet WHERE "StuID" > 1002


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

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


Question: Can you give me a list of aircraft IDs that are less than 3 when looking at the aircraft table, but are not equal to 2 when looking at the airport_aircraft table?

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


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

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

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: Which driver IDs are both greater than or equal to 5 and appear in the driver table, and also greater than 7 and appear in the school_bus table?

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


Question: Can you give me a list of employee IDs from the evaluation table, excluding employee ID 2, but then remove any employee IDs that are in the hiring table if they started in 2013, have an employee ID of 3, or are not full-time?

SELECT Employee_ID FROM evaluation WHERE Employee_ID != "2" EXCEPT SELECT Employee_ID FROM hiring WHERE Start_from = "2013" OR "Employee_ID" = 3 OR Is_full_time <> "F"


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 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 12, excluding those driver IDs that are not equal to 3 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 <> 3


Question: Can you list all the driver IDs from the driver table that are less than or equal to 11, combined with all the 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 <= 11 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 10


Question: Can you give me a list of customer IDs from the payments made on February 15, 2018, at 4:38:49 PM, or where the payment amount wasn't $9414.74 and the customer ID was 12, or where the payment method wasn't Direct Debit, combined with a list of customer IDs from lessons with a lesson ID greater than 15?

SELECT customer_id FROM Customer_Payments WHERE datetime_payment = "2018-02-15 16:38:49" OR "amount_payment" != 9414.74 AND "customer_id" = 12 OR payment_method_code != "Direct Debit" UNION SELECT customer_id FROM Lessons WHERE "lesson_id" > 15


Question: Could you give me the ID, name, and nationality of people who are Russian, but not Aleksey Ostapenko, and who also don't have an ID of 7 or a height of 193, and weren't born on February 8, 1981, and who also have an ID less than 7, and are not Aleksey Ostapenko, or are not Russian, or are not 205 tall?

SELECT People_ID, Name, Nationality FROM people WHERE Name != "Aleksey Ostapenko" OR "People_ID" <> 7 AND "Height" <> 193.0 AND Birth_Date != "February 8, 1981" AND Nationality = "Russia" INTERSECT SELECT People_ID, Name, Nationality FROM people WHERE "People_ID" < 7 AND Name != "Aleksey Ostapenko" OR Nationality <> "Russia" OR "Height" <> 205.0


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

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


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


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

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


Question: Can you give me a list of driver IDs, combining those from the driver table that are not equal to 1 with those from the school bus table that are equal to 4, removing any duplicates?

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: Could you list all the Store IDs from the store district table, including those with a Store ID greater than 2 and a District ID less than 15, as well as those with a District ID equal to 15?

SELECT Store_ID FROM store_district WHERE "Store_ID" > 2 AND "District_ID" < 15 UNION ALL SELECT Store_ID FROM store_district WHERE "District_ID" = 15


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


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


Question: Can you tell me the smallest contestant name that is either Edwina Burnam with a contestant number of 9 or higher, or any contestant name other than Tabatha Gehling with a contestant number of 8?

SELECT MIN(contestant_name) FROM CONTESTANTS WHERE "contestant_number" >= 9 AND contestant_name = "Edwina Burnam" UNION ALL SELECT MIN(contestant_name) FROM CONTESTANTS WHERE contestant_name <> "Tabatha Gehling" AND "contestant_number" = 8


Question: Which driver IDs, that are 6 or greater, are in the driver table but not in the school_bus table if we only consider driver IDs that are 3 or greater 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 >= 3


Question: Could you show me the area code and vote ID, grouped by area code, where the phone number is 7148407040 and the creation date isn't March 9th, 2018 at 7:03:21 PM, or the vote ID is less than or equal to 1, considering data from the AREA_CODE_STATE and VOTES tables joined on matching state?

SELECT T1.area_code, T2.vote_id FROM AREA_CODE_STATE as T1 JOIN VOTES as T2 ON T1.state == T2.state GROUP BY area_code HAVING phone_number = 7148407040 AND created <> "2018-03-09 19:03:21" OR vote_id <= 1


Question: Can you give me a list of aircraft IDs that are less than or equal to 1, and also not equal to 3, based on the aircraft and airport_aircraft tables?

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


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

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


Question: Can you give me a list of aircraft IDs that are less than 4, but also not equal to 2 when looking at airport aircraft?

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: 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 aircraft IDs that are either not a Boeing 737-800 or have an ID less than 13, and also include aircraft IDs that are greater than 6?

SELECT aid FROM aircraft WHERE name <> "Boeing 737-800" OR "aid" < 13 UNION SELECT aid FROM aircraft WHERE "aid" > 6


Question: Which driver IDs are both less than or equal to 3 and also equal to 3 in the school bus records?

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


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

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


Question: Can you give me the smallest flight ID and the corresponding company ID for flights associated with airports, grouped by their ICAO code, where either the IATA code isn't "BLL", the date is "January 29, 1964", or the altitude is no more than 3650, the ICAO code isn't "EBBR", the airport ID is greater than 2, and the airport name is "Billund Airport", but only for groups with 6 or fewer ICAO codes?

SELECT MIN(T1.id), T2.company_id FROM airport as T1 JOIN flight as T2 ON T1.id = T2.id WHERE IATA <> "BLL" OR Date = "January 29, 1964" OR "Altitude" <= 3650.0 AND ICAO <> "EBBR" AND "airport_id" > 2 AND name = "Billund Airport" GROUP BY ICAO HAVING COUNT(ICAO) <= 6


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

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


Question: Can you give me a list of driver IDs, including those from the driver table that are greater than 10, and also including driver ID 3 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 a list of employee IDs who have either a draft number greater than 17 or a copy number of 10 or more, excluding those employees whose document ID is not 20, draft number is not 2, and employee ID is less than 1?

SELECT employee_id FROM Circulation_History WHERE "draft_number" > 17 OR "copy_number" >= 10 EXCEPT SELECT employee_id FROM Circulation_History WHERE "document_id" != 20 AND "draft_number" != 2 AND "employee_id" < 1


Question: Could you please list the destination, flight number, aircraft ID, arrival date, price, and departure date for flights that meet these criteria: either departing on "04/12/2005 09:15" or arriving on "04/12/2005 03:18" where the distance is not 1251, or originating from a city other than "Los Angeles", or using aircraft ID 6, or flight number 387 to "Chicago"; and also meet these criteria: going to "Tokyo", or using aircraft ID 7, or not originating from "Chicago", or costing something other than 220.98?

destination flno aid arrival_date price departure_date

SELECT destination, flno, aid, arrival_date, price, departure_date FROM flight WHERE departure_date = "04/12/2005 09:15" OR arrival_date = "04/12/2005 03:18" AND "distance" <> 1251 OR origin <> "Los Angeles" OR "aid" = 6 OR "flno" = 387 AND destination = "Chicago" INTERSECT SELECT destination, flno, aid, arrival_date, price, departure_date FROM flight WHERE destination = "Tokyo" OR "aid" = 7 OR origin != "Chicago" OR "price" != 220.98


Question: Can you list the aircraft IDs that are less than 3, grouping by aircraft ID, and also list the aircraft IDs that equal 2, grouping by aircraft ID, combining the two lists?

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


Question: Can you give me the IDs of aircraft that are less than 2, excluding those aircraft IDs less than 1 that are also associated with airports?

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


Question: Which driver IDs, excluding driver ID 9, appear in the driver table but not in the school_bus table?

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


Question: What aircraft IDs, excluding ID 1, are also aircraft IDs, excluding ID 2, found in the airport aircraft list?

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


Question: Can you list the market values in billions for companies that either have profits less than 20.6 billion and a market value greater than 164.3 billion, or are not headquartered in Russia, have assets greater than 328.7 billion, or have a company ID other than 9, with market values not equal to 208.4 billion?

SELECT Market_Value_in_Billion FROM company WHERE "Profits_in_Billion" < 20.6 GROUP BY Market_Value_in_Billion HAVING Market_Value_in_Billion > 164.3 UNION SELECT Market_Value_in_Billion FROM company WHERE Headquarters != "Russia" AND "Assets_in_Billion" > 328.7 OR "Company_ID" <> 9.0 GROUP BY Market_Value_in_Billion HAVING Market_Value_in_Billion != 208.4


Question: Can you give me a list of driver IDs from the driver table that are less than or equal to 10, combined with a list of driver IDs 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 list the aircraft IDs that are less than or equal to 4, excluding those aircraft IDs that are less than 2 and are also present in the airport aircraft list?

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


Question: Can you list the document IDs and mailed-to-address IDs for all records where the mailed-to-address ID is 2 or the document ID is 13, combined with the document IDs and mailed-to-address IDs for all records where the document ID is 4?

SELECT document_id, mailed_to_address_id FROM Documents_Mailed WHERE "mailed_to_address_id" = 2 OR "document_id" = 13 UNION SELECT document_id, mailed_to_address_id FROM Documents_Mailed WHERE "document_id" = 4


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

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


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

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


Question: Can you give me a list of driver IDs, including those from the driver table that are greater than 7, and those 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 > 7 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, where each ID is greater than 9, from the driver table, excluding any driver IDs that are also in the school_bus table and are greater than 3?

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


Question: Can you give me a list of driver IDs from the driver table that are less than or equal to 1, combined with a list of driver IDs from the school_bus table that are exactly 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: What is the highest employee ID from the evaluation table where the bonus is at least 3200 and the year awarded is not 2018 and the employee ID is not 2, combined with the highest employee ID from the hiring table where the start date is 2011?

SELECT MAX(Employee_ID) FROM evaluation WHERE "Bonus" >= 3200.0 AND Year_awarded <> "2018" AND Employee_ID <> "2" UNION SELECT MAX(Employee_ID) FROM hiring WHERE Start_from = "2011"


Question: Can you give me a list of aircraft IDs that are greater than 3, including those from the aircraft table and the airport_aircraft table, without duplicates?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID > 3 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, excluding driver ID 3, from the driver table, but only those driver IDs that are not in the school bus table, excluding driver ID 9?

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


Question: What is the total PetID and corresponding PetType from the Has_Pet and Pets tables, where the sum of StuID is less than or equal to 1001 or the sum of pet_age equals 3?

SELECT SUM(T1.PetID), T2.PetType FROM Has_Pet as T1 JOIN Pets as T2 ON T1.PetID = T2.PetID WHERE SUM(StuID) <= 1001 OR SUM(pet_age) = 3


Question: Could you give me a list of document IDs from the circulation history where either the copy number is 15 or less and the draft number isn't 1, or the document ID is greater than 2, or the employee ID isn't 1, but exclude any document IDs from the documents mailed table where either the mailing date isn't January 1st, 2007 at 10:32 PM, the document ID is greater than 14, or the mailed-to address ID is 3 or less?

SELECT document_id FROM Circulation_History WHERE "copy_number" <= 15 AND "draft_number" != 1 OR "document_id" > 2 OR "employee_id" != 1 EXCEPT SELECT document_id FROM Documents_Mailed WHERE mailing_date <> "2007-01-01 22:32:11" AND "document_id" > 14 OR "mailed_to_address_id" <= 3


Question: Can you give me a list of driver IDs that are 12 or greater, excluding driver ID 9 if it's a school bus driver?

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


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

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


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

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


Question: Can you give me the membership amount, name, branch ID, street address, city, and opening year for all branches that either didn't open in 2015 or aren't on Concord Road and aren't named Alexandre, but only for those branches with a branch ID less than 2?

SELECT membership_amount, Name, Branch_ID, Address_road, City, Open_year FROM branch WHERE Open_year <> "2015" OR Address_road <> "Concord Road" AND Name != "Alexandre" INTERSECT SELECT membership_amount, Name, Branch_ID, Address_road, City, Open_year FROM branch WHERE "Branch_ID" < 2


Question: Can you give me the total ID and company ID from the airport and flight tables, joining them on matching IDs, considering only flights with a velocity of 240 or more, grouped by altitude, and then filtering this to only include groups where the pilot isn't Thompson, the company ID is 5 or greater, the city isn't Brussels, the date isn't August 4, 1966, the ICAO isn't ENBR, the country is Spain, the altitude is 3650, the airport ID is 2 or less, the velocity is less than 240, or the IATA isn't AMS?

SELECT SUM(T1.id), T2.company_id FROM airport as T1 JOIN flight as T2 ON T1.id = T2.id WHERE "Velocity" >= 240.0 GROUP BY Altitude HAVING Pilot <> "Thompson" AND company_id >= 5 AND City <> "Brussels" OR Date <> "August 4, 1966" AND ICAO <> "ENBR" OR Country = "Spain" AND Altitude = 3650.0 OR airport_id <= 2 AND Velocity < 240.0 OR IATA <> "AMS"


Question: What are the average market values for companies with assets over 302.6 billion or market values under 132.4 billion, excluding those in the banking industry?

SELECT Assets_in_Billion, AVG(Market_Value_in_Billion) FROM company WHERE "Assets_in_Billion" > 302.6 OR "Market_Value_in_Billion" < 132.4 EXCEPT SELECT Assets_in_Billion, AVG(Market_Value_in_Billion) FROM company WHERE Industry = "Banking"


Question: Can you list all the driver IDs from the driver table that are less than or equal to 7, combined with all the 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 <= 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 from the driver table that are 5 or greater, excluding those driver IDs from the school_bus table that are greater than 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: Can you give me a list of driver IDs that are less than or equal to 1 from the driver table, excluding any driver IDs that are less than 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: Which driver IDs, when considering only driver ID 7 from the driver table, are not also driver ID 9 in the school bus table?

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


Question: What is the largest endowment ID for endowments where the school ID is 7, the donator name is "Santo Domingo Este", or the amount is at least 9.55, combined with the largest endowment ID for endowments where the donator name is "Com. Dom. En Estados Unidos" and the school ID is greater than 5?

SELECT MAX(endowment_id) FROM endowment WHERE "School_id" = 7 OR donator_name = "Santo Domingo Este" OR "amount" >= 9.55 UNION ALL SELECT MAX(endowment_id) FROM endowment WHERE donator_name = "Com. Dom. En Estados Unidos" AND "School_id" > 5


Question: Which aircraft IDs are both less than or equal to 4 and present in the aircraft table, and also greater than or equal to 3 and 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 >= 3


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

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


Question: Can you list all the product IDs where either the ID is less than 2 and the store ID is not 1, or the store ID is greater than 1 and the product ID is less than or equal to 4?

SELECT Product_ID FROM store_product WHERE "Product_ID" < 2 AND "Store_ID" != 1 UNION ALL SELECT Product_ID FROM store_product WHERE "Store_ID" > 1 AND "Product_ID" <= 4


Question: Can you give me the average first elected year, average delegate value, total election ID, and counties represented from the election table, combining results from two different sets of criteria: first, where the party is less than or equal to 2, or the election ID is greater than or equal to 2, and the counties represented is not "09.1 9A", the committee is not "Appropriations", the district is not 3, and the delegate is "Guzzone, Guy Guy Guzzone"; and second, where the election ID is not 3, or the delegate is not "Miller, Warren E. Warren E. Miller", or the committee is not "Appropriations", and the party is not 1, the district is less than 1, the counties represented is not "09.1 9A", and the first elected year is not 1994?

SELECT AVG(First_Elected), AVG(Delegate), SUM(Election_ID), Counties_Represented FROM election WHERE "Party" <= 2 OR "Election_ID" >= 2 AND Counties_Represented <> "09.1 9A" AND Committee != "Appropriations" AND "District" <> 3 AND Delegate = "Guzzone, Guy Guy Guzzone" UNION SELECT AVG(First_Elected), AVG(Delegate), SUM(Election_ID), Counties_Represented FROM election WHERE "Election_ID" != 3 AND Delegate != "Miller, Warren E. Warren E. Miller" OR Committee <> "Appropriations" OR "Party" <> 1 AND "District" < 1 AND Counties_Represented != "09.1 9A" AND "First_Elected" <> 1994.0


Question: Can you list the Aircraft IDs that are both less than or equal to 5 in the aircraft table and greater than 1 in the airport_aircraft table?

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


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

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 list the driver IDs that are less than 10 from the driver table, and combine that with a list of driver IDs that are greater than 7 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 > 7


Question: Could you list the template type descriptions and codes, excluding those with the code "BK" or the description "Paper", but also excluding any that have the description "Advertisement"?

SELECT Template_Type_Description, Template_Type_Code FROM Ref_Template_Types WHERE Template_Type_Code != "BK" AND Template_Type_Description <> "Paper" EXCEPT SELECT Template_Type_Description, Template_Type_Code FROM Ref_Template_Types WHERE Template_Type_Description <> "Advertisement"


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

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


Question: Can you give me a list of player IDs and their starting years from the player_coach table, including those players whose ID is not 14, as well as any players whose starting year is after 2012?

SELECT Player_ID, Starting_year FROM player_coach WHERE "Player_ID" != 14 UNION SELECT Player_ID, Starting_year FROM player_coach WHERE "Starting_year" > 2012


Question: What are the average names and IDs that appear in both the list of airports excluding those in Billund or Belgium or named "Billund Airport" or with an ID of 9, and the list of operating companies excluding those incorporated in Hong Kong or named "Dragonair Holidays" with a group equity shareholding of 100?

SELECT AVG(name), id FROM airport WHERE City <> "Billund" OR Country != "Belgium" OR name <> "Billund Airport" OR "id" != 9 INTERSECT SELECT AVG(name), id FROM operate_company WHERE Incorporated_in <> "Hong Kong" OR name = "Dragonair Holidays" AND "Group_Equity_Shareholding" = 100.0


Question: Can you give me a list of driver IDs, including those from the driver table that are greater than 4, 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 > 4 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 7


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


Question: Can you give me the Driver ID from the driver table that is equal to 6, excluding any Driver IDs from the school_bus table that are greater 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: What aircraft IDs are greater than 1 when grouped, excluding aircraft IDs that are not equal to 1 when grouped in the airport aircraft table?

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


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

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