Question: Can you list the name, creation date, ranking, number of employees, and budget in billions for all departments, including those that are not named "Commerce" with a budget of at least 21.5 billion and a ranking other than 12, or those with a Department ID greater than 2, along with any departments that have a budget greater than 439.3 billion?

SELECT Name, Creation, Ranking, Num_Employees, Budget_in_Billions FROM department WHERE Name != "Commerce" AND "Budget_in_Billions" >= 21.5 AND "Ranking" <> 12 OR "Department_ID" > 2 UNION SELECT Name, Creation, Ranking, Num_Employees, Budget_in_Billions FROM department WHERE "Budget_in_Billions" > 439.3


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


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


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

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


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


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

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


Question: Can you list the Book ID and Title for all books with a Book ID less than 5, excluding those that either have 6 or more issues and are written by Howard Chaykin, or have a Book ID less than 3 and a title that is not BrainBanx?

SELECT Book_ID, Title FROM book WHERE "Book_ID" < 5 EXCEPT SELECT Book_ID, Title FROM book WHERE "Issues" >= 6.0 AND Writer = "Howard Chaykin" OR "Book_ID" < 3 AND Title <> "BrainBanx"


Question: Can you list all the aircraft IDs, including those from the aircraft table that are less than or equal to 3 and those from the airport_aircraft table that are not equal to 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 Store IDs from the store table where the store type is not "City Mall" or the number of product categories is less than or equal to 17811, combined with a list of Store IDs from the store_product table where the Store ID is not 1 or the Product ID is less than 2?

SELECT Store_ID FROM store WHERE Type != "City Mall" OR "Number_of_product_category" <= 17811.0 UNION ALL SELECT Store_ID FROM store_product WHERE "Store_ID" <> 1 OR "Product_ID" < 2


Question: Which club IDs are associated with members whose student ID is 1008 or greater, who are not in club 1, and who don't hold the position of Vice-President, excluding those club IDs that have a President or are club ID 1 or less?

SELECT ClubID FROM Member_of_club WHERE "StuID" >= 1008 AND "ClubID" <> 1 AND Position <> "Vice-President" EXCEPT SELECT ClubID FROM Member_of_club WHERE Position = "President" OR "ClubID" <= 1


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

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


Question: Can you list the aircraft IDs, excluding aircraft ID 2, and combine that with a list of 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: Can you give me the IDs of aircraft that are less than 2, excluding the IDs of aircraft from the airport that are not 1?

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


Question: Which driver IDs, excluding driver ID 7, appear in the driver table but not in the school bus table for driver IDs 9 or higher?

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, combining those from the driver table excluding driver ID 11 with those from the school bus table excluding driver ID 10, making sure to only list each driver ID once?

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


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

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


Question: Can you give me a list of aircraft IDs, including those that are equal to 2 from the aircraft table, and those less than or equal to 5 from the airport_aircraft table?

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


Question: Can you show me the description, template ID, name, and ID of all documents, including those that don't have a template ID of 14 or a document ID of 16514113, as well as those with descriptions other than "f", names other than "Robbin CV", or a document ID of 3540024 or less, or those with other details that aren't "None" and a template ID greater than 14?

SELECT Document_Description, Template_ID, Document_Name, Document_ID FROM Documents WHERE "Template_ID" <> 14 AND "Document_ID" <> 16514113 UNION ALL SELECT Document_Description, Template_ID, Document_Name, Document_ID FROM Documents WHERE Document_Description <> "f" AND Document_Name <> "Robbin CV" AND "Document_ID" <= 3540024 OR Other_Details != "None" AND "Template_ID" > 14


Question: Which driver IDs are greater than 9, but not greater than or equal to 9 and associated with a school bus?

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


Question: What aircraft IDs are less than or equal to 2, excluding the aircraft IDs less than 2 that are associated with airports?

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


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

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


Question: Can you list the aircraft IDs, first from the aircraft table excluding ID 5, and then from the airport_aircraft table including only IDs up to 2, 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 <= 2


Question: Can you give me the total year, average Attorney General, Governor, Party ID, Lieutenant Governor, average US Senate, latest Party, and earliest Comptroller from the party information, but only for entries where the Party ID is 5 or higher, the year is 2002 or later, or the Comptroller is Alan Hevesi and the US Senator isn't Hillary Rodham Clinton, excluding any entries where the Governor isn't Betsy McCaughey Ross and the US Senator is Hillary Rodham Clinton and the Party ID isn't 5, or the Attorney General is Eliot Spitzer, or the Party is Working Families?

SELECT SUM(Year), AVG(Attorney_General), Governor, Party_ID, Lieutenant_Governor, AVG(US_Senate), MAX(Party), MIN(Comptroller) FROM party WHERE "Party_ID" >= 5 OR "Year" >= 2002.0 OR Comptroller = "Alan Hevesi" AND US_Senate != "Hillary Rodham Clinton" EXCEPT SELECT SUM(Year), AVG(Attorney_General), Governor, Party_ID, Lieutenant_Governor, AVG(US_Senate), MAX(Party), MIN(Comptroller) FROM party WHERE Governor != "Betsy McCaughey Ross" AND US_Senate = "Hillary Rodham Clinton" AND "Party_ID" != 5 OR Attorney_General = "Eliot Spitzer" OR Party = "Working Families"


Question: Can you give me a list of driver IDs that are less than 2 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 < 2 UNION 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 or equal to 5, excluding those aircraft IDs less than 3 that are also listed 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 < 3


Question: Can you give me a list of driver IDs from the driver table where each ID is less than or equal to 7, combined with a list of driver IDs from the school_bus table where the ID is exactly 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 document IDs that either have a draft number of 1 or higher, or were mailed to address ID 8 on a date other than May 24, 1993 at 10:13 PM?

SELECT document_id FROM Document_Drafts WHERE "draft_number" >= 1 UNION SELECT document_id FROM Documents_Mailed WHERE mailing_date <> "1993-05-24 22:13:48" AND "mailed_to_address_id" = 8


Question: Can you list all the aircraft IDs, combining those from the aircraft table that are not equal to 3 with those from the airport_aircraft table that are greater than 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, including all driver IDs from the driver table except for driver ID 6, and also including driver ID 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 from the driver table that are less than or equal to 4, excluding any driver IDs that are also in the school_bus table and less than 9?

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


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

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


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 10 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID = 7


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


Question: Can you list the school type, the number of schools, location, grade, and school name for all schools that are not kindergarten, or have a school ID greater than 1 and are not public, excluding those that are kindergarten?

Type COUNT(School_ID) Location Grade School

Private Catholic
6
Jakarta, Indonesia
1st-3rd grade
St. Francis Assisi

SELECT Type, COUNT(School_ID), Location, Grade, School FROM school WHERE Grade <> "Kindergarten" OR "School_ID" > 1 AND Type != "Public" EXCEPT SELECT Type, COUNT(School_ID), Location, Grade, School FROM school WHERE Grade = "Kindergarten"


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

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


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

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


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

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


Question: Which driver IDs are equal to 8, but are not driver IDs less than 3 that are used in school buses?

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


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 12 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 5 or greater, excluding any driver IDs from the school bus table that are 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 list the aircraft IDs, including those from the aircraft table that are greater than or equal to 1, and those from the airport_aircraft table that are less than 5?

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


Question: Can you list the aircraft IDs, first from the aircraft table where the ID is not 1, and then from the airport_aircraft table where the ID is at most 2, 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 <= 2


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 4 or greater?

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


Question: Can you give me a list of album IDs where either the artist ID is not 258 and the album title is "The World of Classical Favourites", or any album ID that is not 83, combined with a list of all genre IDs where the genre name is not "Pop"?

SELECT id FROM albums WHERE "artist_id" != 258 AND title = "The World of Classical Favourites" OR "id" != 83 UNION ALL SELECT id FROM genres WHERE name != "Pop"


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

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


Question: Can you list the parties from the election table that meet certain criteria related to counties represented, district, party affiliation, delegates, election ID, first elected year, and committee, but exclude any parties that also meet specific criteria in the party table related to comptroller, party ID, US Senator, party name, attorney general, governor, year, and lieutenant governor?

SELECT Party FROM election WHERE Counties_Represented = "13" OR "District" > 4 AND "Party" = 2 OR Delegate != "DeBoy, Steven J. Sr. Steven J. DeBoy, Sr." AND "Election_ID" < 8 OR "First_Elected" > 2002.0 AND Committee <> "Appropriations" EXCEPT SELECT Party FROM party WHERE Comptroller = "Alan Hevesi" OR "Party_ID" < 3 AND US_Senate = "Hillary Rodham Clinton" AND Party <> "Independence" OR Attorney_General <> "Eliot Spitzer" AND Governor = "Carl McCall" AND "Year" > 1998.0 OR Lieutenant_Governor = "David Paterson"


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 less than 4?

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


Question: What aircraft IDs appear in the aircraft table, excluding aircraft ID 3, and also appear in the airport_aircraft table, including only aircraft IDs up to 3?

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


Question: Can you list all the document status codes, including those from the Documents table where the receipt date isn't September 15, 1976 at 7:24 PM and the status isn't "working", along with those from the Ref_Document_Status table where the status isn't "done"?

SELECT document_status_code FROM Documents WHERE receipt_date != "1976-09-15 19:24:17" AND document_status_code != "working" UNION SELECT document_status_code FROM Ref_Document_Status WHERE document_status_code != "done"


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

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


Question: Can you give me a list of aircraft IDs, excluding aircraft ID 4, that appear in the aircraft table but not in the airport_aircraft table, where aircraft ID 2 is also excluded 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 give me a list of driver IDs that are both greater than or equal to 1 and also less than 4, considering only the driver IDs that appear in both the driver and school bus tables?

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


Question: Could you give me the IDs from the certificate table that are equal to 14, but exclude any IDs from the flight table where the origin is Los Angeles, the flight number is 346 or less, the distance is less than 7487, and the departure date isn't April 12, 2005 at 9:00 AM, or where the price isn't 278.56, the destination isn't Honolulu, the ID is less than 10, and the arrival date isn't April 12, 2005 at 8:45 AM?

SELECT aid FROM certificate WHERE "aid" = 14 EXCEPT SELECT aid FROM flight WHERE origin = "Los Angeles" AND "flno" <= 346 AND "distance" < 7487 AND departure_date <> "04/12/2005 09:00" OR "price" != 278.56 AND destination <> "Honolulu" AND "aid" < 10 AND arrival_date != "04/12/2005 08:45"


Question: Can you give me a list of aircraft IDs that are greater than 3 and also greater than or equal to 2 in the airport aircraft list?

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


Question: Can you give me a list of employee IDs, combining those who work in Wasps with those from the evaluation records who either aren't employee number 2, or didn't receive an award in 2018 with a bonus that wasn't 2900?

SELECT Employee_ID FROM employee WHERE City = "Wasps" UNION SELECT Employee_ID FROM evaluation WHERE Employee_ID <> "2" OR Year_awarded <> "2018" AND "Bonus" <> 2900.0


Question: Which driver IDs are listed in both the driver table, excluding driver ID 8, and the school bus table, excluding driver ID 9?

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


Question: Can you give me a list of district IDs that are either district ID 7 and not in city area 22, or not headquartered in Chakwal City, combined with district IDs that are not 15?

SELECT District_ID FROM district WHERE "District_ID" = 7 AND "City_Area" != 22.0 OR Headquartered_City != "Chakwal City" UNION SELECT District_ID FROM store_district WHERE "District_ID" <> 15


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

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: What is the highest driver ID and the corresponding years of working for drivers who either don't live in Manchester, have a School ID of 1, are older than 46 and have worked for more than 8 years, belong to the Dem party and are named Douglas McCrory, or are full-time employees?

SELECT MAX(T1.Driver_ID), T2.Years_Working FROM driver as T1 JOIN school_bus as T2 ON T1.Driver_ID = T2.Driver_ID WHERE Home_city <> "Manchester" OR "School_ID" = 1 OR "Age" > 46 AND "Years_Working" > 8 OR Party = "Dem" AND Name = "Douglas McCrory" OR If_full_time = "T"


Question: Can you list the aircraft IDs that are greater than 2 when grouped, excluding those aircraft IDs that are greater than or equal to 1 when grouped in the airport aircraft table?

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


Question: What aircraft have an ID of 4, but are not among the aircraft with IDs less than 5 that are associated with airports?

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


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

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


Question: Can you list the aircraft IDs that appear in the aircraft table, excluding aircraft ID 3, but then remove any aircraft IDs that appear in the airport_aircraft table, excluding aircraft ID 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 list all the continents, including Europe, and also any other continent where the continent ID is greater than 3?

SELECT Continent FROM continents WHERE Continent = "europe" UNION SELECT Continent FROM continents WHERE "ContId" > 3 AND Continent <> "europe"


Question: Can you give me the driver ID that appears exactly once with the value 8 in the driver table, excluding any driver IDs that appear with a value of 9 or greater in the school bus table?

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


Question: Can you give me a list of driver IDs, where each ID is greater than 6 and appears more than once in the driver table, excluding any driver IDs that are also greater than 3 and appear more than once in the school bus table?

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


Question: What is the smallest branch ID from the branch table, excluding branches named Popert or those with a membership amount of 6 not located in Oxford, or those not on Concord Road opened in a year other than 2015, and whose branch ID is less than or equal to 2, after removing the smallest branch ID from the purchase table where the branch ID is 3 or the year is not 2018 and the total pounds is 988.09?

SELECT MIN(Branch_ID) FROM branch WHERE Name <> "Popert" OR membership_amount = "6" AND City != "Oxford" OR Address_road != "Concord Road" AND Open_year <> "2015" AND "Branch_ID" <= 2 EXCEPT SELECT MIN(Branch_ID) FROM purchase WHERE Branch_ID = "3" OR Year != "2018" AND "Total_pounds" = 988.09


Question: What is the smallest school ID for St. Francis Assisi kindergarten schools that are private, not located in Los Angeles, California, and have a school ID of 5, excluding the smallest school IDs from the school bus table where the driver ID is not 4?

SELECT MIN(School_ID) FROM school WHERE School = "St. Francis Assisi" AND Grade = "Kindergarten" AND Type = "Private" AND Location <> "Los Angeles, California" AND "School_ID" = 5 EXCEPT SELECT MIN(School_ID) FROM school_bus WHERE "Driver_ID" <> 4


Question: Could you list the Shop IDs from the hiring shop that either have part-time employees and a Shop ID of 8 or greater, or started at a different time than 2013, combined with Shop IDs from the shop table that either have less than 10770 products and are located in Kuopio, or have Antti Muurinen as the manager?

SELECT Shop_ID FROM hiring WHERE Is_full_time = "F" AND "Shop_ID" >= 8 OR Start_from <> "2013" UNION SELECT Shop_ID FROM shop WHERE "Number_products" < 10770 AND Location = "Kuopio" OR Manager_name = "Antti Muurinen"


Question: Can you give me the sum of the invested budget percentage, school ID, budgeted amount, year, sum of the total invested budget percentage, and total budgeted budget percentage from the budget table, combining two sets of results: one where the total budgeted budget percentage is 1.3 and the invested budget percentage is 146.9, or the year is before or in 2002, or the invested amount is less than or equal to 95542, and another where the year is after 2003, or the total invested budget percentage is less than 2.0, or the invested budget percentage is 127.6 and the school ID is less than or equal to 5?

SELECT SUM(Budget_invested_percent), School_id, Budgeted, Year, SUM(total_budget_percent_invested), total_budget_percent_budgeted FROM budget WHERE "total_budget_percent_budgeted" = 1.3 AND Budget_invested_percent = "146.9" OR "Year" <= 2002 OR "Invested" <= 95542 UNION ALL SELECT SUM(Budget_invested_percent), School_id, Budgeted, Year, SUM(total_budget_percent_invested), total_budget_percent_budgeted FROM budget WHERE "Year" > 2003 OR "total_budget_percent_invested" < 2.0 OR Budget_invested_percent = "127.6" AND "School_id" <= 5


Question: Can you give me the total of aircraft IDs from the aircraft table where the aircraft isn't a Robinson R-22, or the maximum gross weight isn't 3,200 lb (1,451 kg), or the maximum disk loading is 2.6 lb/ft² (14 kg/m²) and the total disk area isn't 5,655 ft² (526 m²), and the description isn't a Turboshaft utility helicopter, and the aircraft ID is less than or equal to 5, combined with the total of aircraft IDs from the airport aircraft table where the airport ID is greater than 1, or the ID is less than or equal to 4 and the aircraft ID is less than 3?

SELECT SUM(Aircraft_ID) FROM aircraft WHERE Aircraft <> "Robinson R-22" OR Max_Gross_Weight <> "3,200 lb (1,451 kg)" OR Max_disk_Loading = "2.6 lb/ft² (14 kg/m²)" AND Total_disk_area != "5,655 ft² (526 m²)" AND Description <> "Turboshaft utility helicopter" AND "Aircraft_ID" <= 5 UNION SELECT SUM(Aircraft_ID) FROM airport_aircraft WHERE "Airport_ID" > 1 OR "ID" <= 4 AND "Aircraft_ID" < 3


Question: Which driver IDs are greater than or equal to 7, but are not less than or equal to 7 in the school bus driver list?

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


Question: Can you give me a list of driver IDs, including driver ID 11 from the driver table, and any driver IDs greater 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, combining those from the driver table, excluding driver ID 7, with those from the school bus table, limited to IDs less than 10, 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 < 10


Question: What are the maximum gross weights of aircraft and their corresponding aircraft IDs?

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


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

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


Question: Which driver IDs are present in both the driver table (excluding driver ID 1) and the school_bus table (only including driver IDs greater than 3)?

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


Question: Can you list the PetIDs from the Has_Pet table where the PetID is not 2003 and the StuID is less than 1002, combined with the PetIDs from the Pets table where the weight is less than 12 or the PetID is greater than or equal to 2001?

SELECT PetID FROM Has_Pet WHERE "PetID" <> 2003 AND "StuID" < 1002 UNION SELECT PetID FROM Pets WHERE "weight" < 12.0 OR "PetID" >= 2001


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 up to 10?

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


Question: Can you tell me the count of document type descriptions for each document type code, first excluding those with the description "f", and then combining that with a count of document type descriptions for each document type code, excluding those with the code "Hard Drive" or the description "f"?

SELECT document_type_code, COUNT(document_type_description) FROM Ref_Document_Types WHERE document_type_description != "f" UNION ALL SELECT document_type_code, COUNT(document_type_description) FROM Ref_Document_Types WHERE document_type_code != "Hard Drive" OR document_type_description <> "f"


Question: Can you give me a list of aircraft IDs, including those from the aircraft table that are greater than 4, and those from the airport_aircraft table that are not equal to 2?

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


Question: Can you give me the document ID, average draft details, and draft number from the document drafts, combining two sets of results: one where the draft number isn't 17 or the draft details aren't "m" and the document ID isn't 13, and another where the document ID is 7 or less and the draft number is 17, or the draft details aren't "k"?

SELECT document_id, AVG(draft_details), draft_number FROM Document_Drafts WHERE "draft_number" <> 17 OR draft_details <> "m" AND "document_id" != 13 UNION ALL SELECT document_id, AVG(draft_details), draft_number FROM Document_Drafts WHERE "document_id" <= 7 AND "draft_number" = 17 OR draft_details != "k"


Question: Could you give me a list of receipt numbers from the Documents table where either the shipping agent code isn't "AL", the document status code isn't "working", or the receipt date isn't "1982-09-27 14:52:15" and the other details aren't "x"? Also, include receipt numbers where the other details aren't "u" and the document ID isn't 1 and the shipping agent code isn't "US", or the receipt date isn't "1976-09-15 19:24:17", or the receipt number isn't "79".

SELECT receipt_number FROM Documents WHERE shipping_agent_code != "AL" OR document_status_code <> "working" OR receipt_date <> "1982-09-27 14:52:15" AND other_details <> "x" UNION SELECT receipt_number FROM Documents WHERE other_details != "u" AND "document_id" <> 1 AND shipping_agent_code <> "US" OR receipt_date <> "1976-09-15 19:24:17" OR receipt_number != "79"


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

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


Question: Could you list the aircraft IDs that are less than 3 when grouped in the aircraft table, and also less than 2 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 < 2


Question: What is the total of all store IDs from stores with fewer than 990 product categories and an area size of 7.23 or less, combined with the total of all store IDs from district 11, excluding store ID 1?

SELECT SUM(Store_ID) FROM store WHERE "Number_of_product_category" < 990.0 AND "Area_size" <= 7.23 UNION ALL SELECT SUM(Store_ID) FROM store_district WHERE "District_ID" = 11 AND "Store_ID" <> 1


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

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


Question: What is the highest vehicle ID for vehicles that are not cars or have an ID of 1 or greater, and also, what is the highest vehicle ID for vehicles that don't have an ID of 2?

SELECT MAX(vehicle_id) FROM Vehicles WHERE vehicle_details != "Car" OR "vehicle_id" >= 1 UNION ALL SELECT MAX(vehicle_id) FROM Vehicles WHERE "vehicle_id" != 2


Question: Can you give me a list of item IDs, including those that are not item ID 7, and also those from reviews where the user ID isn't 2, the rating isn't 10, and the rank is 3 or less?

SELECT i_id FROM item WHERE "i_id" <> 7 UNION ALL SELECT i_id FROM review WHERE "u_id" != 2 AND "rating" <> 10 AND "rank" <= 3


Question: Can you give me a list of driver IDs that are less than 10, and are also less than 9 when looking at school bus driver IDs?

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


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

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: Which driver IDs, excluding driver ID 8, are also driver ID 10 on the school bus?

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


Question: Can you show me the opening year, branch ID, city, name, and road address for branch number 5, along with the same information for all branches that either don't have "Glebe Street" as their road address, are located in London but didn't open in 2009, or have a branch ID of 7 or higher?

SELECT Open_year, Branch_ID, City, Name, Address_road FROM branch WHERE "Branch_ID" = 5 UNION SELECT Open_year, Branch_ID, City, Name, Address_road FROM branch WHERE Address_road != "Glebe Street" OR City = "London" AND Open_year != "2009" OR "Branch_ID" >= 7


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

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


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


Question: Can you list all the aircraft IDs that are specifically '3' from the aircraft table, and combine that with a list of all aircraft IDs that are not '3' from 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: What is the highest club ID and the gender of coaches, grouped by start year, considering only clubs and coaches where the gender is male, or the club name isn't Gefle IF and the coach's name is James Wong, or the start year is before or in 2011, or the region is UK, or the rank is 1 or less and the coach ID is 4 or more, and then filtering this group to only include those where the club name isn't Halmstads BK, or the coach's name is Joe Fabbri and the start year is before 2009, or the region is USA, or the rank is less than 3, or the coach ID is 2 or less, or the gender is male?

SELECT MAX(T1.Club_ID), T2.Gender FROM club as T1 JOIN coach as T2 ON T1.Club_ID = T2.Club_ID WHERE Gender = "M" OR Club_name <> "Gefle IF" AND Coach_name = "James Wong" OR "Start_year" <= 2011 OR Region = "UK" OR "Rank" <= 1 AND "Coach_ID" >= 4 GROUP BY Start_year HAVING Club_name <> "Halmstads BK" OR Coach_name = "Joe Fabbri" AND Start_year < 2009 OR Region = "USA" OR Rank < 3 OR Coach_ID <= 2 OR Gender = "M"


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

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


Question: Can you give me a list of driver IDs, where each ID is less than or equal to 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 give me a list of driver IDs that are greater than 11 from the driver table, combined with a list of driver IDs that are greater than 9 from the school bus table, removing any duplicates?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 11 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 9


Question: What is the average nationality value for people who are either shorter than 194.0, or were born on August 8, 1986, or whose name is not Aleksey Ostapenko and whose ID is less than 4, or are Russian, but only considering the average nationality values that are also found among people who were born on August 8, 1986, or are not Bulgarian, or whose name is not Semen Poltavskiy?

SELECT AVG(Nationality) FROM people WHERE "Height" < 194.0 OR Birth_Date = "August 8, 1986" OR Name != "Aleksey Ostapenko" AND "People_ID" < 4 OR Nationality = "Russia" INTERSECT SELECT AVG(Nationality) FROM people WHERE Birth_Date = "August 8, 1986" OR Nationality <> "Bulgaria" OR Name <> "Semen Poltavskiy"


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

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


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

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


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

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


Question: Can you list the aircraft IDs that are greater than or equal to 5, excluding any aircraft IDs that are less than 5 and are also present in the airport aircraft list?

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


Question: Can you give me a list of driver IDs, where each ID is less than or equal to 12, excluding any driver IDs that are not equal to 10 and are also found in the school bus table?

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


Question: Could you give me the IDs of airports that either aren't ICAO "BIAR" and aren't in "Bergen", or are named "Akureyri Airport", aren't in the "United States", have an ID of 6, and don't have an IATA of "BLL", excluding the IDs of operate_companies that either aren't named "VN/CX Catering Services Limited" and have a "Group_Equity_Shareholding" less than 45.0 and are a "Cargo airline", or aren't a "Subsidiary"?

SELECT id FROM airport WHERE ICAO <> "BIAR" AND City <> "Bergen" OR name = "Akureyri Airport" AND Country <> "United States" AND "id" = 6 AND IATA != "BLL" EXCEPT SELECT id FROM operate_company WHERE name != "VN/CX Catering Services Limited" AND "Group_Equity_Shareholding" < 45.0 AND Principal_activities = "Cargo airline" OR Type != "Subsidiary"


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

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


Question: Can you give me two sets of results from the management table? The first set should include the sum of temporary acting values, the head ID, and the count of department IDs where the department ID is greater than 7, the head ID is not 5, or the temporary acting value is "No". The second set should include the sum of temporary acting values, the head ID, and the count of department IDs where the department ID is less than or equal to 2, the temporary acting value is not "Yes", or the head ID is not 3.

SELECT SUM(temporary_acting), head_ID, COUNT(department_ID) FROM management WHERE "department_ID" > 7 OR "head_ID" <> 5 OR temporary_acting = "No" UNION ALL SELECT SUM(temporary_acting), head_ID, COUNT(department_ID) FROM management WHERE "department_ID" <= 2 OR temporary_acting <> "Yes" OR "head_ID" != 3


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

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


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

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


Question: Can you list the aircraft IDs, first from the aircraft table excluding ID 2, and then from the airport_aircraft table including only IDs less than or equal to 1, 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 <= 1


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

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


Question: Can you list the employee IDs and names of all employees who are older than 29, along with the employee IDs and names of all employees whose name is not Andrew Sheridan?

SELECT Employee_ID, Name FROM employee WHERE "Age" > 29 UNION ALL SELECT Employee_ID, Name FROM employee WHERE Name != "Andrew Sheridan"


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

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


Question: Can you give me a list of driver names and the total of their driver IDs, including those who are not 30 years old, have a driver ID less than 10, or don't live in Hartford, combined with a list of driver names and the total of their driver IDs, including those who have a driver ID greater than 12 and are not named Timothy Ackert, are 38 or older, or are not affiliated with the Democratic party?

SELECT Name, SUM(Driver_ID) FROM driver WHERE "Age" != 30 OR "Driver_ID" < 10 OR Home_city <> "Hartford" UNION ALL SELECT Name, SUM(Driver_ID) FROM driver WHERE "Driver_ID" > 12 AND Name != "Timothy Ackert" OR "Age" >= 38 OR Party != "Dem"


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


Question: Which aircraft IDs appear in both the aircraft and airport_aircraft tables, considering only IDs that are greater than or equal to 1 in each table?

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


Question: Which driver ID is both equal to 10 and not equal to 7, considering driver and school bus information?

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: Which aircraft IDs, excluding aircraft ID 5, are present in the aircraft table and also, excluding aircraft ID 1, are present in the airport_aircraft table?

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


Question: What is the smallest contestant number from the contestants table, excluding those named "Loraine NygrenTania Mattioli" and contestant number 11, combined with the smallest contestant number from the votes table where the phone number is greater than 7182887233, or the creation date is "2018-03-09 19:03:40", or the state is not "NY", the contestant number is 3, and the vote ID is less than 5?

SELECT MIN(contestant_number) FROM CONTESTANTS WHERE contestant_name != "Loraine NygrenTania Mattioli" AND "contestant_number" <> 11 UNION ALL SELECT MIN(contestant_number) FROM VOTES WHERE "phone_number" > 7182887233 OR created = "2018-03-09 19:03:40" OR state != "NY" AND "contestant_number" = 3 AND "vote_id" < 5


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

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


Question: Which driver IDs, excluding driver ID 5, are also driver ID 9 in the school bus table?

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


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

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


Question: Can you give me a list of all driver IDs, excluding driver ID 11 from the driver table and excluding driver ID 3 from the school_bus table, combining the results into a single list?

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


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

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


Question: Can you give me a list of driver IDs, combining those from the driver table that are not equal to 5 with those from the school bus table that are not equal to 3?

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


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

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


Question: What are the maximum nationality, graduation college, average name, and count of ages for people whose age is 37 or older, name is Tim Naegeli, People ID is 2 or less, and nationality is not United Kingdom, excluding those whose graduation college is Northeastern, nationality is not United States, or age is greater than 27?

MAX(Nationality) Graduation_College AVG(Name) COUNT(Age)

SELECT MAX(Nationality), Graduation_College, AVG(Name), COUNT(Age) FROM people WHERE "Age" >= 37 AND Name = "Tim Naegeli" AND "People_ID" <= 2 AND Nationality <> "United Kindom" EXCEPT SELECT MAX(Nationality), Graduation_College, AVG(Name), COUNT(Age) FROM people WHERE Graduation_College = "Northeastern" OR Nationality <> "United States" OR "Age" > 27


Question: Can you give me a list of student IDs, combining those from the allergy list where the ID is greater than 1026, with those from the student list where the first name isn't Linda, or the major code is 600 or higher, or the advisor code is less than 8721 and the sex isn't male, or the student ID isn't 1014, or the age is 18, or the last name isn't Cheng, or the city code is BAL?

SELECT StuID FROM Has_Allergy WHERE "StuID" > 1026 UNION ALL SELECT StuID FROM Student WHERE Fname <> "Linda" OR "Major" >= 600 OR "Advisor" < 8721 AND Sex <> "M" OR "StuID" <> 1014 OR "Age" = 18 OR LName <> "Cheng" OR city_code = "BAL"


Question: Can you list the driver IDs that are less than 5 from the driver table, and also include the driver ID 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, excluding driver ID 4, but then remove any driver IDs that are also driver ID 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 the PetIDs that are associated with students other than student 1001, and are also different from PetID 2001?

SELECT PetID FROM Has_Pet WHERE "StuID" != 1001 INTERSECT SELECT PetID FROM Pets WHERE "PetID" <> 2001


Question: Can you give me a list of driver IDs, including those from the driver table where the ID is 9 or greater, and also those from the school bus table where the ID is not 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 tell me the number of full names, the country, the number of makers, and the smallest ID for car makers, grouped by country, where the country is not "5" and the smallest ID is 22, combined with the same information where the full name is not "Fiat" and the smallest ID is not 20?

COUNT(FullName) Country COUNT(Maker) MIN(Id)

SELECT COUNT(FullName), Country, COUNT(Maker), MIN(Id) FROM car_makers WHERE Country != "5" GROUP BY Country HAVING MIN(Id) = 22 UNION SELECT COUNT(FullName), Country, COUNT(Maker), MIN(Id) FROM car_makers WHERE FullName <> "Fiat" GROUP BY Country HAVING MIN(Id) != 20


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

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


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


Question: Can you list all the allergies, including those that are not "Nuts" or where the allergy type is not "food", and also include "Grass Pollen" in the list?

SELECT Allergy FROM Allergy_Type WHERE Allergy <> "Nuts" OR AllergyType <> "food" UNION ALL SELECT Allergy FROM Allergy_Type WHERE Allergy = "Grass Pollen"


Question: Can you list all the parties from the election table where the district is less than or equal to 1, or the committee is not 'Appropriations', combined with all the parties from the party table where the comptroller is not 'John Faso' and the attorney general is 'Eliot Spitzer', or the US Senate is not 'Charles Schumer', or the party is not 'Independence', the party ID is greater than or equal to 2, and the year is before 2002?

SELECT Party FROM election WHERE "District" <= 1 OR Committee <> "Appropriations" UNION ALL SELECT Party FROM party WHERE Comptroller != "John Faso" AND Attorney_General = "Eliot Spitzer" OR US_Senate <> "Charles Schumer" OR Party != "Independence" AND "Party_ID" >= 2 AND "Year" < 2002.0


Question: Can you give me the ID of the driver that is only driver 5 and not driver 7?

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


Question: Can you give me the earnings, best finish, and final tables made for poker players who either had a best finish greater than 1 or earnings of 189233, but only if they also have a People ID other than 6 and have made a number of final tables that isn't 21?

SELECT Earnings, Best_Finish, Final_Table_Made FROM poker_player WHERE "Best_Finish" > 1.0 OR "Earnings" = 189233.0 INTERSECT SELECT Earnings, Best_Finish, Final_Table_Made FROM poker_player WHERE "People_ID" <> 6 AND "Final_Table_Made" <> 21.0


Question: Can you give me the smallest aircraft ID from the aircraft table, considering only aircraft where either the maximum gross weight isn't 123,500 lb (56,000 kg) and the aircraft ID is at least 1, or the maximum disk loading isn't 8.8 lb/ft² (43 kg/m²), or the aircraft isn't a Bell 206B3 JetRanger, and also give me the smallest aircraft ID from the airport_aircraft table, but only for airports that aren't airport ID 1?

SELECT MIN(Aircraft_ID) FROM aircraft WHERE Max_Gross_Weight != "123,500 lb (56,000 kg)" AND "Aircraft_ID" >= 1 OR Max_disk_Loading <> "8.8 lb/ft² (43 kg/m²)" OR Aircraft <> "Bell 206B3 JetRanger" UNION ALL SELECT MIN(Aircraft_ID) FROM airport_aircraft WHERE "Airport_ID" <> 1


Question: Can you give me the document IDs for documents with ID 2 that are not in "working" status, combined with the document IDs from draft copies with copy number 10?

SELECT document_id FROM Documents WHERE "document_id" = 2 AND document_status_code <> "working" UNION SELECT document_id FROM Draft_Copies WHERE "copy_number" = 10


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 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 from the driver table that are less than or equal to 6, combined with a list of driver IDs from the school_bus table that are exactly 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: What is the average price of publications where the book ID is less than 5 or the publication ID is 5, and also the average price of publications where the publisher is not Pearson and the book ID is at least 9, or the publication ID is not 2, or the publication date is October 2005?

SELECT AVG(Price) FROM publication WHERE "Book_ID" < 5 OR "Publication_ID" = 5 UNION ALL SELECT AVG(Price) FROM publication WHERE Publisher <> "Pearson" AND "Book_ID" >= 9 OR "Publication_ID" <> 2 OR Publication_Date = "October 2005"


Question: Which product and store combinations have a product ID of 1 or less and a store ID greater than 1?

SELECT Product_ID, Store_ID FROM store_product WHERE "Product_ID" <= 1 INTERSECT SELECT Product_ID, Store_ID FROM store_product WHERE "Store_ID" > 1


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

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


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


Question: Can you give me the ModelId, the smallest Maker value, and the total Model count for entries where the Maker is 16 or less and the Model is not "capri", but exclude any results where the Model is "pontiac", the Maker is 4 or more, or the ModelId is greater than 17?

SELECT ModelId, MIN(Maker), SUM(Model) FROM model_list WHERE "Maker" <= 16 AND Model <> "capri" EXCEPT SELECT ModelId, MIN(Maker), SUM(Model) FROM model_list WHERE Model = "pontiac" OR "Maker" >= 4 OR "ModelId" > 17


Question: Can you give me a list of driver IDs that are less than 7 from the driver table, combined with a list of driver IDs that are greater 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 that are less than 11, excluding those driver IDs that are also less than or equal to 4 and associated with a school bus?

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


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


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

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


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

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


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

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


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

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


Question: Can you list all the aircraft IDs from the aircraft table, specifically the one with ID 4, and combine that with a list of all aircraft IDs from the airport_aircraft table that are greater than 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 driver IDs, including those from the driver table that are 12 or greater, and those from the school bus table that are not equal to 3?

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


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

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 that are not 11 and that are also less than or equal to 9, considering only the driver IDs that appear in both the driver and school bus tables?

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


Question: Can you give me the employee IDs and ages of employees who either are employee ID 3, are not named Louis Deacon, and are 30 years old, or are not from Bristol, excluding those who are not 29 years old and are not employee ID 2?

SELECT Employee_ID, Age FROM employee WHERE "Employee_ID" = 3 AND Name <> "Louis Deacon" AND "Age" = 30 OR City != "Bristol" EXCEPT SELECT Employee_ID, Age FROM employee WHERE "Age" != 29 AND "Employee_ID" != 2


Question: Can you show me the budget in billions for departments where either their ranking isn't 6, their department ID is 13 or less, or their name isn't "Defense", excluding those budgets that are also found in departments created in 1913 or with a budget less than 77.6 billion, or whose name isn't "Homeland Security"?

SELECT Budget_in_Billions FROM department WHERE "Ranking" != 6 OR "Department_ID" <= 13 OR Name <> "Defense" NOT IN (SELECT Budget_in_Billions FROM department WHERE Creation <> "1913" AND "Budget_in_Billions" < 77.6 OR Name <> "Homeland Security")


Question: Can you give me a list of aircraft IDs that are less than 5, excluding those aircraft IDs greater than 3 that are also associated with airports?

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


Question: Can you give me the Driver ID from the driver table, specifically if the Driver ID is 3, but only if that Driver ID is not also in the school_bus table where the Driver ID is greater than 7?

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


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

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


Question: Can you show me the feature ID, property ID, and property feature description from the other property features, including those where the property ID isn't 6 and the description is "illo" or the feature ID is 3 or less, combined with those where the description isn't "illo" and the property ID is 6 or greater or the feature ID is greater than 2?

SELECT feature_id, property_id, property_feature_description FROM Other_Property_Features WHERE "property_id" <> 6 AND property_feature_description = "illo" OR "feature_id" <= 3 UNION SELECT feature_id, property_id, property_feature_description FROM Other_Property_Features WHERE property_feature_description <> "illo" AND "property_id" >= 6 OR "feature_id" > 2


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

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


Question: Could you please provide the other details, receipt number, document ID, and receipt date from the Documents table for records where the receipt number is "189" and the document type code is not "Hard Drive", or the document ID is less than or equal to 1, combined with records where the document type code is not "CD", the document ID is less than or equal to 3, the shipping agent code is "UP", and the other details are not "y", or the receipt date is "2014-12-25 17:22:44"?

SELECT other_details, receipt_number, document_id, receipt_date FROM Documents WHERE receipt_number = "189" AND document_type_code != "Hard Drive" OR "document_id" <= 1 UNION SELECT other_details, receipt_number, document_id, receipt_date FROM Documents WHERE document_type_code != "CD" AND "document_id" <= 3 AND shipping_agent_code = "UP" AND other_details != "y" OR receipt_date = "2014-12-25 17:22:44"


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

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


Question: Can you list all the years awards were given, including years that weren't 2018, and also including years that weren't 2016, or when the bonus was 3200?

SELECT Year_awarded FROM evaluation WHERE Year_awarded != "2018" UNION SELECT Year_awarded FROM evaluation WHERE Year_awarded <> "2016" OR "Bonus" = 3200.0


Question: Which aircraft IDs, other than aircraft ID 1, are also aircraft ID 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 the PetID and weight of pets, grouped by student ID, but only for groups where the student ID is 1002 or greater and the pet type is "dog", or where the weight is not 12 and the pet's age is over 2?

SELECT T1.PetID, T2.weight FROM Has_Pet as T1 JOIN Pets as T2 ON T1.PetID == T2.PetID GROUP BY StuID HAVING StuID >= 1002 AND PetType = "dog" OR weight <> 12.0 AND pet_age > 2


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 that are less 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 driver IDs that are less than or equal to 7, excluding those driver IDs that are also less than 10 and 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 < 10


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

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


Question: Can you give me the first name, staff ID, and date they left for staff members who either have the nickname "ynader" but aren't named Rebekah, or don't have the last name "Jast", or left on "2018-03-08 04:23:14" and have a staff address ID greater than 1 and a middle name of "Ulices" and a staff ID that isn't 15, or joined on a date other than "2018-01-02 12:24:24", combined with staff members who either aren't named "Jaleel", or don't have the nickname "ynader" and don't have the last name "Turner" and have a staff ID of 2, or joined on a date other than "2017-08-27 19:19:44"?

SELECT first_name, staff_id, date_left_staff FROM Staff WHERE nickname = "ynader" AND first_name <> "Rebekah" OR last_name != "Jast" OR date_left_staff = "2018-03-08 04:23:14" AND "staff_address_id" > 1 AND middle_name = "Ulices" AND "staff_id" != 15 OR date_joined_staff != "2018-01-02 12:24:24" UNION SELECT first_name, staff_id, date_left_staff FROM Staff WHERE first_name <> "Jaleel" OR nickname <> "ynader" AND last_name <> "Turner" AND "staff_id" = 2 OR date_joined_staff != "2017-08-27 19:19:44"


Question: What is the average flight ID for flights with a company ID less than 1 or an airport ID less than or equal to 1, or where the pilot is Thompson, combined with the average operate_company ID for companies where the ID is not 5 and the name is CLS Catering Services Limited, or they are incorporated in Vietnam and their principal activities are not Travel agency, or their type is Joint Venture and their Group Equity Shareholding is 49.0?

SELECT AVG(id) FROM flight WHERE "company_id" < 1 AND "airport_id" <= 1 OR Pilot = "Thompson" UNION SELECT AVG(id) FROM operate_company WHERE "id" != 5 AND name = "CLS Catering Services Limited" OR Incorporated_in = "Vietnam" AND Principal_activities <> "Travel agency" OR Type = "Joint Venture" AND "Group_Equity_Shareholding" = 49.0


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

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


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


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 10 INTERSECT 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 3 from the aircraft table, and also list the aircraft IDs that are greater than 2 from 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 > 2


Question: Which driver IDs appear in the driver table, excluding driver ID 11, and also appear as driver ID 4 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 = 4


Question: Can you give me the driver IDs that are both less than 10 and also 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: Can you give me a list of user IDs from the review table where the "a_id" is less than or equal to 5 and the "u_id" is 1, or the rating is not 10 and the "i_id" is greater than or equal to 3, or the rank is not 4, but excluding any user IDs from the user account table where the name is not "Mark" or the "u_id" is 4?

SELECT u_id FROM review WHERE "a_id" <= 5 AND "u_id" = 1 OR "rating" != 10 AND "i_id" >= 3 OR "rank" != 4 EXCEPT SELECT u_id FROM useracct WHERE name <> "Mark" OR "u_id" = 4


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

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


Question: Can you list the aircraft IDs that are less than 5 from the aircraft table, combined with the aircraft IDs that are greater than 2 from the airport_aircraft table, 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 > 2


Question: For books titled "The Dome: Ground Zero" or published on a date other than August 2008, or with a price other than 2,000,000, or written by someone other than Garth Ennis with a publication ID greater than 5, how many books are there, and what are their prices, grouped by writer, but only for those published by Thomson Reuters?

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


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

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


Question: What aircraft IDs are both greater than 1 when grouped in the aircraft table, and not equal to 1 when grouped in the airport_aircraft table?

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


Question: Can you give me a list of driver IDs that are less than 12, excluding the driver ID 3 if it appears 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 list the aircraft IDs, excluding aircraft ID 3, that appear in the aircraft table, but not in the airport_aircraft table where the aircraft ID is less than or equal to 1?

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


Question: Could you give me the contestant numbers that are both from contestants who are not named Loraine NygrenTania Mattioli or have a contestant number greater than 2, and also from contestants named Kelly Clauss or have a contestant number greater than 6?

SELECT contestant_number FROM CONTESTANTS WHERE contestant_name <> "Loraine NygrenTania Mattioli" OR "contestant_number" > 2 INTERSECT SELECT contestant_number FROM CONTESTANTS WHERE contestant_name = "Kelly Clauss" OR "contestant_number" > 6


Question: Can you give me a list of all the driver IDs, excluding driver ID 10 from the driver table and excluding driver ID 4 from the school bus table, combining the results into a single list?

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


Question: Can you give me the IDs of aircraft that are less than or equal to 1, excluding those aircraft IDs that are greater than 2 and are associated with airports?

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 aircraft IDs are both greater than or equal to 1 in the aircraft table and not equal to 1 in the airport_aircraft table?

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


Question: Can you give me a list of driver IDs 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 the temporary acting status and head IDs that appear in both of these lists: one where the head ID isn't 5 or the department ID isn't 2 and the temporary acting status isn't "No", and another where the temporary acting status isn't "Yes" and either the department ID is greater than 15 or the head ID isn't 3?

SELECT temporary_acting, head_ID FROM management WHERE "head_ID" <> 5 OR "department_ID" != 2 AND temporary_acting != "No" INTERSECT SELECT temporary_acting, head_ID FROM management WHERE temporary_acting != "Yes" AND "department_ID" > 15 OR "head_ID" <> 3


Question: Can you give me a list of driver IDs that are 12 or less, but only include those that are not also school bus driver IDs that are 4 or greater?

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


Question: Can you list all the driver IDs, including those from the driver table that are 12 or greater, and those from the school bus table that are greater than 10?

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


Question: Can you find the minimum group equity shareholding, incorporation location, sum of type, principal activities, ID, and maximum name for operating companies where either the group equity shareholding is less than or equal to 18.77 and the name is not "Hong Kong Airport Services" and the incorporation location is not "Hong Kong" or the type is "Subsidiary" and the ID is 9, combined with the same information for operating companies where the group equity shareholding is greater than 100.0 or the principal activities are not "Cargo airline"?

SELECT MIN(Group_Equity_Shareholding), Incorporated_in, SUM(Type), Principal_activities, id, MAX(name) FROM operate_company WHERE "Group_Equity_Shareholding" <= 18.77 AND name <> "Hong Kong Airport Services" AND Incorporated_in <> "Hong Kong" OR Type = "Subsidiary" AND "id" = 9 UNION ALL SELECT MIN(Group_Equity_Shareholding), Incorporated_in, SUM(Type), Principal_activities, id, MAX(name) FROM operate_company WHERE "Group_Equity_Shareholding" > 100.0 OR Principal_activities <> "Cargo airline"


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

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


Question: Could you give me the user IDs that are both from reviews where the user ID is 2 and either the rank isn't 2 or the account ID isn't 7, and also from user accounts where the name isn't Mark?

SELECT u_id FROM review WHERE "u_id" = 2 AND "rank" != 2 OR "a_id" != 7 INTERSECT SELECT u_id FROM useracct WHERE name <> "Mark"


Question: Can you list all the aircraft IDs, excluding aircraft ID 5, and also list all the aircraft IDs from the airport aircraft table, excluding aircraft ID 1?

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


Question: Can you give me the sum of nicknames and last names, the date someone left the staff, their birth date, staff ID, the maximum middle name, and staff address ID for staff members, combining two sets of results: first, those who didn't join on "2017-06-04 14:30:41", weren't born on "2003-01-16 06:29:11", don't have the nickname "weissnat.vincenzo", left on "2018-03-08 04:23:14", have a staff ID of 3 or less, and a staff address ID greater than 3; and second, those with a staff address ID of 1 or greater?

SELECT SUM(nickname), date_left_staff, date_of_birth, staff_id, MAX(middle_name), staff_address_id, SUM(last_name) FROM Staff WHERE date_joined_staff <> "2017-06-04 14:30:41" AND date_of_birth <> "2003-01-16 06:29:11" AND nickname != "weissnat.vincenzo" AND date_left_staff = "2018-03-08 04:23:14" AND "staff_id" <= 3 AND "staff_address_id" > 3 UNION SELECT SUM(nickname), date_left_staff, date_of_birth, staff_id, MAX(middle_name), staff_address_id, SUM(last_name) FROM Staff WHERE "staff_address_id" >= 1


Question: What are the aircraft IDs, starting from 1, that are present in the aircraft table but not in the airport_aircraft table where the aircraft IDs are greater than 3?

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


Question: Can you give me a list of driver IDs that are 11 or less, but exclude driver ID 3 if it appears in the school bus assignments?

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


Question: Can you give me a list of driver IDs, including driver ID 7 from the driver table, and any driver IDs less than 10 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 < 10


Question: Which aircraft IDs, that are no greater than 5, are present in both the aircraft and airport_aircraft datasets?

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: Could you list the driver IDs that are equal to 1 from the driver table, and also list the driver IDs greater than 3 from the school_bus table, combining the two lists?

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


Question: Can you give me a list of aircraft IDs, excluding aircraft ID 5, that are not also aircraft ID 1 found in the airport aircraft list?

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


Question: Which aircraft IDs, excluding aircraft ID 1, are also among the aircraft IDs less than or equal to 3?

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 list all the aircraft IDs, excluding aircraft ID 3 from the aircraft table, and combine that with a list of aircraft IDs, excluding aircraft ID 5 from 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 != 5


Question: Could you give me the Store IDs that are either not City Malls, have a ranking of 2 or higher, or have fewer than 1170 product categories, are named "Miramichi," and have an area size of 21.73 or greater, but only for stores located in District 15?

SELECT Store_ID FROM store WHERE Type <> "City Mall" OR "Ranking" >= 2 OR "Number_of_product_category" < 1170.0 AND Store_Name = "Miramichi" AND "Area_size" >= 21.73 INTERSECT SELECT Store_ID FROM store_district WHERE "District_ID" = 15


Question: Can you list the aircraft IDs that appear in the aircraft table, excluding aircraft ID 1, but only if they are not also listed in the airport_aircraft table with an aircraft ID of 1 or greater?

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


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

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


Question: Can you list the aircraft IDs from the aircraft table that are less than or equal to 3, excluding any aircraft IDs from the airport_aircraft table that are not equal to 3?

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


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

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


Question: Which driver IDs, excluding driver ID 7, are present in the driver table and also, excluding driver ID 10, are present in the school_bus table?

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


Question: Could you list the aircraft IDs for all aircraft with a distance less than 6441, and also include the aircraft IDs from the certificate table where the aircraft ID is greater than 7?

SELECT aid FROM aircraft WHERE "distance" < 6441 UNION ALL SELECT aid FROM certificate WHERE "aid" > 7


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

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


Question: Can you list all the driver IDs from the driver table that are less than 7, combined with all the driver IDs from the school_bus table that are less than 10?

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


Question: Can you give me a list of employee IDs that includes those from the employee table who are at least 32 years old, don't live in Wasps, have an ID other than 8, or aren't named Louis Deacon, combined with employee IDs from the evaluation table where the year awarded wasn't 2011?

SELECT Employee_ID FROM employee WHERE "Age" >= 32 OR City <> "Wasps" OR "Employee_ID" != 8 OR Name <> "Louis Deacon" UNION SELECT Employee_ID FROM evaluation WHERE Year_awarded != "2011"


Question: Can you give me a list of driver IDs that are less than 12, and combine that with a list of driver IDs from the school bus table that are not equal to 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 give me a list of driver IDs that are both less than or equal to 7 and appear in the driver table, and also less than 10 and appear in the school_bus table?

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


Question: Can you list the aircraft IDs, excluding aircraft ID 3, that appear in the aircraft table but not in the airport_aircraft table, where we're also excluding aircraft ID 2 from the airport_aircraft table?

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


Question: What is the sum of document status codes for documents that either don't have a receipt number of "124", or have a document status code that isn't "working" and a shipping agent code of "US", or have a receipt date that isn't "1974-05-08 00:00:46", or have other details equal to "r", but only considering those sums that are also the sum of document status codes for documents that don't have a document type code of "Hard Drive"?

SELECT SUM(document_status_code) FROM Documents WHERE receipt_number <> "124" OR document_status_code != "working" AND shipping_agent_code = "US" OR receipt_date != "1974-05-08 00:00:46" OR other_details = "r" INTERSECT SELECT SUM(document_status_code) FROM Documents WHERE document_type_code <> "Hard Drive"


Question: What is the average employee ID for circulation history entries where the employee ID is less than 2, combined with the average employee ID for employees with the role code "ED" and the name "Clemens", excluding employee ID 7?

SELECT AVG(employee_id) FROM Circulation_History WHERE "employee_id" < 2 UNION SELECT AVG(employee_id) FROM Employees WHERE role_code = "ED" AND employee_name = "Clemens" AND "employee_id" <> 7


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


Question: Can you list the aircraft IDs that are greater than 3, excluding those aircraft IDs from the airport aircraft table that are not equal to 2?

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


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

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: Can you give me a list of driver IDs from the driver table that are 8 or higher, excluding any driver IDs from the school_bus table that are less than 9?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID >= 8 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, combining those from the driver table that aren't 12 with those from the school bus table that are 4 or less?

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


Question: Can you give me a list of driver IDs that are less than 8, combined with a list of driver IDs from school buses that are greater than 3?

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


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

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


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

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


Question: What aircraft IDs are greater than 2, excluding those aircraft IDs that are less than or equal to 3 and are associated with an airport?

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


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

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


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

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


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

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