Question: Can you give me a list of driver IDs that are 8 or greater, but only those that are not also driver IDs of school buses where the driver ID is 4 or greater?

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


Question: What is the minimum age of heads in department 15, along with their head IDs?

SELECT MIN(T1.age), T2.head_ID FROM head as T1 JOIN management as T2 ON T1.head_ID = T2.head_ID WHERE "department_ID" = 15


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

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


Question: What is the difference between the number of temporary acting managers and the highest department ID for departments with an ID of 2 or less and head ID of 10 or less, excluding those who are not marked as "No", and the number of temporary acting managers and the highest department ID for departments with a head ID greater than 10 or a department ID less than 2, or those who are not marked as "Yes"?

SELECT COUNT(temporary_acting), MAX(department_ID) FROM management WHERE "department_ID" <= 2 AND "head_ID" <= 10 AND temporary_acting <> "No" EXCEPT SELECT COUNT(temporary_acting), MAX(department_ID) FROM management WHERE "head_ID" > 10 AND "department_ID" < 2 OR temporary_acting != "Yes"


Question: Can you give me the last name, the total advisor number, and the number of majors for students, combining two sets of results: first, those who are not student ID 1031 and whose advisor number is 8772 or less and are younger than 17, or are from city code HKG, or whose last name is Han; and second, those whose first name is David, or are not from city code BAL, or are older than 20 and have major 600 and are not male, or whose last name is not Apap, or whose advisor number is greater than 1148 and are not student ID 1019?

SELECT LName, SUM(Advisor), COUNT(Major) FROM Student WHERE "StuID" != 1031 AND "Advisor" <= 8772 AND "Age" < 17 OR city_code = "HKG" OR LName = "Han" UNION ALL SELECT LName, SUM(Advisor), COUNT(Major) FROM Student WHERE Fname = "David" OR city_code <> "BAL" OR "Age" > 20 AND "Major" = 600 AND Sex <> "M" OR LName <> "Apap" OR "Advisor" > 1148 AND "StuID" <> 1019


Question: What is the sum of contestant numbers for all contestants except Tabatha Gehling, combined with the sum of contestant numbers from votes where the vote ID is 1, or the contestant number is greater than 2 and the state is NJ?

SELECT SUM(contestant_number) FROM CONTESTANTS WHERE contestant_name <> "Tabatha Gehling" UNION SELECT SUM(contestant_number) FROM VOTES WHERE "vote_id" = 1 OR "contestant_number" > 2 AND state = "NJ "


Question: Can you give me the IDs of drivers with IDs less than 4, excluding those driver IDs that are also less than 7 in the school bus table?

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


Question: Can you give me a list of customer IDs from the Customers table, including those that aren't 15 and didn't become customers on November 16, 2015 at 10:52 PM, or whose first name is Sigrid, combined with a list of customer IDs from the Lessons table for lessons that are completed and not at 9 o'clock?

SELECT customer_id FROM Customers WHERE "customer_id" != 15 AND date_became_customer <> "2015-11-16 22:52:14" OR first_name = "Sigrid" UNION ALL SELECT customer_id FROM Lessons WHERE lesson_status_code = "Completed" AND lesson_time != "9"


Question: Which driver IDs are greater than 8 and also not equal to 10?

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

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


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


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

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


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

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


Question: Which driver IDs are greater than 1 and also appear in the list of school bus driver IDs, excluding driver ID 10?

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


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

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


Question: Can you list all driver IDs that are less than 10 from the driver table, and combine that with a list of driver IDs less than 4 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 < 4


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

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


Question: Can you give me the Aircraft ID that appears in the aircraft table, specifically ID 5, but only if it doesn't appear in the airport_aircraft table with an ID greater than 5?

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 the total Publication ID, average price, publisher, and total Book ID for publications where either the Publication ID is not 2 and the price is 3,000,000, or the publication date is April 2007, combined with the total Publication ID, average price, publisher, and total Book ID for publications where the Publication ID is 7 or greater and the publisher is Pearson?

SELECT SUM(Publication_ID), AVG(Price), Publisher, SUM(Book_ID) FROM publication WHERE "Publication_ID" <> 2 AND "Price" = 3000000.0 OR Publication_Date = "April 2007" UNION ALL SELECT SUM(Publication_ID), AVG(Price), Publisher, SUM(Book_ID) FROM publication WHERE "Publication_ID" >= 7 AND Publisher = "Pearson"


Question: Could you give me a list of document IDs that either aren't 2, or have a draft number greater than 2 and a copy number less than or equal to 10 and an employee ID greater than 1, combined with document IDs that have a copy number greater than 15 and a draft number less than or equal to 2, or an employee ID that isn't 8, or aren't 10?

SELECT document_id FROM Circulation_History WHERE "document_id" != 2 OR "draft_number" > 2 AND "copy_number" <= 10 AND "employee_id" > 1 UNION SELECT document_id FROM Circulation_History WHERE "copy_number" > 15 AND "draft_number" <= 2 OR "employee_id" != 8 OR "document_id" <> 10


Question: Which aircraft IDs, that are less than 4, are also aircraft IDs that equal 3 in the airport aircraft list?

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


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

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


Question: Which driver IDs appear in both the list of drivers excluding driver 3 and the list of school bus drivers that only includes driver 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 the driver IDs that are equal to 12 from the driver table, excluding any driver IDs that are equal to 3 from the school bus table?

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


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

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


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 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 greater than 5 and not equal to 10, 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 > 5 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 10


Question: Can you list the Company ID, People ID, and Year Working for all employment records where either the People ID is 3 or greater, or the Company ID is 13 or greater and the Year Working is 1 or greater, but excluding any records where either the Year Working is 4 or greater, or the Company ID is less than 11?

SELECT Company_ID, People_ID, Year_working FROM employment WHERE "People_ID" >= 3 OR "Company_ID" >= 13 AND "Year_working" >= 1 EXCEPT SELECT Company_ID, People_ID, Year_working FROM employment WHERE "Year_working" >= 4 OR "Company_ID" < 11


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

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


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


Question: Can you list all the head IDs from the head table where the age is 50 or older, or the head ID is 8 or greater and they weren't born in Alabama, combined with all the head IDs from the management table where the department ID is not 7 or their temporary acting status is "No"?

SELECT head_ID FROM head WHERE "age" >= 50.0 OR "head_ID" >= 8 AND born_state != "Alabama" UNION ALL SELECT head_ID FROM management WHERE "department_ID" <> 7 OR temporary_acting = "No"


Question: Can you give me a list of driver IDs that are greater than 7 from the driver table and combine that with a list of driver IDs that are greater than 4 from the school bus table, removing any duplicates?

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


Question: Can you give me a list of driver IDs, where each ID is 5 or greater, but only include those IDs that are not in the list of school bus driver IDs, excluding the ID 3?

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


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

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


Question: Can you give me a list of driver IDs from the driver table where the ID is less than or equal to 6, combined with a list of driver IDs 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: Can you give me a list of driver IDs from the driver table where each ID is less than or equal to 2, combined with a list of driver IDs from the school_bus table where each ID is less than 10?

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


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

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


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


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

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


Question: Can you give me a list of aircraft IDs from the aircraft table where the ID is 4 or higher, combined with a list of aircraft IDs from the airport_aircraft table where the ID is exactly 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 list the aircraft IDs that are less than 2 from the aircraft table, and also include the aircraft ID that equals 1 from the airport_aircraft table?

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


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

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


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

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


Question: Can you give me the People ID, Year Working, and Company ID from the employment table for people with IDs less than 4 and company IDs less than 13, along with the People ID, Year Working, and Company ID for those who worked in a year other than 3, have a People ID greater than 1, and a Company ID less than 7?

SELECT People_ID, Year_working, Company_ID FROM employment WHERE "People_ID" < 4 AND "Company_ID" < 13 UNION ALL SELECT People_ID, Year_working, Company_ID FROM employment WHERE "Year_working" <> 3 AND "People_ID" > 1 AND "Company_ID" < 7


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

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


Question: Can you give me a list of driver IDs that are greater than or equal to 12, excluding driver ID 9 if it's in the school bus driver 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 = 9


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

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


Question: What is the highest age of drivers and their corresponding school IDs, considering only drivers named Brandon McGee, or those with a count of years working equal to 2, or those who are not 52 years old, not full-time, not from Coventry, belong to the Dem party, and have a school ID greater than 7?

SELECT MAX(T1.Age), T2.School_ID FROM driver as T1 JOIN school_bus as T2 ON T1.Driver_ID = T2.Driver_ID WHERE Name = "Brandon McGee" OR COUNT(Years_Working) = 2 OR Age <> 52 AND If_full_time <> "T" AND Home_city <> "Coventry" AND Party = "Dem" AND School_ID > 7


Question: Could you list all contestant numbers, including those from contestants with numbers 11 or higher, and also those from votes where the vote ID is not 5 and either the state is not CA, or the phone number is greater than 5112677315, or the creation date is not 2018-03-09 19:03:40 and the contestant number is 3 or higher?

SELECT contestant_number FROM CONTESTANTS WHERE "contestant_number" >= 11 UNION ALL SELECT contestant_number FROM VOTES WHERE "vote_id" != 5 AND state <> "CA" OR "phone_number" > 5112677315 OR created <> "2018-03-09 19:03:40" AND "contestant_number" >= 3


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

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


Question: Can you give me the IDs of drivers with IDs less than 7, excluding those drivers who also have IDs of 4 or greater and are associated with a school bus?

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


Question: Can you list the rank, club ID, and coach ID for all coaches where the coach ID is less than 4, the gender is not male, or the rank is 5 or higher, combined with the rank, club ID, and coach ID for all coaches where the coach ID is greater than 4?

SELECT Rank, Club_ID, Coach_ID FROM coach WHERE "Coach_ID" < 4 OR Gender != "M" OR "Rank" >= 5 UNION SELECT Rank, Club_ID, Coach_ID FROM coach WHERE "Coach_ID" > 4


Question: Can you give me a list of company names from the company table where either the assets are greater than 1873.9 billion, the company ID is greater than 2, the sales are less than 87.6 billion, or the name isn't "Citigroup" and the headquarters isn't in the UK and the industry isn't "Oil and gas" and the profits are exactly 25.1 billion, or the market value is exactly 201.9 billion, combined with a list of names from the people table where the name isn't "Tim Naegeli" and the graduation college isn't "Virginia", or the nationality isn't the United Kingdom and the age is less than 30, or the people ID is greater than 4?

SELECT Name FROM company WHERE "Assets_in_Billion" > 1873.9 OR "Company_ID" > 2.0 OR "Sales_in_Billion" < 87.6 OR Name <> "Citigroup" AND Headquarters <> "UK" AND Industry <> "Oil and gas" AND "Profits_in_Billion" = 25.1 OR "Market_Value_in_Billion" = 201.9 UNION SELECT Name FROM people WHERE Name != "Tim Naegeli" AND Graduation_College != "Virginia" OR Nationality != "United Kindom" AND "Age" < 30 OR "People_ID" > 4


Question: Can you tell me the alphabetically last aircraft name from the aircraft table, considering only aircraft with a distance of 3383 or more, excluding those with an aid of 8, or aircraft whose name is not "British Aerospace Jetstream 41", combined with the alphabetically last employee name from the employee table, considering only employees whose name is not "James Smith" or whose salary is 212156?

SELECT MAX(name) FROM aircraft WHERE "distance" >= 3383 AND "aid" <> 8 OR name != "British Aerospace Jetstream 41" UNION ALL SELECT MAX(name) FROM employee WHERE name != "James Smith" OR "salary" = 212156


Question: Is the number of reviews for item 5 the same as the number of user accounts with ID 2?

SELECT COUNT(u_id) FROM review WHERE "i_id" = 5 INTERSECT SELECT COUNT(u_id) FROM useracct WHERE "u_id" = 2


Question: Which driver has an ID of 6, but does not have an ID of 7 in the school bus list?

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


Question: Can you give me a list of driver IDs that are less than 6 from the driver table, combined with a list of driver IDs that are not equal to 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: What aircraft IDs, excluding ID 5, are present in the aircraft table but not 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 != 5


Question: Could you give me a list of driver IDs that are not equal to 1 from the driver table, but only include those driver IDs that are also greater than or equal to 7 from the school bus table?

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


Question: Can you list all the driver IDs that are less than 7 from the driver table, combined with all the driver IDs that are less than 3 from the school bus table, removing any duplicates?

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


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


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

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


Question: Can you give me a list of driver IDs that are greater than 4, but exclude any driver IDs that also appear in the school bus table, unless that driver ID is 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, excluding aircraft ID 1, that appear in the aircraft table but not in the airport_aircraft table, also excluding aircraft ID 5 from the airport_aircraft table?

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


Question: Can you give me the IDs of drivers with an ID of 1 or less, excluding those drivers who also have an ID less than 3 in the school bus table?

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


Question: Can you give me the Club IDs that meet these two conditions: First, the club's description isn't "Refurbish computers; teach kids and adults about computer basics." or the club is located in "AKW" and named "Bootup Baltimore" and also has a ClubID less than or equal to 4. Second, the Club ID is associated with a member with StuID 1010 or the ClubID is greater than 1?

SELECT ClubID FROM Club WHERE ClubDesc != "Refurbish computers; teach kids and adults about computer basics." OR ClubLocation = "AKW" AND ClubName = "Bootup Baltimore" AND "ClubID" <= 4 INTERSECT SELECT ClubID FROM Member_of_club WHERE "StuID" = 1010 OR "ClubID" > 1


Question: Which aircraft IDs, excluding aircraft ID 2, are also among the aircraft IDs that are less than or equal to 3 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 <= 3


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

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


Question: Can you give me a list of driver IDs that are 5 or greater 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 >= 5 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 9


Question: Can you give me the head IDs that are both not associated with the name "Jeff Maggert" and are also associated with a department ID greater than 15 or a temporary acting status of "No"?

SELECT head_ID FROM head WHERE name <> "Jeff Maggert" INTERSECT SELECT head_ID FROM management WHERE "department_ID" > 15 OR temporary_acting = "No"


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

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


Question: Can you give me a list of driver IDs that are greater than 6, but not less than 9, considering only the driver IDs that appear in both the driver and school bus records?

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


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

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


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

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 list the aircraft IDs from the aircraft table that are less than or equal to 1, and combine that with a list of aircraft IDs from the airport_aircraft table that are greater than 1?

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


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

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


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

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


Question: Which driver IDs, excluding driver ID 2, are also driver IDs of school buses, excluding school bus driver ID 9?

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


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

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


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

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


Question: Can you give me a list of driver IDs, including driver ID 11 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 = 11 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 10


Question: Can you give me a list of driver IDs, including those from the driver table that are less than 2 and those from the school bus table that are 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 the earnings, people IDs, and poker player IDs for all poker players who either have a best finish less than 2 and didn't make 19 final tables, or have earnings less than 596462, combined with those who either don't have a money rank of 166, or have a people ID less than 6 and a best finish less than 2?

SELECT Earnings, People_ID, Poker_Player_ID FROM poker_player WHERE "Best_Finish" < 2.0 AND "Final_Table_Made" <> 19.0 OR "Earnings" < 596462.0 UNION SELECT Earnings, People_ID, Poker_Player_ID FROM poker_player WHERE "Money_Rank" != 166.0 OR "People_ID" < 6 AND "Best_Finish" < 2.0


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

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


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

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 aircraft IDs that are not equal to 3, and also less than 2, based on the aircraft and airport aircraft information?

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: Could you list the description of each aircraft along with its corresponding aircraft ID?

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


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

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


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

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


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

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


Question: Can you list the aircraft IDs that are less than 5, excluding any aircraft IDs from the airport aircraft list that are 5 or greater?

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 the flight number, pilot, company ID, date, airport ID, altitude, and velocity for all flights where either the flight ID is not 7, the date is July 16, 1965, or the altitude is at least 3650, the pilot isn't Peterson, the flight number isn't M2-F1 #61, and the velocity is at least 240, combined with all flights where either the pilot isn't Peterson and the flight number isn't M2-F1 #73, or the date is March 28, 1966?

SELECT Vehicle_Flight_number, Pilot, company_id, Date, airport_id, Altitude, Velocity FROM flight WHERE "id" != 7 OR Date = "July 16, 1965" OR "Altitude" >= 3650.0 AND Pilot != "Peterson" AND Vehicle_Flight_number <> "M2-F1 #61" AND "Velocity" >= 240.0 UNION ALL SELECT Vehicle_Flight_number, Pilot, company_id, Date, airport_id, Altitude, Velocity FROM flight WHERE Pilot != "Peterson" AND Vehicle_Flight_number <> "M2-F1 #73" OR Date = "March 28, 1966"


Question: Can you give me a list of customer IDs, excluding those who have a vehicle ID of 2 or more, or a lesson status code other than "Cancelled", from customers who either didn't become customers on "2016-11-30 10:37:41", aren't classified as "Bad Customer", have an email address other than "asha.kilback@example.org" and a birthdate other than "1998-09-18 04:45:01", don't have an amount outstanding of 9500.0, have a cell phone number other than "+57(9)4602098297" and a customer ID other than 2 and a first name other than "Estelle", or have a phone number of "1-673-962-8158x7646"?

SELECT customer_id FROM Customers WHERE date_became_customer != "2016-11-30 10:37:41" OR customer_status_code <> "Bad Customer" OR email_address <> "asha.kilback@example.org" AND date_of_birth <> "1998-09-18 04:45:01" OR "amount_outstanding" != 9500.0 OR cell_mobile_phone_number <> "+57(9)4602098297" AND "customer_id" <> 2 AND first_name <> "Estelle" OR phone_number = "1-673-962-8158x7646" EXCEPT SELECT customer_id FROM Lessons WHERE "vehicle_id" >= 2 OR lesson_status_code <> "Cancelled"


Question: Which aircraft have an ID of 2 in the aircraft table, but do not have an ID other than 2 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 <> 2


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

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


Question: Can you give me the Driver ID, years working, and full-time status for school bus drivers who have a Driver ID of 7 or higher, and who also either work full-time, have a Driver ID other than 7, have worked for 6 years, or are associated with a school ID less than 7?

SELECT Driver_ID, Years_Working, If_full_time FROM school_bus WHERE "Driver_ID" >= 7 INTERSECT SELECT Driver_ID, Years_Working, If_full_time FROM school_bus WHERE If_full_time = "T" OR "Driver_ID" != 7 OR "Years_Working" = 6 OR "School_ID" < 7


Question: Can you give me a list of student IDs from the Has_Pet table, including those with a PetID of 2002 or higher, or a StuID greater than 1001, and also including student ID 1002?

SELECT StuID FROM Has_Pet WHERE "PetID" >= 2002 OR "StuID" > 1001 UNION SELECT StuID FROM Has_Pet WHERE "StuID" = 1002


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

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


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

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


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

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


Question: What are the average contestant number and total state value for votes where the contestant number is 5 or greater, the phone number is less than 6209222712, the creation time is not 2018-03-09 19:03:40, or the vote ID is not 5, excluding the average contestant number and total state value for votes where the creation time is not 2018-03-09 19:03:36 and the state is not NY?

SELECT AVG(contestant_number), SUM(state) FROM VOTES WHERE "contestant_number" >= 5 AND "phone_number" < 6209222712 OR created != "2018-03-09 19:03:40" OR "vote_id" != 5 EXCEPT SELECT AVG(contestant_number), SUM(state) FROM VOTES WHERE created <> "2018-03-09 19:03:36" AND state != "NY"


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


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 3 or greater from the school bus table?

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


Question: Could you list all the document type codes from the Documents table where the document status is not "done", or the document ID is greater than or equal to 4 and the document type code is not "Paper", or the other details are not "n" and the shipping agent code is not "UP", combined with all the document type codes from the Ref_Document_Types table where the document type description is not "f" or the document type code is "Hard Drive"?

SELECT document_type_code FROM Documents WHERE document_status_code <> "done" OR "document_id" >= 4 AND document_type_code != "Paper" OR other_details <> "n" AND shipping_agent_code != "UP" UNION ALL SELECT document_type_code FROM Ref_Document_Types WHERE document_type_description <> "f" OR document_type_code = "Hard Drive"


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 9 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 from the driver table that are less than 6, combined with a list of driver IDs from the school bus table that are not equal to 4?

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


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

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


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

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


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

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


Question: 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 IDs of drivers, up to ID 7, who are drivers but not school bus drivers?

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 customer IDs, including those who didn't use Direct Debit and didn't make a payment on March 20, 2018 at 9:38 PM, combined with those who didn't use Direct Debit and didn't make a payment on February 19, 2018 at 9:06 AM, and either paid less than $1708.18 or are not customer ID 14?

SELECT customer_id FROM Customer_Payments WHERE payment_method_code <> "Direct Debit" AND datetime_payment <> "2018-03-20 21:38:41" UNION SELECT customer_id FROM Customer_Payments WHERE payment_method_code <> "Direct Debit" AND datetime_payment <> "2018-02-19 09:06:29" AND "amount_payment" < 1708.18 OR "customer_id" != 14


Question: Which aircraft IDs, less than or equal to 1, are present in both the aircraft and airport_aircraft tables?

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


Question: Which driver has an ID of 9, but is not a driver with an ID less than 7 who drives 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 < 7


Question: Can you list the County ID, Zip code, and Population for all counties, excluding those with Zip code "D09", and then further exclude any counties with County ID 1, Zip code not equal to "D21", and County name "Manning", or those with a population of 13300?

SELECT County_Id, Zip_code, Population FROM county WHERE Zip_code <> "D09" EXCEPT SELECT County_Id, Zip_code, Population FROM county WHERE "County_Id" = 1 AND Zip_code <> "D21" AND County_name = "Manning" OR "Population" = 13300.0


Question: Can you show me the payment amount, customer ID, payment date and time, and payment method for customers with IDs up to 3, but exclude any payments that weren't made by direct debit, or had an amount of 1708.18, or occurred at a different time than March 18, 2018, 1:48:13 PM if the customer ID is greater than 13?

SELECT amount_payment, customer_id, datetime_payment, payment_method_code FROM Customer_Payments WHERE "customer_id" <= 3 EXCEPT SELECT amount_payment, customer_id, datetime_payment, payment_method_code FROM Customer_Payments WHERE payment_method_code <> "Direct Debit" OR "amount_payment" = 1708.18 OR datetime_payment <> "2018-03-18 13:48:13" AND "customer_id" > 13


Question: What are the aircraft IDs that are greater than or equal to 1, excluding those aircraft IDs less than 3 that are present 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 < 3


Question: Can you give me a list of all member IDs, including those members who are at level 6 and also those members from the membership register whose ID is 7 or less and who didn't register in 2016?

SELECT Member_ID FROM member WHERE "Level" = 6 UNION ALL SELECT Member_ID FROM membership_register_branch WHERE "Member_ID" <= 7 AND Register_Year <> "2016"


Question: Can you find the smallest Pet ID, weight, and pet type for pets where either the Pet ID is 2001, or the weight is 12.0 and the pet type is dog and the pet age is a specific value? Also, can you combine that with the smallest Pet ID, weight, and pet type for pets where the weight is less than 13.4 or the pet type is not cat?

SELECT MIN(PetID), weight, PetType FROM Pets WHERE "PetID" = 2001 OR "weight" = 12.0 AND PetType = "dog" AND "pet_age" = 2 UNION SELECT MIN(PetID), weight, PetType FROM Pets WHERE "weight" < 13.4 OR PetType != "cat"


Question: Can you give me a list of driver IDs, including driver ID 2 from the driver table, and all driver IDs except 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 give me a list of member and branch IDs, combining those from membership registrations in 2017, excluding member ID 5, with those from purchases where either the branch ID isn't 6 or the total purchase amount is no more than 20.99, or the member ID isn't 3?

SELECT Member_ID, Branch_ID FROM membership_register_branch WHERE "Member_ID" <> 5 AND Register_Year = "2017" UNION SELECT Member_ID, Branch_ID FROM purchase WHERE Branch_ID <> "6" AND "Total_pounds" <= 20.99 OR "Member_ID" <> 3


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

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


Question: Can you list the country ID and country name for all countries where the continent number is less than 3 and the country ID is less than 5, or where the country name is not "france", combined with the country ID and country name for countries where the country ID is greater than or equal to 8, the continent number is greater than 1, and the country name is "uk"?

SELECT CountryId, CountryName FROM countries WHERE "Continent" < 3 AND "CountryId" < 5 OR CountryName != "france" UNION SELECT CountryId, CountryName FROM countries WHERE "CountryId" >= 8 AND "Continent" > 1 AND CountryName = "uk"


Question: Can you give me a list of Aircraft IDs that are greater than 1 from the aircraft table, combined with a list of Aircraft IDs that are greater than 2 from the airport_aircraft table?

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


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

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


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

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


Question: Can you give me the advisor, first name, major, age, and city code of male students who are 18 years old and whose first name isn't Jun, excluding those who are 17 or younger and live in NYC and whose last name isn't Cheng, or those whose first name isn't Sarah and whose advisor number is greater than 8423?

SELECT Advisor, Fname, Major, Age, city_code FROM Student WHERE Sex = "M" AND Fname <> "Jun" AND "Age" = 18 EXCEPT SELECT Advisor, Fname, Major, Age, city_code FROM Student WHERE "Age" <= 17 AND city_code = "NYC" AND LName <> "Cheng" OR Fname <> "Sarah" AND "Advisor" > 8423


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

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


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

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


Question: Can you give me a list of aircraft IDs, excluding ID 2, that appear in the aircraft table, but are not in the airport_aircraft table, also excluding ID 1 from that 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 is the alphabetically first state from the AREA_CODE_STATE table, excluding Tennessee, or where the area code is less than 979, combined with the alphabetically first state from the VOTES table, excluding entries created on "2018-03-09 19:03:39" and New York, or where the phone number is less than 7182887233, or where the vote ID is not 5?

SELECT MIN(state) FROM AREA_CODE_STATE WHERE state <> "TN" OR "area_code" < 979 UNION ALL SELECT MIN(state) FROM VOTES WHERE created <> "2018-03-09 19:03:39" AND state <> "NY" OR "phone_number" < 7182887233 OR "vote_id" <> 5


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

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


Question: Which driver IDs, excluding driver ID 7, are also driver IDs greater than 4 that are associated with school buses?

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


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

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


Question: Could you list all the zip codes from the county table where the population is less than or equal to 21000, excluding zip code D02, and also include all zip codes where the population is not 13300?

SELECT Zip_code FROM county WHERE "Population" <= 21000.0 AND Zip_code <> "D02" UNION SELECT Zip_code FROM county WHERE "Population" <> 13300.0


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

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


Question: Can you give me a list of document IDs for documents that are either in "working" status or have other details that aren't "j", combined with document IDs from draft copies that have a draft number greater than 9 or a document ID of 2?

SELECT document_id FROM Documents WHERE document_status_code = "working" OR other_details <> "j" UNION SELECT document_id FROM Draft_Copies WHERE "draft_number" > 9 OR "document_id" = 2


Question: Can you give me a list of driver IDs from the driver table where the ID is less than 3, and combine that with a list of driver IDs from the school_bus table where the ID is not 9?

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


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

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


Question: What is the sum of item IDs for items that are not shampoo or have an item ID less than or equal to zero, combined with the sum of item IDs from reviews where the user ID is greater than or equal to one or the agent ID is greater than seven?

SELECT SUM(i_id) FROM item WHERE title != "shampoo" OR "i_id" <= 0 UNION SELECT SUM(i_id) FROM review WHERE "u_id" >= 1 OR "a_id" > 7


Question: Can you give me the flight IDs that meet both of these conditions: first, the company ID is 7 or higher, or the pilot is Thompson, or the altitude is above 3650, or the date is not January 29, 1964; and second, the operating company name is not Cathay Pacific Catering Services (HK) Limited?

SELECT id FROM flight WHERE "company_id" >= 7 AND Pilot = "Thompson" OR "Altitude" > 3650.0 OR Vehicle_Flight_number != "M2-F1 #1" OR Date <> "January 29, 1964" INTERSECT SELECT id FROM operate_company WHERE name <> "Cathay Pacific Catering Services (HK) Limited"


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

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


Question: Can you give me 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 less than 7?

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


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

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


Question: Which driver has an ID of 2, but is not a driver with an ID less than or equal to 9 in the school bus table?

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


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


Question: Can you list the aircraft IDs from the aircraft table that are greater than or equal to 1, combined with the aircraft IDs from the airport_aircraft table that are greater than or equal to 2?

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: For each district ID, how many district IDs are there, excluding those with the name "Khanewal District"?

SELECT COUNT(T1.District_ID), T2.District_ID FROM district as T1 JOIN store_district as T2 ON T1.District_ID = T2.District_ID WHERE District_name <> "Khanewal District"


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

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


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

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


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

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


Question: Which driver IDs, excluding driver ID 9, are in the driver table but not in the school bus table for driver IDs less than 7?

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: What is the sum of employee IDs for employees with an ID greater than 4 or who live in Bath, combined with the sum of employee IDs from evaluations where the bonus is not 3000?

SELECT SUM(Employee_ID) FROM employee WHERE "Employee_ID" > 4 OR City = "Bath" UNION ALL SELECT SUM(Employee_ID) FROM evaluation WHERE "Bonus" <> 3000.0


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

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


Question: Can you show me the lowest Book IDs and their corresponding issue numbers for books written by Christopher Hinz with more than 9 issues, combined with the lowest Book IDs and issue numbers for books that either don't have 12 issues, aren't titled "Dead Corps", or are written by Garth Ennis and have a Book ID of 3?

SELECT MIN(Book_ID), Issues FROM book WHERE Writer = "Christopher Hinz" AND "Issues" > 9.0 UNION SELECT MIN(Book_ID), Issues FROM book WHERE "Issues" != 12.0 OR Title <> "Dead Corps" OR "Book_ID" = 3 AND Writer = "Garth Ennis"


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

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


Question: Which aircraft have an Aircraft_ID of 3 and also have an Aircraft_ID greater than 1 in the airport aircraft table?

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


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

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


Question: Which driver IDs, excluding driver ID 5, are present in the driver table but not in the school bus table, where we only consider 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 <> 5 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 3


Question: Can you give me the position, student ID, and club ID for members who are either vice-presidents, have a student ID that isn't 1001, or belong to a club with an ID less than 1, but only if they also belong to a club with an ID that isn't 4?

SELECT Position, StuID, ClubID FROM Member_of_club WHERE Position = "Vice-President" OR "StuID" <> 1001 OR "ClubID" < 1 INTERSECT SELECT Position, StuID, ClubID FROM Member_of_club WHERE "ClubID" <> 4


Question: Which driver IDs are present in the driver table, excluding driver ID 9, but not present in the school_bus table where the driver ID is greater than 4?

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


Question: Can you give me a list of driver IDs, excluding driver ID 12, that appear in the driver table but not in the school_bus table, where driver ID 3 is excluded from the school_bus table?

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


Question: Can you give me the IDs of items that either have an ID of 3 or less, or have a title that isn't "apple" and also isn't among the IDs of items with titles other than "shampoo"?

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


Question: Can you give me the document ID, mailed-to address ID, and mailing date for all records where either the mailing date is not November 7th, 1992 at 3:03 PM or the mailed-to address ID is less than 4, combined with all records where the mailing date is May 22nd, 1999 at 11:21 PM and the document ID is 7, or the mailed-to address ID is less than 8?

SELECT document_id, mailed_to_address_id, mailing_date FROM Documents_Mailed WHERE mailing_date != "1992-11-07 15:03:41" OR "mailed_to_address_id" < 4 UNION SELECT document_id, mailed_to_address_id, mailing_date FROM Documents_Mailed WHERE mailing_date = "1999-05-22 23:21:07" AND "document_id" = 7 OR "mailed_to_address_id" < 8


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

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 Aircraft IDs that are both less than or equal to 5 in the aircraft table and greater than or equal to 2 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 >= 2


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


Question: What are the maximum city, the number of employees, and the name for employees named George Chuter, or whose age is less than or equal to 29, or whose employee ID is less than or equal to 8, excluding the maximum city, number of employees, and name for employees older than 29, not named Lee Mears, and not from Leicester?

SELECT MAX(City), COUNT(Employee_ID), Name FROM employee WHERE Name = "George Chuter" OR "Age" <= 29 OR "Employee_ID" <= 8 EXCEPT SELECT MAX(City), COUNT(Employee_ID), Name FROM employee WHERE "Age" > 29 AND Name != "Lee Mears" AND City <> "Leicester"


Question: Can you list the aircraft IDs, including those from the aircraft table where the ID is 1 or greater, and those from the airport_aircraft table where the ID is not 3?

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


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

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: Which driver IDs are greater than or equal to 8, but not less than or equal to 9 and present in the school bus table?

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


Question: Can you list the start year, club name, region, and club ID for Gefle IF, and also for any clubs with a start year not equal to 2011, or a club ID of 6 or greater, that are not named AIK and are located in the USA?

SELECT Start_year, Club_name, Region, Club_ID FROM club WHERE Club_name = "Gefle IF" UNION SELECT Start_year, Club_name, Region, Club_ID FROM club WHERE "Start_year" <> 2011 OR "Club_ID" >= 6 AND Club_name != "AIK" AND Region = "USA"


Question: Can you give me a list of aircraft IDs that are less than 5 and appear in the aircraft table, but also appear in the airport_aircraft table with an ID that is not 5?

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


Question: Can you show me the sex, the minimum advisor number, age, the minimum student ID, the minimum major, and the sum of last names for students, combining two sets of results: first, those where the major is 550 and the last name isn't Brown and the advisor isn't 8423, or the sex isn't female and the student ID isn't 1028 and the first name isn't William, or the age isn't 20, or the city code is CHI; and second, those where the student ID isn't 1023 or the city code isn't PIT?

Sex MIN(Advisor) Age MIN(StuID) MIN(Major) SUM(LName)

SELECT Sex, MIN(Advisor), Age, MIN(StuID), MIN(Major), SUM(LName) FROM Student WHERE "Major" = 550 AND LName <> "Brown" AND "Advisor" != 8423 OR Sex <> "F" AND "StuID" <> 1028 AND Fname != "William" OR "Age" <> 20 OR city_code = "CHI" UNION ALL SELECT Sex, MIN(Advisor), Age, MIN(StuID), MIN(Major), SUM(LName) FROM Student WHERE "StuID" != 1023 OR city_code != "PIT"


Question: Can you give me the document IDs from the drafts that either have draft details of "k" or a draft number less than 4, but exclude any document IDs from mailed documents that are greater than or equal to 10, were not mailed on "1979-09-21 10:30:52", and were not mailed to address ID 5?

SELECT document_id FROM Document_Drafts WHERE draft_details = "k" OR "draft_number" < 4 EXCEPT SELECT document_id FROM Documents_Mailed WHERE "document_id" >= 10 AND mailing_date <> "1979-09-21 10:30:52" AND "mailed_to_address_id" <> 5


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

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


Question: What is the smallest document ID from the circulation history, excluding document ID 1 and including only records where the employee ID is at least 1, the copy number is greater than 10, or the draft number is greater than 1, after removing the smallest document ID from documents mailed where the document ID is greater than 2?

SELECT MIN(document_id) FROM Circulation_History WHERE "document_id" <> 1 AND "employee_id" >= 1 OR "copy_number" > 10 OR "draft_number" > 1 EXCEPT SELECT MIN(document_id) FROM Documents_Mailed WHERE "document_id" > 2


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

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


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

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


Question: Can you give me a list of driver IDs, including all driver IDs from the driver table that are not 4, and also including all driver IDs from the school_bus table that are 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 equal to 6 from the driver table, but only include those driver IDs that are also greater than or equal to 3 from the school bus table?

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


Question: Can you list the aircraft IDs that are both greater than or equal to 5 in the aircraft table and not equal to 2 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 != 2


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

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


Question: Could you give me the People IDs of individuals who are both under 31 years old and didn't graduate from Iowa, and who also either didn't graduate from California, are named Tom Sheehey, or have a People ID of 7 or higher?

SELECT People_ID FROM people WHERE "Age" < 31 AND Graduation_College <> "Iowa" INTERSECT SELECT People_ID FROM people WHERE Graduation_College <> "California" OR Name = "Tom Sheehey" OR "People_ID" >= 7


Question: Can you give me the total pounds, branch ID, and member ID from the purchase table for purchases where the total pounds is less than or equal to 343.76, and also include the total pounds, branch ID, and member ID for all purchases where either the member ID is not 3 or the total pounds is not 321.13 and the branch ID is 1?

SELECT Total_pounds, Branch_ID, Member_ID FROM purchase WHERE "Total_pounds" <= 343.76 UNION ALL SELECT Total_pounds, Branch_ID, Member_ID FROM purchase WHERE "Member_ID" != 3 OR "Total_pounds" <> 321.13 AND Branch_ID = "1"


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


Question: Which driver IDs, greater than 11, are present in the driver table but not in the school_bus table if we only consider driver IDs greater than 7 in the school_bus table?

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


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

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


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

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


Question: Can you give me the smallest country name, the total of the country IDs, and the continent for countries where the country name is Germany or any country ID is greater than 5, combined with the same information for countries where the country ID is less than 13 or the continent is not equal to 2?

SELECT MIN(CountryName), SUM(CountryId), Continent FROM countries WHERE CountryName = "germany" OR "CountryId" > 5 UNION SELECT MIN(CountryName), SUM(CountryId), Continent FROM countries WHERE "CountryId" < 13 OR "Continent" <> 2


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

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


Question: Can you give me the store and product IDs for products with an ID of 4 or higher, or stores with an ID of 1 or higher, excluding those products with an ID of 4 or lower?

SELECT Store_ID, Product_ID FROM store_product WHERE "Product_ID" >= 4 OR "Store_ID" >= 1 EXCEPT SELECT Store_ID, Product_ID FROM store_product WHERE "Product_ID" <= 4


Question: Can you give me a list of all Driver IDs, excluding 10, from the driver table, combined with the Driver ID 10 from the school_bus table?

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


Question: Can you give me a list of item IDs, combining those that aren't item ID 4 and don't have the title "shampoo" with those that are either item ID less than 4 or have a user ID greater than 2 and a rank that isn't 5?

SELECT i_id FROM item WHERE "i_id" != 4 AND title <> "shampoo" UNION SELECT i_id FROM review WHERE "i_id" < 4 OR "u_id" > 2 AND "rank" != 5


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

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


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

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


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

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


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

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


Question: What aircraft IDs are equal to 1 in the aircraft table, excluding those aircraft IDs that are equal to 3 in the airport_aircraft table?

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


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

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


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

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


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

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

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


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

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


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

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


Question: Can you give me a list of document IDs, including those not mailed to address ID 5, and also those mailed to any address ID greater than 0 or with a document ID not equal to 12?

SELECT document_id FROM Documents_Mailed WHERE "mailed_to_address_id" <> 5 UNION SELECT document_id FROM Documents_Mailed WHERE "mailed_to_address_id" > 0 OR "document_id" != 12


Question: What is the largest company name, excluding Citigroup or those in the Oil and Gas industry with sales not equal to 102.6 billion, combined with the largest name from people who are not from the United States?

SELECT MAX(Name) FROM company WHERE Name <> "Citigroup" OR Industry = "Oil and gas" AND "Sales_in_Billion" <> 102.6 UNION SELECT MAX(Name) FROM people WHERE Nationality <> "United States"


Question: Can you give me a list of all aircraft IDs, excluding aircraft ID 3, from both the aircraft and airport_aircraft records?

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 aircraft IDs, excluding aircraft ID 1, that are present in the aircraft table but not in the airport_aircraft table, where aircraft ID 5 is excluded from the airport_aircraft table?

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


Question: What is the total freight in metric tons for each airport?

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


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

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


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

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


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

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


Question: Can you give me a list of driver IDs, excluding driver ID 10 from the driver table and excluding driver ID 3 from the school_bus table, combining the results and 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 give me a list of driver IDs, including driver ID 2 from the driver table and any driver IDs greater than or 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 find the smallest flight ID and the pilot for flights, grouped by vehicle flight number, where either the flight velocity is greater than 240 or the pilot is Thompson, and the flight either departs from airport BLL, has an altitude not equal to 3650, or an airport ID not equal to 1; or the airport name is Bergen Airport; or the company ID is greater than or equal to 11 and the country is Belgium and the velocity is not equal to 240 and the date is October 25, 1963; or the city is Akureyri; or the pilot is not Thompson?

SELECT MIN(T1.id), T2.Pilot FROM airport as T1 JOIN flight as T2 ON T1.id = T2.id WHERE IATA = "BLL" AND "Altitude" <> 3650.0 AND "airport_id" <> 1 OR name = "Bergen Airport" OR "company_id" >= 11 AND Country = "Belgium" AND "Velocity" <> 240.0 AND Date = "October 25, 1963" OR City = "Akureyri" OR Pilot <> "Thompson" GROUP BY Vehicle_Flight_number HAVING Velocity > 240.0 OR Pilot = "Thompson"


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

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


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

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


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


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

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


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

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 less than 2 from the driver table, combined with a list of driver IDs that are not equal to 10 from the school bus table?

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


Question: How many districts, excluding Khanewal District, are headquartered in each city, but only showing cities other than Bahawalnagar City that have at least one store and a population greater than 314617?

SELECT COUNT(T1.District_ID), T2.District_ID FROM district as T1 JOIN store_district as T2 ON T1.District_ID = T2.District_ID WHERE District_name <> "Khanewal District" GROUP BY Headquartered_City HAVING Headquartered_City <> "Bahawalnagar City" AND Store_ID >= 1 AND City_Population > 314617.0


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

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 aircraft IDs, excluding aircraft ID 3, that appear in the aircraft table but not in the airport_aircraft table when we only consider aircraft ID 3 in the airport_aircraft table?

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


Question: Can you give me a list of user IDs, including those that are not 2 or have the name Helen, and also including user IDs that are 2 but do not have the name Nancy?

SELECT u_id FROM useracct WHERE "u_id" != 2 OR name = "Helen" UNION ALL SELECT u_id FROM useracct WHERE "u_id" = 2 AND name != "Nancy"


Question: Which driver IDs appear in both the list of drivers who are not driver 4 and the list of school bus drivers who are driver 10?

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


Question: Which driver IDs are equal to 6 in the driver table, but not less than or equal to 9 in the school bus table?

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


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

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


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

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


Question: Can you give me the IDs of drivers, where each ID is greater than 3, excluding the IDs of school bus drivers where each ID is less than or equal to 9?

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


Question: Could you give me a list of driver IDs, considering only drivers who are either under 40, have an ID of 10, are not affiliated with the "Rep" party, or are named Edwin Vargas, but excluding any driver IDs that are also associated with school buses where the driver isn't full-time, the driver ID isn't 3, or the school ID is 1 or higher?

SELECT Driver_ID FROM driver WHERE "Age" < 40 OR "Driver_ID" = 10 OR Party <> "Rep" OR Name = "Edwin Vargas" EXCEPT SELECT Driver_ID FROM school_bus WHERE If_full_time != "T" OR "Driver_ID" <> 3 OR "School_ID" >= 1


Question: Could you list the districts of shops where either the manager isn't Kai Nyyssönen and the number of products is 10000, or the shop name is FC Haka, or the shop ID is greater than 3, or the district isn't Arto Tolsa Areena, combined with the districts of shops where the shop ID is less than or equal to 6, the name isn't FF Jaro, and the manager is Mika Lehkosuo?

SELECT District FROM shop WHERE Manager_name != "Kai Nyyssönen" AND "Number_products" = 10000 OR Name = "FC Haka" OR "Shop_ID" > 3 OR District <> "Arto Tolsa Areena" UNION SELECT District FROM shop WHERE "Shop_ID" <= 6 AND Name <> "FF Jaro" AND Manager_name = "Mika Lehkosuo"


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

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


Question: Could you list all the document IDs from the circulation history where the draft number is less than 17 or the employee ID is 8, and also include all the document IDs from the documents table where the other details are "n" or the shipping agent code is "UP"?

SELECT document_id FROM Circulation_History WHERE "draft_number" < 17 OR "employee_id" = 8 UNION ALL SELECT document_id FROM Documents WHERE other_details = "n" OR shipping_agent_code = "UP"


Question: What is the smallest document ID from the Documents table where the receipt date is not 2005-09-30 00:10:02, or the other details are not "q", or the shipping agent code is "FE", or the document ID is less than or equal to 25, combined with the smallest document ID from the Documents_Mailed table where the mailing date is not 1982-01-14 05:50:54, the mailed to address ID is not 2, and the document ID is less than or equal to 4?

SELECT MIN(document_id) FROM Documents WHERE receipt_date != "2005-09-30 00:10:02" OR other_details != "q" OR shipping_agent_code = "FE" OR "document_id" <= 25 UNION ALL SELECT MIN(document_id) FROM Documents_Mailed WHERE mailing_date != "1982-01-14 05:50:54" AND "mailed_to_address_id" != 2 AND "document_id" <= 4


Question: Can you give me a list of driver IDs, excluding driver ID 8, that appear in the driver table but not in the school_bus table, where we also exclude driver ID 9 from the school_bus table?

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


Question: Can you tell me the nationality, highest graduation college, and number of people for those who either graduated from Northeastern, are named Tim Naegeli, or are from the United Kingdom and not person ID 5 or age 37, combined with the same information for those who are 37 years old, didn't graduate from Northeastern, or have a person ID less than 1 and are not from the United States and are not named David Butler?

SELECT Nationality, MAX(Graduation_College), COUNT(Name) FROM people WHERE Graduation_College = "Northeastern" OR Name = "Tim Naegeli" OR Nationality = "United Kindom" AND "People_ID" != 5 OR "Age" <> 37 UNION SELECT Nationality, MAX(Graduation_College), COUNT(Name) FROM people WHERE "Age" = 37 OR Graduation_College != "Northeastern" OR "People_ID" < 1 AND Nationality != "United States" AND Name != "David Butler"


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


Question: Can you list the aircraft IDs that are not equal to 2, excluding those aircraft IDs that are also not equal to 1 and 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 <> 1


Question: Can you list all the driver IDs, combining those from the driver table that are greater than 10 with those from the school_bus table that are less than or equal to 10?

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


Question: Which store IDs are less than or equal to 5 in the district store table, excluding those store IDs that are greater than or equal to 5 and associated with product ID 2 in the store product table?

SELECT Store_ID FROM store_district WHERE "Store_ID" <= 5 EXCEPT SELECT Store_ID FROM store_product WHERE "Store_ID" >= 5 AND "Product_ID" = 2


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

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


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

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


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

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


Question: Could you give me a list of Branch IDs, including those from branches that aren't in London and aren't named Saint Amant, but opened in 2009, as well as those from the membership register where the Member ID is 5 or less, the register year isn't 2017, and the Branch ID is 5?

SELECT Branch_ID FROM branch WHERE City != "London" AND Name != "Saint Amant" AND Open_year = "2009" UNION SELECT Branch_ID FROM membership_register_branch WHERE "Member_ID" <= 5 AND Register_Year <> "2017" AND Branch_ID = "5"


Question: Can you give me the airport ID and altitude for flights, grouped by altitude, but only showing results where the pilot isn't Thompson, the company ID is 5 or greater, the city isn't Brussels, or the date isn't August 4, 1966, or the ICAO isn't ENBR, or the country is Spain and the altitude is 3650, or the airport ID is 2 or less and the velocity is less than 240, or the IATA isn't AMS?

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


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

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


Question: Can you give me a list of employee IDs for employees who either don't have the name Lee Mears, or have an employee ID of 6, or are not 28 years old, but excluding those employees whose IDs are not 1 and whose bonus is not 3000?

SELECT Employee_ID FROM employee WHERE Name != "Lee Mears" OR "Employee_ID" = 6 OR "Age" != 28 EXCEPT SELECT Employee_ID FROM evaluation WHERE Employee_ID != "1" AND "Bonus" <> 3000.0


Question: Which regions are listed in the club table both for clubs with a Club_ID greater than 5 or a region that isn't the USA, and for clubs with the name Halmstads BK, a Start_year of 2005 or earlier, a Club_ID that isn't 1, or a region that isn't Korea?

SELECT Region FROM club WHERE "Club_ID" > 5 OR Region <> "USA" INTERSECT SELECT Region FROM club WHERE Club_name = "Halmstads BK" OR "Start_year" <= 2005 OR "Club_ID" != 1 OR Region <> "Korea"


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

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


Question: Which driver IDs are both less than or equal to 3 and present in the driver table, and also less than or equal to 7 and present in the school_bus table?

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


Question: Can you give me a list of driver IDs that are 9 or less, but exclude any driver IDs that are less than 3, considering only drivers and school buses?

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 driver IDs that are greater than 8 from the driver table, combined with the driver IDs that are less than 10 from the school_bus table, removing any duplicates?

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


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

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


Question: Can you give me the IDs of drivers with an ID of 4 or less, excluding those driver IDs that are also less than 9 and appear in the school bus table?

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


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

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


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

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


Question: Which aircraft IDs are not equal to 1 and appear in the aircraft table, and are also not equal to 2 and appear in the airport_aircraft table?

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


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