Question: Can you list all aircraft IDs, including aircraft ID 5 from the aircraft table and all aircraft IDs except 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 aircraft IDs, up to and including 5, that appear in the aircraft table, but are not aircraft IDs less than 1 that appear in the airport_aircraft table?

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


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


Question: Can you list all aircraft IDs that are greater than 5 from the aircraft table, and combine that with a list of all aircraft IDs that are not equal to 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: What is the maximum height of people taller than 187 cm, and what are the corresponding poker player IDs?

SELECT MAX(T1.Height), T2.Poker_Player_ID FROM people as T1 JOIN poker_player as T2 ON T1.People_ID = T2.People_ID WHERE Height > 187.0


Question: Which driver IDs are not equal to 8 and also less than 4, considering only unique driver IDs from the driver and school bus tables?

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


Question: Can you give me a list of driver IDs from the driver table where the ID is 9 or higher, combined with a list of driver IDs from the school bus table where the ID is 10 or higher?

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


Question: Can you give me a list of aircraft IDs that are both aircraft IDs with the value 3 in the aircraft table and aircraft IDs with the value 3 in the airport_aircraft table?

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 that are both greater than or equal to 8 and also not 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 >= 8 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 7


Question: Which driver IDs are greater than 7 and also appear as driver IDs in the school bus table, excluding driver ID 7 from the school bus table?

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


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

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


Question: Which driver IDs appear exactly once as driver IDs in the driver table, specifically driver ID 7, but do not appear as 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: Could you give me the address IDs that are 9 or greater, excluding any address IDs that are less than 0?

SELECT address_id FROM Addresses WHERE "address_id" >= 9 NOT IN (SELECT address_id FROM Addresses WHERE "address_id" < 0)


Question: Can you give me the year, branch ID, total pounds, and member ID from purchases that are both from branches other than branch 5 and have a total pounds greater than 430.29?

SELECT Year, Branch_ID, Total_pounds, Member_ID FROM purchase WHERE Branch_ID != "5" INTERSECT SELECT Year, Branch_ID, Total_pounds, Member_ID FROM purchase WHERE "Total_pounds" > 430.29


Question: Can you give me a list of driver IDs, excluding driver ID 3, where each ID is less than 8 and appears at least once in the driver table?

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


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

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


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

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


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

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID < 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 that are less than or equal to 8, excluding those driver IDs that are also less than 4 and appear in the school bus records?

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 with the ID 11 from the driver table, and those with IDs less than 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 driver IDs that are 11 or less, excluding any driver IDs that also appear in the school bus list, except for driver ID 7?

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


Question: Can you give me the address IDs that are greater than or equal to 3, where the address details are not "PT", and are also not "MX"?

SELECT address_id FROM Addresses WHERE "address_id" >= 3 AND address_details != "PT" IN (SELECT address_id FROM Addresses WHERE address_details != "MX")


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

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


Question: Which driver IDs appear in the driver table, excluding driver ID 5, and also appear in the school_bus table with driver ID 7 or higher?

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: What is the average item ID of items where the ID is less than or equal to 3, or where the title is not "apple" and also not in the average item ID of items whose title is not "shampoo"?

SELECT AVG(i_id) FROM item WHERE "i_id" <= 3 OR title <> "apple" NOT IN (SELECT AVG(i_id) FROM item WHERE title <> "shampoo")


Question: Which driver IDs are not equal to 2 and are also less than 7?

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


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

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


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

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


Question: Which driver IDs are both equal to 10 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 = 10 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 4


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

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


Question: What is the smallest feature type code, excluding those with the name "Securiyt, eg Burglar Alarm.", and also the smallest feature type code when either the code is not "Security" or the name is not "Amenity, eg Pool."?

SELECT MIN(feature_type_code) FROM Ref_Feature_Types WHERE feature_type_name <> "Securiyt, eg Burglar Alarm." UNION ALL SELECT MIN(feature_type_code) FROM Ref_Feature_Types WHERE feature_type_code != "Security" OR feature_type_name != "Amenity, eg Pool."


Question: Can you list all continents from the continents table, excluding Australia and only including those with a ContId greater than 3, and also list the continent with ID 4 from the countries table, but only if the country name is Brazil and the CountryId is not 11?

SELECT Continent FROM continents WHERE Continent != "australia" AND "ContId" > 3 UNION ALL SELECT Continent FROM countries WHERE "Continent" = 4 AND CountryName = "brazil" AND "CountryId" <> 11


Question: What allergies, excluding nuts, are associated with allergy types other than food, but are not associated with any allergies besides ragweed or students with IDs less than 1021?

SELECT Allergy FROM Allergy_Type WHERE AllergyType <> "food" AND Allergy <> "Nuts" EXCEPT SELECT Allergy FROM Has_Allergy WHERE Allergy != "Ragweed" OR "StuID" < 1021


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

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


Question: Which aircraft IDs, excluding aircraft ID 4, are also aircraft IDs that are greater than or equal to 3 and are associated with airports?

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: What is the largest airport name, first excluding those with IATA code "BCN" and located in "Baltimore", and then separately, considering all airports with an ID less than 6, or with IATA code "BCN", or not in "Spain", or not in "Baltimore", and finally combining the results to give me the largest name from each of those two groups?

SELECT MAX(name) FROM airport WHERE IATA <> "BCN" AND City <> "Baltimore" UNION SELECT MAX(name) FROM airport WHERE "id" < 6 OR IATA = "BCN" OR Country <> "Spain" OR City <> "Baltimore"


Question: What is the highest certificate ID where the employee ID is less than or equal to 141582651 and the certificate ID is not 5, combined with the highest flight ID where the price is not 235.98, or the origin is not Los Angeles, or the distance is less than or equal to 2551 and the arrival date is "04/12/2005 03:55", or the destination is not Washington D.C.?

SELECT MAX(aid) FROM certificate WHERE "eid" <= 141582651 AND "aid" != 5 UNION ALL SELECT MAX(aid) FROM flight WHERE "price" != 235.98 OR origin != "Los Angeles" OR "distance" <= 2551 AND arrival_date = "04/12/2005 03:55" OR destination != "Washington D.C."


Question: Can you give me the weight, age, and type of pets, excluding those with PetID 2003, or a weight less than or equal to 12, or an age not equal to 2, or a type other than "dog", but then remove any results where the pet type is not "cat"?

SELECT weight, pet_age, PetType FROM Pets WHERE "PetID" <> 2003 OR "weight" <= 12.0 OR "pet_age" <> 2 OR PetType != "dog" EXCEPT SELECT weight, pet_age, PetType FROM Pets WHERE PetType != "cat"


Question: Can you give me a list of driver IDs that are greater than or equal to 2, excluding those driver IDs that are also greater than 10 and associated with a school bus?

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


Question: Which driver IDs are both greater than or equal to 6 in the driver table and equal to 10 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 = 10


Question: Can you list the feature description, name, ID, and type code for all available features, excluding those with a description of "Burglar Alarm" or a name of "BurglarAlarm", and also include features with a description of "Air Conditioning.", a type code of "Amenity", a name other than "BurglarAlarm", and an ID less than 4?

SELECT feature_description, feature_name, feature_id, feature_type_code FROM Other_Available_Features WHERE feature_description <> "Burglar Alarm" OR feature_name <> "BurglarAlarm" UNION SELECT feature_description, feature_name, feature_id, feature_type_code FROM Other_Available_Features WHERE feature_description = "Air Conditioning." AND feature_type_code = "Amenity" AND feature_name <> "BurglarAlarm" AND "feature_id" < 4


Question: Can you list the aircraft IDs that are less than 3 from the aircraft table, combined with the aircraft IDs that are less than or equal to 5 from the airport_aircraft table, removing any duplicates?

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


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

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


Question: Can you list the Aircraft IDs that are greater than or equal to 5 from the aircraft table, and also include the Aircraft ID 1 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 = 1


Question: Can you give me a list of driver IDs, combining those from the driver table excluding driver ID 7, with those from the school bus table including only driver IDs greater 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, excluding driver ID 12, from the driver table, but only those driver IDs that are not also in the school bus table where the driver ID is less than 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: 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 album IDs where the album title is not "A Matter of Life and Death", combined with a list of media type IDs where the media type name is "MPEG audio file"?

SELECT id FROM albums WHERE title != "A Matter of Life and Death" UNION SELECT id FROM media_types WHERE name = "MPEG audio file"


Question: Which driver IDs, excluding driver ID 6, appear in the driver table but not among driver IDs greater than or equal to 9 in the school bus table?

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


Question: Can you list the distance and name for all aircraft that are either Airbus A340-300s or have a distance that isn't 2605, combined with the distance and name for all aircraft that aren't SAAB 340s?

SELECT distance, name FROM aircraft WHERE name = "Airbus A340-300" OR "distance" != 2605 UNION SELECT distance, name FROM aircraft WHERE name != "SAAB 340"


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

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


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

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


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

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


Question: Can you give me the name, ID, nationality, graduation college, and age of all people who are either 31 years old or from the United States, along with the same information for people who did not graduate from Northeastern and are 27 years old or younger?

SELECT Name, People_ID, Nationality, Graduation_College, Age FROM people WHERE "Age" = 31 OR Nationality = "United States" UNION ALL SELECT Name, People_ID, Nationality, Graduation_College, Age FROM people WHERE Graduation_College != "Northeastern" AND "Age" <= 27


Question: Which aircraft IDs, other than 5, are present in both the aircraft table and 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 <> 5


Question: Can you give me a list of driver IDs, excluding driver ID 6, that are in the driver table but not in the school bus table where the driver ID is 4 or greater?

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


Question: Can you give me a list of driver IDs, excluding driver ID 1, from the driver table, but only those driver IDs that are not also in the school bus table where the driver ID is less than or 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: What document status descriptions are both "currently working on" and not associated with an overdue code, or are different from "currently working on"?

SELECT document_status_description FROM Ref_Document_Status WHERE document_status_description = "currently working on" INTERSECT SELECT document_status_description FROM Ref_Document_Status WHERE document_status_code <> "overdue" OR document_status_description != "currently working on"


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 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 a list of driver IDs, where each ID is less than 8, excluding those driver IDs that are less than or equal to 4 and are also in the school bus driver list?

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


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

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


Question: Which driver IDs are greater than 1 and also greater than 9, 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 > 9


Question: Could you list the description of each aircraft along with its corresponding ID from the airport?

SELECT T1.Description, T2.ID FROM aircraft as T1 JOIN airport_aircraft as T2 ON T1.Aircraft_ID = T2.Aircraft_ID


Question: Can you give me a list of driver IDs, including those from the driver table excluding driver ID 8, 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 != 8 UNION 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 1, and combine that with a list of aircraft IDs from the airport_aircraft table that are greater than 1, removing any duplicates?

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 from the driver table, excluding driver ID 4, that are not also driver IDs less than 3 in the school_bus table?

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


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

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


Question: Can you give me the IDs of drivers with IDs greater than 6, excluding those driver IDs that are also in the school bus table and are greater than or equal to 7?

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


Question: What are the average shipping agent codes for each shipping agent name, both for agents whose code is not "AL" and whose description is not "w", and separately for agents whose description is "q"?

SELECT shipping_agent_name, AVG(shipping_agent_code) FROM Ref_Shipping_Agents WHERE shipping_agent_code != "AL" AND shipping_agent_description != "w" UNION ALL SELECT shipping_agent_name, AVG(shipping_agent_code) FROM Ref_Shipping_Agents WHERE shipping_agent_description = "q"


Question: How many features are associated with each property, considering only features that are not described as "odio" and are not named "Pool", or if the feature description is "Swimming Pool"?

SELECT COUNT(T1.feature_id), T2.property_id FROM Other_Available_Features as T1 JOIN Other_Property_Features as T2 ON T1.feature_id = T2.feature_id WHERE property_feature_description <> "odio" AND feature_name <> "Pool" OR feature_description = "Swimming Pool."


Question: Can you list the aircraft IDs, including those with an ID of 1 from the aircraft table, and those with an ID of 3 or less 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 a list of driver IDs that are both less than or equal to 12 and also greater than or equal to 3?

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


Question: Can you show me the Member ID, Branch ID, earliest year, and total pounds from the purchase table for purchases made in 2017, and also for purchases where the Branch ID is 1 and the total pounds are at least 402.1, or the Member ID is 2, or the year is not 2018?

SELECT Member_ID, Branch_ID, MIN(Year), Total_pounds FROM purchase WHERE Year = "2017" UNION ALL SELECT Member_ID, Branch_ID, MIN(Year), Total_pounds FROM purchase WHERE Branch_ID = "1" AND "Total_pounds" >= 402.1 OR "Member_ID" = 2 OR Year != "2018"


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

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


Question: What is the total of all Company IDs for companies with sales of at least 62.4 billion, that are not named Wells Fargo, have a Company ID of 8 or less, assets not equal to 213 billion, and a market value of at least 107.5 billion, combined with the total of all Company IDs for companies with assets of 331.1 billion or a market value of at least 201.9 billion?

SELECT SUM(Company_ID) FROM company WHERE "Sales_in_Billion" >= 62.4 AND Name <> "Wells Fargo" AND "Company_ID" <= 8.0 AND "Assets_in_Billion" != 213.0 AND "Market_Value_in_Billion" >= 107.5 UNION ALL SELECT SUM(Company_ID) FROM company WHERE "Assets_in_Billion" = 331.1 OR "Market_Value_in_Billion" >= 201.9


Question: Can you give me a list of album IDs where the artist ID is 197 or the album ID is 29 or less, combined with a list of media type IDs that are 5 or less?

SELECT id FROM albums WHERE "artist_id" = 197 OR "id" <= 29 UNION SELECT id FROM media_types WHERE "id" <= 5


Question: Can you list the driver IDs that are greater than or equal to 7 from the driver table, and combine that with a list of 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 >= 7 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 9


Question: Can you give me a list of employee IDs for employees in Sale who are 32 or younger, combined with a list of employee IDs from hiring records that started in 2012 and are not associated with shop ID 1?

SELECT Employee_ID FROM employee WHERE City = "Sale" AND "Age" <= 32 UNION SELECT Employee_ID FROM hiring WHERE Start_from = "2012" AND "Shop_ID" != 1


Question: Could you list the Aircraft IDs that are less than 2 when grouped in the aircraft table, but also less than or equal to 3 when grouped in the airport_aircraft table?

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


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

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 give me a list of driver IDs that are both less than or equal to 8 and not equal to 3, considering only the unique driver IDs from the driver and school_bus tables?

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


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

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 lowest rank among coaches who are either not male and associated with a club ID of 3 or higher, or have a coach ID of 3 or higher, excluding the lowest rank among coaches who are associated with a club ID greater than 1 or are male?

SELECT MIN(Rank) FROM coach WHERE Gender <> "M" AND "Club_ID" >= 3 OR "Coach_ID" >= 3 EXCEPT SELECT MIN(Rank) FROM coach WHERE "Club_ID" > 1 OR Gender = "M"


Question: Can you list all branch names that are either not in London and have a Branch ID less than 6, or are not named Cochrane, along with all member names that don't have a Level of 6?

SELECT Name FROM branch WHERE City <> "London" AND "Branch_ID" < 6 OR Name <> "Cochrane" UNION ALL SELECT Name FROM member WHERE "Level" != 6


Question: What is the smallest aircraft name that is both not 6441 in distance and also at least 520 in distance, excluding the Lockheed L1011?

SELECT MIN(name) FROM aircraft WHERE "distance" <> 6441 INTERSECT SELECT MIN(name) FROM aircraft WHERE "distance" >= 520 AND name <> "Lockheed L1011"


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

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


Question: Can you give me a list of aircraft IDs that are less than 3, excluding those aircraft IDs that also appear in the airport aircraft list with an ID of 2?

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


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

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


Question: Can you list all the aircraft IDs from the aircraft table that are greater than or equal to 4, and combine that with a list of all 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 >= 4 UNION SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID >= 1


Question: Can you give me a list of vehicle IDs that are 3 or greater and not a truck, combined with a list of vehicle IDs that are greater than 2?

SELECT vehicle_id FROM Vehicles WHERE "vehicle_id" >= 3 AND vehicle_details <> "Truck" UNION ALL SELECT vehicle_id FROM Vehicles WHERE "vehicle_id" > 2


Question: Which driver IDs are present in both the driver list (excluding driver 8) and the school bus list (excluding driver 4)?

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


Question: Can you tell me the store name, average store ID, ranking, and average type for stores that either have a store ID of 2 and a ranking of 9 or higher, or are not a City Mall type, or are named Rogersville and have a number of product categories not equal to 1170, combined with the store name, average store ID, ranking, and average type for stores that are not Village Stores or have a store ID of 3 or higher and are not named Blackville?

SELECT Store_Name, AVG(Store_ID), Ranking, AVG(Type) FROM store WHERE "Store_ID" = 2 AND "Ranking" >= 9 OR Type <> "City Mall" OR Store_Name = "Rogersville" AND "Number_of_product_category" != 1170.0 UNION SELECT Store_Name, AVG(Store_ID), Ranking, AVG(Type) FROM store WHERE Type != "Village Store" OR "Store_ID" >= 3 AND Store_Name <> "Blackville"


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

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


Question: Can you list the distance and ID for aircraft with a distance less than 4103 and a name other than Boeing 747-400 and an ID less than or equal to 8, along with the distance and ID for flights with a distance less than or equal to 802?

SELECT distance, aid FROM aircraft WHERE "distance" < 4103 AND name <> "Boeing 747-400" AND "aid" <= 8 UNION ALL SELECT distance, aid FROM flight WHERE "distance" <= 802


Question: Can you list the aircraft IDs, excluding aircraft ID 4, that are not also aircraft IDs, excluding aircraft ID 5, found in the airport aircraft table?

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


Question: Can you list all the aircraft IDs, combining those from the aircraft table that aren't 3 with those from the airport_aircraft table that are 3 or greater?

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: What is the highest book ID for books titled "Gemini Blood" or those that don't have 12 issues and aren't written by Dave Gibbons, or have a book ID less than 10, combined with the highest book ID for books that have exactly 12 issues, aren't titled "Cyberella", and don't have a book ID of 8?

SELECT MAX(Book_ID) FROM book WHERE Title = "Gemini Blood" OR "Issues" <> 12.0 AND Writer != "Dave Gibbons" OR "Book_ID" < 10 UNION ALL SELECT MAX(Book_ID) FROM book WHERE "Issues" = 12.0 AND Title != "Cyberella" AND "Book_ID" <> 8


Question: Can you give me a list of driver IDs that are not 7, where each ID appears at least once in the driver table, excluding any driver IDs that are greater than 9 and appear at least once 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: Which aircraft have an ID of 1 and also have an ID less than or equal to 3 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 <= 3


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

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


Question: Which driver has an ID of 4 and also has a driver ID less than or equal to 10 on a school bus?

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


Question: Can you list all the aircraft IDs, excluding aircraft ID 2, from both the aircraft and airport_aircraft lists?

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


Question: Can you give me a list of driver IDs, excluding driver ID 1 from the driver table and driver ID 7 from the school_bus table, making sure there are no 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 <> 7


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

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


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 less than or equal to 10, 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 <= 10


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

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


Question: Can you list the aircraft IDs that are less than 1, and also list the aircraft IDs from the airport aircraft table that are not 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 the largest People ID from the 'people' table where either the height is at least 193 cm, or the birth date is not May 26, 1986 and the name is not Roman Bragin, or the People ID is 7, or the nationality is Russia, but only if it's also the largest Poker Player ID from the 'poker_player' table where either the earnings are greater than 596462, or the money rank is not 141 and the final tables made are less than 19, or the Poker Player ID is greater than 1?

SELECT MAX(People_ID) FROM people WHERE "Height" >= 193.0 OR Birth_Date != "May 26, 1986" AND Name <> "Roman Bragin" OR "People_ID" = 7 OR Nationality = "Russia" INTERSECT SELECT MAX(People_ID) FROM poker_player WHERE "Earnings" > 596462.0 OR "Money_Rank" != 141.0 AND "Final_Table_Made" < 19.0 OR "Poker_Player_ID" > 1


Question: What are the bed types for room IBD, and also the bed types for any room that isn't decorated in a traditional style?

SELECT bedType FROM Rooms WHERE RoomId = "IBD" UNION SELECT bedType FROM Rooms WHERE decor <> "traditional"


Question: Can you list all address IDs and their details, including those with address details equal to "ES", combined with all other addresses where the address details are not "ES" or the address ID is not 0?

SELECT address_id, address_details FROM Addresses WHERE address_details = "ES" UNION SELECT address_id, address_details FROM Addresses WHERE address_details <> "ES" OR "address_id" <> 0


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

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


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

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 driver IDs that are greater than 7 from the driver table, combined with the driver IDs that are less than 9 from the school_bus table?

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


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

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


Question: Can you give me the Driver ID from the driver table, where the Driver ID is 1, excluding any Driver IDs from the school_bus table that are not 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: Can you list the aircraft IDs that are less than 4 from the aircraft table, and also include the aircraft ID that is exactly 5 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 = 5


Question: Can you give me a list of driver IDs that are equal to 7 from the driver table, combined with a list of 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 = 7 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 2, but exclude any driver IDs from the school bus list that are not equal to 4?

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


Question: Can you list all the continents from the continents table where the continent ID is greater than 5 and the continent name is not Asia, and also include the continent from the countries table where the country name is Russia or the country ID is less than or equal to 10?

SELECT Continent FROM continents WHERE "ContId" > 5 AND Continent != "asia" UNION ALL SELECT Continent FROM countries WHERE CountryName = "russia" OR "CountryId" <= 10


Question: What is the sum of Club IDs for clubs that either started in 2009 or later, or have a Club ID less than 4, combined with the sum of Club IDs from match results where either the number of small silver medals is 10 or more, or the number of gold medals is not 12, the points are not 66, the rank is 4 or higher, the Club ID is 5, and the number of big silver medals is less than 7, or the number of bronze medals is 8 or more?

SELECT SUM(Club_ID) FROM club WHERE "Start_year" >= 2009 OR "Club_ID" < 4 UNION ALL SELECT SUM(Club_ID) FROM match_result WHERE "Small_Silver" >= 10 OR "Gold" != 12 AND "Points" != 66 AND "Rank" >= 4 AND "Club_ID" = 5 AND "Big_Silver" < 7 OR "Bronze" >= 8


Question: Can you give me the IDs of drivers who have IDs less than or equal to 10 and also have IDs greater than 7 in the school bus data?

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 from the driver table that are greater than or equal to 7, excluding any driver IDs that are equal to 4 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 = 4


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

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


Question: Can you give me the party affiliation and name of drivers who meet these conditions: either their ID is less than 8, or they don't live in East Hartford and are older than 40, or their name isn't Minnie Gonzalez; and also, their ID isn't 1, or they aren't affiliated with the Rep party?

SELECT Party, Name FROM driver WHERE "Driver_ID" < 8 OR Home_city <> "East Hartford" AND "Age" > 40 OR Name <> "Minnie Gonzalez" INTERSECT SELECT Party, Name FROM driver WHERE "Driver_ID" <> 1 OR Party != "Rep"


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

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


Question: Can you give me a list of user IDs from reviews with ratings of 10 or less and an associated ID of 4 or more, combined with a list of user IDs for users named Emily?

SELECT u_id FROM review WHERE "rating" <= 10 AND "a_id" >= 4 UNION SELECT u_id FROM useracct WHERE name = "Emily"


Question: Can you list all the aircraft IDs, first from the aircraft table excluding aircraft ID 3, and then from the airport_aircraft table including only aircraft IDs up to 5?

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 driver IDs, excluding driver ID 3, where each listed driver ID is greater than 1 and appears more than once in the driver 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 = 3


Question: Which driver IDs, excluding driver ID 6, appear in the driver table but not in the school_bus table where the driver ID is 4?

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


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

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


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

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


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

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


Question: Can you give me the driver IDs that are both less than or equal to 6 and not equal to 9, considering only the unique driver IDs from the driver and school_bus tables?

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


Question: What is the smallest PetID from the Has_Pet table where the PetID is at least 2001 or the StuID is not 1001, excluding the smallest PetID from the Pets table where the pet is not a dog, the PetID is 2002, and the pet's age is at least 3?

SELECT MIN(PetID) FROM Has_Pet WHERE "PetID" >= 2001 OR "StuID" <> 1001 EXCEPT SELECT MIN(PetID) FROM Pets WHERE PetType != "dog" AND "PetID" = 2002 AND "pet_age" >= 3


Question: Can you give me a list of driver IDs, first from the driver table excluding driver ID 7, and then from the school_bus table including only driver IDs less than 7, removing any duplicates?

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


Question: What is the sum of school IDs for schools that are not private or are not 4th grade, combined with the sum of school IDs from the school bus table where the school ID is greater than 1, or the driver ID is not 3, or the driver is not full-time and has not worked for 3 years?

SELECT SUM(School_ID) FROM school WHERE Type != "Private" OR Grade <> "4th grade" UNION SELECT SUM(School_ID) FROM school_bus WHERE "School_ID" > 1 OR "Driver_ID" <> 3 OR If_full_time = "F" AND "Years_Working" <> 3


Question: Could you give me the document name, highest template ID, average other details, and document ID for all documents, excluding those with document descriptions not equal to "r" and document IDs greater than 651512, and including only those documents where the document name isn't "Summer Show", the document description isn't "h", or the template ID is less than or equal to 1?

SELECT Document_Name, MAX(Template_ID), AVG(Other_Details), Document_ID FROM Documents WHERE Document_Name != "Summer Show" OR Document_Description != "h" OR "Template_ID" <= 1 EXCEPT SELECT Document_Name, MAX(Template_ID), AVG(Other_Details), Document_ID FROM Documents WHERE Document_Description != "r" AND "Document_ID" > 651512


Question: Can you give me a list of driver IDs that appear in both the driver table, excluding driver ID 10, and the school bus table, including only driver IDs greater than or equal to 3?

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


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

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


Question: Can you give me a list of driver IDs that are 11 or greater, excluding any driver IDs less than 9 that 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 list all the role codes from employees who are not named Kenyon, or have "h" in their other details and an employee ID less than or equal to 1, or have a role code of "PT", along with all the role codes from roles that don't have "Photo" as their description?

SELECT role_code FROM Employees WHERE employee_name <> "Kenyon" OR other_details = "h" AND "employee_id" <= 1 OR role_code = "PT" UNION SELECT role_code FROM Roles WHERE role_description <> "Photo"


Question: Can you show me the Template ID, Document Name, the sum of Document Descriptions, the earliest Other Details, and Document ID from the Documents table, combining two sets of results: first, where the Document ID is greater than 76, or the Document Name is "Do not panic", or the Template ID is less than or equal to 6 and Other Details is "None"; and second, where the Template ID is less than or equal to 25, or the Document Name is not "How Google people work"?

SELECT Template_ID, Document_Name, SUM(Document_Description), MIN(Other_Details), Document_ID FROM Documents WHERE "Document_ID" > 76 OR Document_Name = "Do not panic" OR "Template_ID" <= 6 AND Other_Details = "None" UNION ALL SELECT Template_ID, Document_Name, SUM(Document_Description), MIN(Other_Details), Document_ID FROM Documents WHERE "Template_ID" <= 25 OR Document_Name <> "How Google people work"


Question: What is the sum of the People IDs for individuals named Brad Lohaus, combined with the sum of People IDs for those who are not from the United States, or are 34 or younger, or have a People ID of 7 or greater, or did not graduate from Oklahoma, or are not named Darryl Kennedy?

SELECT SUM(People_ID) FROM people WHERE Name = "Brad Lohaus" UNION ALL SELECT SUM(People_ID) FROM people WHERE Nationality != "United States" OR "Age" <= 34 OR "People_ID" >= 7 OR Graduation_College != "Oklahoma" OR Name != "Darryl Kennedy"


Question: Can you list all the animal allergies from the Allergy_Type table, and also list all allergies, except for Tree Pollen, from the Has_Allergy table for students with an ID less than 1010?

SELECT Allergy FROM Allergy_Type WHERE AllergyType = "animal" UNION ALL SELECT Allergy FROM Has_Allergy WHERE "StuID" < 1010 AND Allergy != "Tree Pollen"


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

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


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

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


Question: Can you give me a list of driver IDs less than or equal to 9, excluding any driver IDs that appear in the school bus list, except for driver ID 3?

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


Question: What aircraft IDs appear exactly once in the aircraft table and are not aircraft ID 2 in the airport_aircraft table?

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


Question: What is the average store ID for stores in the district table with an ID of 2 or greater, excluding the average store ID for products in the store_product table where the store ID is not 3?

SELECT AVG(Store_ID) FROM store_district WHERE "Store_ID" >= 2 EXCEPT SELECT AVG(Store_ID) FROM store_product WHERE "Store_ID" <> 3


Question: Can you give me a list of driver IDs that are not equal to 10, where each ID appears at least once in the driver table, excluding any driver IDs that are less than or equal to 3 and appear at least once in the school bus table?

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


Question: Could you give me a list of district IDs from the district table, excluding Kasur District and including those headquartered in Gujrat City or with a city population not equal to 365198 or a city area of 10 or more, but then remove any district IDs that are also in the store_district table where the store ID is less than 4 and the district ID is greater than 11?

SELECT District_ID FROM district WHERE District_name != "Kasur District" OR Headquartered_City = "Gujrat City" AND "City_Population" != 365198.0 OR "City_Area" >= 10.0 EXCEPT SELECT District_ID FROM store_district WHERE "Store_ID" < 4 AND "District_ID" > 11


Question: Can you give me a list of driver IDs from the driver table where the driver ID is 8 or greater, combined with a list of driver IDs from the school bus table where the driver ID is exactly 10?

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: What aircraft IDs, excluding ID 3, are in the aircraft table but not in the airport_aircraft table, also excluding ID 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 aircraft IDs, including those from the aircraft table that aren't 4, and those from the airport_aircraft table that are 1 or greater?

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: Can you give me a list of driver IDs that are 12 or less, and also not equal to 4, based on the drivers and school buses?

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


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


Question: Can you give me a list of driver IDs that are greater than 1 and also not equal to 7, 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 > 1 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 less than 4 from the driver list and those greater than or equal to 9 from the school bus 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: Can you list all the aircraft IDs, first from the aircraft table excluding aircraft ID 4, and then from the airport_aircraft table including only aircraft IDs up to 2, 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 <= 2


Question: Could you give me a list of driver IDs that are both less than or equal to 11 and also greater than 9, considering only unique driver IDs from the driver and school_bus tables?

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


Question: Can you give me the sex, city code, last name, first name, student ID, age, advisor, and major for all students who meet both of these conditions: first, their student ID is 1005 or greater, their major is 50 or less, their age is not 21, their first name is not Paul, their advisor is less than 8772, their city code is BAL, and their last name is not Lee; and second, their last name is not Prater or their sex is male?

Sex city_code LName Fname StuID Age Advisor Major

SELECT Sex, city_code, LName, Fname, StuID, Age, Advisor, Major FROM Student WHERE "StuID" >= 1005 OR "Major" <= 50 OR "Age" <> 21 AND Fname != "Paul" AND "Advisor" < 8772 AND city_code = "BAL" AND LName != "Lee" INTERSECT SELECT Sex, city_code, LName, Fname, StuID, Age, Advisor, Major FROM Student WHERE LName != "Prater" OR Sex = "M"


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 7 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 less than 7 that appear in the driver table, excluding those driver IDs less than 4 that appear 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 < 4


Question: What is the difference between the total student IDs of those with any allergy other than eggs or a student ID not equal to 1018, and the total student IDs of students who don't have major 550, or are not 19, or have a student ID that is not 1014, and whose advisor is not 7134, or are not female, and whose first name is Eric, and whose city code is not PHL, or whose last name is not Kim?

SELECT SUM(StuID) FROM Has_Allergy WHERE Allergy <> "Eggs" OR "StuID" != 1018 EXCEPT SELECT SUM(StuID) FROM Student WHERE "Major" != 550 OR "Age" != 19 OR "StuID" <> 1014 AND "Advisor" != 7134 OR Sex <> "F" AND Fname = "Eric" AND city_code != "PHL" OR LName <> "Kim"


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

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


Question: Can you list the aircraft IDs that are equal to 4 in the aircraft table, combined with the aircraft IDs that are not equal to 1 in 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 != 1


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

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


Question: Can you list the driver IDs, including those from the driver table that are greater than 4 and those from the school_bus table that are less than 4?

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


Question: Can you find the earliest starting year, coach ID, and player ID from the player_coach table, combining two sets of results: one where the starting year is 2011 or later and the coach ID is less than 5, and another where the starting year is 2010 or earlier, or the coach ID is 2, or the player ID is not 1?

SELECT MIN(Starting_year), Coach_ID, Player_ID FROM player_coach WHERE "Starting_year" >= 2011 AND "Coach_ID" < 5 UNION ALL SELECT MIN(Starting_year), Coach_ID, Player_ID FROM player_coach WHERE "Starting_year" <= 2010 OR "Coach_ID" = 2 OR "Player_ID" <> 1


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


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

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


Question: Can you give me a list of driver IDs that are less than 4 and also less than or 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 employee IDs, including those who have handled at least four copies in the circulation history, and also those who are named Erling and don't have the role code "PR"?

SELECT employee_id FROM Circulation_History WHERE "copy_number" >= 4 UNION ALL SELECT employee_id FROM Employees WHERE role_code != "PR" AND employee_name = "Erling"


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

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


Question: How many aircraft are associated with each airport?

SELECT COUNT(T1.Aircraft_ID), T2.Airport_ID FROM aircraft as T1 JOIN airport_aircraft as T2 ON T1.Aircraft_ID = T2.Aircraft_ID


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

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


Question: Which aircraft IDs are not equal to 3 and appear in the aircraft table, and are also not equal to 2 and appear in 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, including those from the driver table excluding driver ID 6, and those from the school bus table with driver IDs up to 10?

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


Question: Can you give me a list of driver IDs that are less than 12, and also include driver ID 4?

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


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


Question: Can you give me the IDs of drivers that are both less than 12 and greater than 4?

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


Question: Can you list the aircraft IDs that are greater than or equal to 2 when grouped in the aircraft table, and also list the aircraft IDs that are less than or equal to 3 when grouped in the airport_aircraft table?

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


Question: Could you list the company IDs from the company table where the assets in billions are not 213 and the company ID is greater than 5, combined with the company IDs from the employment table where the people ID is less than 1?

SELECT Company_ID FROM company WHERE "Assets_in_Billion" <> 213.0 AND "Company_ID" > 5.0 UNION ALL SELECT Company_ID FROM employment WHERE "People_ID" < 1


Question: Can you list the aircraft IDs, up to and including 4, that are present in the aircraft table but not in the airport_aircraft table, excluding aircraft ID 2 from the airport_aircraft table?

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


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


Question: Can you give me the shop name, the number of shop IDs, the number of locations, the average district value, and the number of products for shops that are either in the Wiklöf Holding Arena district but not in Jakobstad and are not named KuPS, or have a manager other than Mika Laurikainen; combined with the same information for shops that either have a manager other than Mika Lehkosuo and are not in the Jakobstads Centralplan district, or are not in Espoo and have 10770 or fewer products?

SELECT Name, COUNT(Shop_ID), COUNT(Location), AVG(District), Number_products FROM shop WHERE District = "Wiklöf Holding Arena" AND Location != "Jakobstad" AND Name <> "KuPS" OR Manager_name != "Mika Laurikainen" UNION SELECT Name, COUNT(Shop_ID), COUNT(Location), AVG(District), Number_products FROM shop WHERE Manager_name <> "Mika Lehkosuo" AND District <> "Jakobstads Centralplan" OR Location <> "Espoo" AND "Number_products" <= 10770


Question: Which driver IDs, excluding driver ID 9, 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 != 9 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 7


Question: Could you give me a list of document IDs from the Documents table where the shipping agent code is "FE" or the document ID is less than 24, but exclude any document IDs that are also found in the Documents_Mailed table where the mailed_to_address_id is less than or equal to 7?

SELECT document_id FROM Documents WHERE shipping_agent_code = "FE" OR "document_id" < 24 EXCEPT SELECT document_id FROM Documents_Mailed WHERE "mailed_to_address_id" <= 7


Question: What is the total of all mailing dates where the mailed to address ID is 2 or greater, combined with the total of all mailing dates where the mailing date is January 14, 1982 at 5:50:54 AM, or the mailed to address ID is greater than 3, or the document ID is 4 or greater?

SELECT SUM(mailing_date) FROM Documents_Mailed WHERE "mailed_to_address_id" >= 2 UNION ALL SELECT SUM(mailing_date) FROM Documents_Mailed WHERE mailing_date = "1982-01-14 05:50:54" OR "mailed_to_address_id" > 3 OR "document_id" >= 4


Question: Can you give me the latest opening year, latest city, street address, membership amount, and name for branches that meet certain criteria, excluding those that meet other specific criteria? The first set of criteria includes branches with an ID less than 5 that opened in 2009, have a membership amount not equal to 11, and are not on Oaks Crescent, or are not in London. The second set of criteria includes branches with an ID of 7, or a membership amount not equal to 31, that opened in 2012, are not in London, and are not on Abbey Rise.

SELECT MAX(Open_year), MAX(City), Address_road, membership_amount, Name FROM branch WHERE "Branch_ID" < 5 AND Open_year = "2009" AND membership_amount <> "11" AND Address_road <> "Oaks Crescent" OR City <> "London" EXCEPT SELECT MAX(Open_year), MAX(City), Address_road, membership_amount, Name FROM branch WHERE "Branch_ID" = 7 OR membership_amount <> "31" AND Open_year = "2012" AND City <> "London" AND Address_road <> "Abbey Rise"


Question: Can you show me the number of domestic passengers and the airport ID for each airport?

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


Question: Which driver IDs, excluding driver ID 1, are also school bus driver IDs, excluding school bus 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: Which driver IDs, excluding driver ID 9, are not also driver ID 10 in the school bus table?

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


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


Question: What is the smallest contestant number for contestants named "Loraine NygrenTania Mattioli" or whose contestant number is not 8, and what is the smallest contestant number for all other contestants?

SELECT MIN(contestant_number) FROM CONTESTANTS WHERE contestant_name = "Loraine NygrenTania Mattioli" OR "contestant_number" <> 8 UNION SELECT MIN(contestant_number) FROM CONTESTANTS WHERE contestant_name != "Loraine NygrenTania Mattioli"


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


Question: Can you show me the price, origin, distance, arrival date, and airline ID for all flights where the flight number is less than 76 and the airline ID is 6, combined with the price, origin, distance, arrival date, and airline ID for all flights that don't go to Tokyo?

SELECT price, origin, distance, arrival_date, aid FROM flight WHERE "flno" < 76 AND "aid" = 6 UNION ALL SELECT price, origin, distance, arrival_date, aid FROM flight WHERE destination != "Tokyo"


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

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


Question: Which driver IDs appear exactly once in the driver table and are equal to 1, but do not appear in the school bus table with a driver ID 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: Can you list all the copy numbers from the draft copies table where the document ID is greater than 10 or the copy number is at least 4, and also include all copy numbers where the document ID is exactly 20?

SELECT copy_number FROM Draft_Copies WHERE "document_id" > 10 OR "copy_number" >= 4 UNION ALL SELECT copy_number FROM Draft_Copies WHERE "document_id" = 20


Question: Can you give me the property IDs that satisfy these two conditions: first, they must have a property feature description that's not "earum" and either have a property ID of 3 or greater, or a feature ID that's not 4; and second, they must also be properties that were put on the market on "1976-06-10 20:25:38" and either have a selling price that's not 5.0, a property ID that's not 14, a shp_feature_3 that's not "None", or a combination of fld_feature_3 being "None", fld_feature_2 not being "None", and oth_feature_3 not being "None", or a combination of hse_feature_3 being "None", other_property_details being "None", hse_feature_2 not being "None", and apt_feature_2 not being "vero"?

SELECT property_id FROM Other_Property_Features WHERE property_feature_description <> "earum" AND "property_id" >= 3 OR "feature_id" != 4 INTERSECT SELECT property_id FROM Properties WHERE date_on_market = "1976-06-10 20:25:38" AND "agreed_selling_price" <> 5.0 OR "property_id" <> 14 OR shp_feature_3 <> "None" OR fld_feature_3 = "None" AND fld_feature_2 != "None" AND oth_feature_3 != "None" AND hse_feature_3 = "None" OR other_property_details = "None" AND hse_feature_2 <> "None" AND apt_feature_2 <> "vero"


Question: What is the last car maker in alphabetical order from the car_makers table, excluding "gm" and where the country code is "1" or the full name is "Daimler Benz", combined with the last car maker in alphabetical order from the model_list table, excluding "chevrolet" models?

SELECT MAX(Maker) FROM car_makers WHERE Maker <> "gm" AND Country = "1" OR FullName = "Daimler Benz" UNION SELECT MAX(Maker) FROM model_list WHERE Model != "chevrolet"


Question: Can you list the aircraft IDs that are less than 3 when grouped in the aircraft table, but also not equal to 1 when grouped in 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 <> 1


Question: Can you give me the lowest member ID and branch ID from the membership register for branches, excluding records from 2016 or where the member ID is 4 or less and the branch ID is 5, combined with the lowest member ID and branch ID from purchases where the total amount isn't 430.29?

SELECT MIN(Member_ID), Branch_ID FROM membership_register_branch WHERE Register_Year != "2016" OR "Member_ID" <= 4 AND Branch_ID = "5" UNION SELECT MIN(Member_ID), Branch_ID FROM purchase WHERE "Total_pounds" <> 430.29


Question: Which employees from Wasps did not receive an evaluation award in any year other than 2016?

SELECT Employee_ID FROM employee WHERE City = "Wasps" EXCEPT SELECT Employee_ID FROM evaluation WHERE Year_awarded != "2016"


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

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: Could you give me the item IDs of items titled "orange" that also have reviews where either the user ID is not 2, or the author ID is 2 and the item ID is at least 7?

SELECT i_id FROM item WHERE title = "orange" INTERSECT SELECT i_id FROM review WHERE "u_id" != 2 OR "a_id" = 2 AND "i_id" >= 7


Question: Can you tell me the youngest age, driver ID, number of home cities, name, and largest party size for drivers where the driver ID is 9 or higher, or the name is Minnie Gonzalez, combined with the same information for drivers where the name is not Brandon McGee, or the driver ID is 6 or lower, or the home city is not Manchester, or the party is not Democrat?

SELECT MIN(Age), Driver_ID, COUNT(Home_city), Name, MAX(Party) FROM driver WHERE "Driver_ID" >= 9 OR Name = "Minnie Gonzalez" UNION SELECT MIN(Age), Driver_ID, COUNT(Home_city), Name, MAX(Party) FROM driver WHERE Name != "Brandon McGee" OR "Driver_ID" <= 6 OR Home_city != "Manchester" OR Party != "Dem"


Question: What is the average version number of templates where either the effective date from is not November 12, 2005, and the effective date to is August 8, 2008, or the template details are not empty and the template ID is at least 23, excluding the average version number of templates where either the template ID is not 4 or the version number is less than 5 and the template details are empty?

SELECT AVG(Version_Number) FROM Templates WHERE Date_Effective_From != "2005-11-12 07:09:48" AND Date_Effective_To = "2008-08-08 18:36:43" OR Template_Details != "" AND "Template_ID" >= 23 EXCEPT SELECT AVG(Version_Number) FROM Templates WHERE "Template_ID" != 4 OR "Version_Number" < 5 AND Template_Details = ""


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

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


Question: Can you give me the school IDs for schools that meet these criteria: either their name isn't Glenn, their ID is 3, and their mascot isn't Redskins, or their football class isn't AA, or they are in County 75 Starke and their IHSAA class is AAA, but excluding any school IDs found in the endowment table where the amount is 8.43?

SELECT School_id FROM School WHERE School_name <> "Glenn" AND School_id = "3" AND Mascot != "Redskins" OR IHSAA_Football_Class != "AA" OR County = "75 Starke" AND IHSAA_Class = "AAA" EXCEPT SELECT School_id FROM endowment WHERE "amount" = 8.43


Question: Can you list all the "other details" for employees named Jordyn, as well as all "other details" that are equal to "b", and then also list the "other details" for all employees who are not named Jordyn?

SELECT other_details FROM Employees WHERE employee_name = "Jordyn" OR other_details = "b" UNION SELECT other_details FROM Employees WHERE employee_name <> "Jordyn"


Question: Can you give me a list of driver IDs, excluding driver ID 12 from the driver table and driver ID 10 from the school_bus table, combining the results into a single 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 != 10


Question: Can you give me a list of driver IDs, including all driver IDs from the driver table that are not 12, and also including driver ID 4 from the school bus table?

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


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

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


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


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

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


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

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


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

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


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 4 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 3


Question: Could you give me a list of driver IDs, including those that are exactly 11 from the driver table, and those less than 3 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 < 3


Question: Can you tell me the average distance for each aircraft ID, considering only aircraft with IDs greater than or equal to 13 and names that aren't Boeing 737-800, combined with the average distance for each aircraft ID from flights departing on "04/12/2005 09:00" with flight numbers less than or equal to 33, or aircraft IDs that aren't 6, or distances of 802, or prices greater than 220.98 originating from Chicago?

SELECT aid, AVG(distance) FROM aircraft WHERE "aid" >= 13 AND name != "Boeing 737-800" UNION ALL SELECT aid, AVG(distance) FROM flight WHERE departure_date = "04/12/2005 09:00" AND "flno" <= 33 OR "aid" != 6 OR "distance" = 802 OR "price" > 220.98 AND origin = "Chicago"


Question: Can you give me a list of driver IDs that are not 6, and are also less than or equal to 4, considering drivers and school buses separately?

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 from the driver table that are greater than or equal to 2, excluding any driver IDs that are equal to 7 in the school_bus table?

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


Question: Which aircraft IDs are both greater than or equal to 1 when looking at aircraft, and less than or equal to 1 when looking at 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 <= 1


Question: Can you give me the Driver ID of drivers with ID 10, excluding any Driver IDs less than 9 that are associated with school buses?

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 the Aircraft IDs that appear exactly as 4 in the aircraft table, but are not present with an ID of 1 or greater in the airport_aircraft table?

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


Question: Can you give me a list of all the driver IDs, combining those from the driver table where the ID is 10 or greater, with 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 >= 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 from the driver table that are 10 or greater, excluding any driver IDs from the school bus table that are 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 the document IDs that are both not of the "Hard Drive" type, were not received on "1996-05-31 06:51:58", and are not document ID 7, and also have a draft number less than or equal to 8, or a copy number greater than or equal to 4, or a document ID greater than or equal to 1?

SELECT document_id FROM Documents WHERE document_type_code <> "Hard Drive" AND receipt_date <> "1996-05-31 06:51:58" AND "document_id" <> 7 INTERSECT SELECT document_id FROM Draft_Copies WHERE "draft_number" <= 8 OR "copy_number" >= 4 OR "document_id" >= 1


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

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


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

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


Question: Can you find the lowest copy number, draft number, and document ID from the Circulation History where the document ID is at least 2, the copy number is 15, or the draft number is 20, and combine that with the lowest copy number, draft number, and document ID from the Draft Copies where the draft number is not 12 or the document ID is not 20?

SELECT MIN(copy_number), draft_number, document_id FROM Circulation_History WHERE "document_id" >= 2 OR "copy_number" = 15 OR "draft_number" = 20 UNION ALL SELECT MIN(copy_number), draft_number, document_id FROM Draft_Copies WHERE "draft_number" <> 12 OR "document_id" != 20


Question: Could you list the document status codes and descriptions that are either not "currently working on" or have a code of "working", but exclude any that have a document status code of "working"?

SELECT document_status_code, document_status_description FROM Ref_Document_Status WHERE document_status_description != "currently working on" OR document_status_code = "working" INTERSECT SELECT document_status_code, document_status_description FROM Ref_Document_Status WHERE document_status_code != "working"


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

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


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

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


Question: Can you give me a list of driver IDs that are 9 or less, excluding any driver IDs that are also 4 or less and appear in the school bus records?

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


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

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

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


Question: Can you give me the IDs of drivers with IDs less than 5, excluding the IDs of school bus drivers with IDs less 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 IDs, including airport IDs for airports with the IATA code "BCN" but not named "Akureyri Airport", and flight IDs for flights where the company ID is 9 and either the altitude is greater than 3650, or the velocity is less than or equal to 240 and the airport ID is less than or equal to 1, or the pilot isn't "Thompson", or the ID is 4, or the date isn't "July 16, 1965" and the vehicle flight number isn't "M2-F1 #21"?

SELECT id FROM airport WHERE IATA = "BCN" AND name <> "Akureyri Airport" UNION SELECT id FROM flight WHERE "company_id" = 9 AND "Altitude" > 3650.0 OR "Velocity" <= 240.0 AND "airport_id" <= 1 OR Pilot != "Thompson" OR "id" = 4 OR Date != "July 16, 1965" AND Vehicle_Flight_number <> "M2-F1 #21"


Question: Which driver IDs, excluding driver ID 11, are not also driver IDs excluding driver ID 9 that are associated with a school bus?

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


Question: Can you list the aircraft IDs that are less than 2 from the aircraft table, and also list the aircraft IDs that are not equal to 2 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 != 2


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


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

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


Question: Can you list all the aircraft IDs, excluding aircraft ID 2, and combine that with a list of all aircraft IDs from the airport aircraft, excluding aircraft ID 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: Could you give me a list of branch IDs that meet these conditions: the branch opened in 2014 and is located in Oxford, but isn't named Stanley, or the branch's address isn't on Brampton Road and the membership amount isn't 56, and the branch ID isn't 6, excluding any branch IDs that aren't 1 in the membership register or have a register year that isn't 2017, or have a member ID less than 7?

SELECT Branch_ID FROM branch WHERE Open_year = "2014" AND City = "Oxford" AND Name != "Stanley" OR Address_road != "Brampton Road" AND membership_amount <> "56" AND "Branch_ID" <> 6 EXCEPT SELECT Branch_ID FROM membership_register_branch WHERE Branch_ID <> "1" AND Register_Year != "2017" OR "Member_ID" < 7


Question: Can you give me a list of driver IDs that are greater than or equal to 9, excluding any driver IDs that are not equal to 9 and are also 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: Can you list the department IDs and temporary acting statuses from the management table, including those where either the temporary acting status is not "Yes" or the head ID is not 5 and the department ID is greater than 2, along with those where the temporary acting status is not "Yes" and the head ID is not 5 or the department ID is greater than 2?

SELECT department_ID, temporary_acting FROM management WHERE temporary_acting <> "Yes" OR "head_ID" != 5 AND "department_ID" > 2 UNION ALL SELECT department_ID, temporary_acting FROM management WHERE temporary_acting <> "Yes" AND "head_ID" != 5 OR "department_ID" > 2


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

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


Question: Which driver has an ID of 7, but is not a driver with an ID of 4 who drives a school bus?

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


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

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 list all the template type descriptions, including those that are not advertisements or have a template type code of "CV", and also including those that are not "CV"?

SELECT Template_Type_Description FROM Ref_Template_Types WHERE Template_Type_Description != "Advertisement" OR Template_Type_Code = "CV" UNION SELECT Template_Type_Description FROM Ref_Template_Types WHERE Template_Type_Description <> "CV"


Question: What is the total number of transit passengers for each aircraft?

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


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

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 give me a list of driver IDs, including those from the driver table where the ID is not 1, and those from the school_bus table where the ID is greater than 7?

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


Question: Can you give me a list of property IDs from the Other_Property_Features table where the feature ID is less than 2 or the property ID is less than or equal to 1, but excluding any property IDs from the Properties table that meet a complex set of criteria involving address, price, features, dates, property type, room count, and property name?

SELECT property_id FROM Other_Property_Features WHERE "feature_id" < 2 OR "property_id" <= 1 EXCEPT SELECT property_id FROM Properties WHERE "property_id" >= 8 AND property_address = "2088 Bashirian Fork Suite 337 Faustinoport, MT 16771-9320" OR "buyer_offered_price" <> 13991131.434 AND fld_feature_3 = "None" OR apt_feature_3 != "None" OR fld_feature_1 <> "None" AND fld_feature_2 != "None" AND other_property_details <> "None" OR oth_feature_2 = "None" AND date_on_market = "1978-05-15 10:53:37" AND "vendor_requested_price" >= 2198735.095 AND property_type_code != "Other" AND apt_feature_1 <> "ut" AND date_sold <> "1973-02-24 02:56:06" OR hse_feature_1 <> "None" OR "room_count" <= 2 OR oth_feature_3 != "None" AND hse_feature_3 != "None" AND property_name <> "riverside"


Question: Which driver IDs are greater than or equal to 6, but are not driver ID 10 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 != 10


Question: Can you give me a list of aircraft IDs, including those that appear in the aircraft table with an ID of 2, and those that appear in the airport_aircraft table with an ID that is not 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 give me a list of driver IDs where either the driver ID is 9, or the driver ID is less than 4 in the school bus list?

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


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

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: Which aircraft have an ID of 4, excluding those aircraft that are associated with airports and have an ID less than 3?

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


Question: Which aircraft have an ID of 1 and also have an ID less than 5 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 < 5


Question: Can you give me a list of driver IDs that are less than 5 and also less than or equal to 3, considering only unique driver IDs from the driver and school_bus tables?

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