Question: Can you give me the document IDs that were mailed on a date other than November 3rd, 1971, and have a document ID of 24 or less, and are also draft copies with a copy number of 10 or less and a document ID of 2?

SELECT document_id FROM Documents_Mailed WHERE mailing_date != "1971-11-03 12:32:14" AND "document_id" <= 24 INTERSECT SELECT document_id FROM Draft_Copies WHERE "copy_number" <= 10 AND "document_id" = 2


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

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


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

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: What are the number of beds, bed types, and total maximum occupancy for modern rooms, excluding those that are traditional and either have more than 2 beds, a RoomId that isn't "RND", or a maximum occupancy of 4 or more?

SELECT beds, bedType, SUM(maxOccupancy) FROM Rooms WHERE decor = "modern" EXCEPT SELECT beds, bedType, SUM(maxOccupancy) FROM Rooms WHERE decor = "traditional" AND "beds" > 2 OR RoomId <> "RND" OR "maxOccupancy" >= 4


Question: Could you list all the district IDs from districts located in city areas of 25 or less, along with all the district IDs associated with stores that are not store number 5?

SELECT District_ID FROM district WHERE "City_Area" <= 25.0 UNION ALL SELECT District_ID FROM store_district WHERE "Store_ID" <> 5


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

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


Question: Can you give me a list of document IDs from the circulation history where the document ID is 20 or the employee ID is not equal to any value, combined with a list of document IDs from the documents table where the document status is "working"?

SELECT document_id FROM Circulation_History WHERE "document_id" = 20 OR "employee_id" != 2 UNION SELECT document_id FROM Documents WHERE document_status_code = "working"


Question: Can you show me the lowest title and the number of issues for books where the book ID is at least 1, or the number of issues isn't 12, or the writer isn't Christopher Hinz and the title isn't Bloody Mary, combined with the lowest title and number of issues for books where the writer isn't Garth Ennis and the book ID is at least 8?

SELECT MIN(Title), Issues FROM book WHERE "Book_ID" >= 1 OR "Issues" <> 12.0 OR Writer <> "Christopher Hinz" AND Title <> "Bloody Mary" UNION SELECT MIN(Title), Issues FROM book WHERE Writer != "Garth Ennis" AND "Book_ID" >= 8


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 7 or higher?

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


Question: Can you give me the IDs of aircraft that are less than 5, excluding those that are also less than or equal to 2 and associated with an airport?

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


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

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


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

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


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


Question: Can you give me a list of aircraft IDs that are either equal to 5 in the aircraft table or greater than 1 in the airport_aircraft table?

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


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

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


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


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

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


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

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


Question: 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: What aircraft IDs appear exactly once in the aircraft table with an ID of 2, but do not appear in the airport_aircraft table with an ID greater than 2?

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


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

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


Question: Can you list the maker, full name, country, and ID of car makers where the ID is 7 or higher, or the full name is not "Ford Motor Company" and the maker is not "hyundai", or the country is "4", combined with a list of car makers where the full name is "American Motor Company" or the ID is less than 12?

SELECT Maker, FullName, Country, Id FROM car_makers WHERE "Id" >= 7 OR FullName != "Ford Motor Company" AND Maker <> "hyundai" OR Country = "4" UNION SELECT Maker, FullName, Country, Id FROM car_makers WHERE FullName = "American Motor Company" OR "Id" < 12


Question: What is the difference between the number of coaches and their average name length who have a rank of 3 or less and are not named Jameson Tomas, and the number of coaches and their average name length who are not named James Wong or belong to club ID 1?

SELECT COUNT(Coach_ID), AVG(Coach_name) FROM coach WHERE "Rank" <= 3 AND Coach_name <> "Jameson Tomas" EXCEPT SELECT COUNT(Coach_ID), AVG(Coach_name) FROM coach WHERE Coach_name != "James Wong" OR "Club_ID" = 1


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 exactly 10 from the school_bus table?

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


Question: Can you give me a list of driver IDs less than 6 that appear in the driver table, excluding any driver IDs less than 9 that 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 < 9


Question: Can you give me the ID, name, type, principal activities, and group equity shareholding of companies, excluding those that are airlines, have an ID of 14 or greater, or are subsidiaries, but including companies with an ID of 2, those whose principal activities are not airline-related, those named "Cathay Pacific Catering Services (HK) Limited" and not incorporated in Canada, those with group equity shareholding less than 100, or those that are not subsidiaries?

SELECT id, name, Type, Principal_activities, Group_Equity_Shareholding FROM operate_company WHERE "id" = 2 OR Principal_activities != "Airline" OR name = "Cathay Pacific Catering Services (HK) Limited" AND Incorporated_in <> "Canada" OR "Group_Equity_Shareholding" < 100.0 OR Type != "Subsidiary" EXCEPT SELECT id, name, Type, Principal_activities, Group_Equity_Shareholding FROM operate_company WHERE Principal_activities = "Airline" OR "id" >= 14 OR Type = "Subsidiary"


Question: Could you give me the student IDs that are both from the Has_Pet table where the student ID is less than 1002 or the pet ID is less than or equal to 2001, and also from the Student table where the last name is Smith, or the city code isn't PHL, or the major is less than or equal to 520, or the age is greater than 18 and the advisor is 1148?

SELECT StuID FROM Has_Pet WHERE "StuID" < 1002 OR "PetID" <= 2001 INTERSECT SELECT StuID FROM Student WHERE LName = "Smith" OR city_code != "PHL" OR "Major" <= 520 OR "Age" > 18 AND "Advisor" = 1148


Question: Can you list the aircraft IDs and distances for Airbus A340-300 planes, excluding aircraft ID 6, that have a distance of at least 8430, combined with the aircraft IDs and distances for flights, excluding flight ID 5, that either don't go to Washington D.C. and didn't arrive on 04/12/2005 at 11:15, or have a price that is not 220.98?

SELECT aid, distance FROM aircraft WHERE name = "Airbus A340-300" AND "aid" != 6 AND "distance" >= 8430 UNION ALL SELECT aid, distance FROM flight WHERE "aid" != 5 AND destination <> "Washington D.C." AND arrival_date <> "04/12/2005 11:15" OR "price" <> 220.98


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


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

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


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

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


Question: What driver IDs are greater than 1 and also appear in the school bus records with a driver ID of 10?

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


Question: Which aircraft IDs are less than 3 and appear in the aircraft table, and are also less than 2 and appear in the airport_aircraft table?

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


Question: Can you give me a list of driver IDs that are 12 or greater, 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: How many people from Bulgaria, with some exceptions based on their final table appearances, best finish, money rank, birth date, maximum poker player ID, and total height, are linked to each poker player ID?

SELECT COUNT(T1.People_ID), T2.Poker_Player_ID FROM people as T1 JOIN poker_player as T2 ON T1.People_ID = T2.People_ID WHERE Nationality = "Bulgaria" AND Final_Table_Made <> 26.0 AND Best_Finish = 1.0 OR Money_Rank <> 68.0 OR Birth_Date <> "April 17, 1987" AND MAX(Poker_Player_ID) = 1 AND SUM(Height) < 196.0


Question: Can you give me a list of document IDs from the drafts table where the ID is greater than 2 and the draft number is less than 19, or where the draft details are not "l", combined with a list of document IDs from the documents table where the other details are "q", the ID is greater than or equal to 7, the document type code is not "Hard Drive", or the document status code is "done"?

SELECT document_id FROM Document_Drafts WHERE "document_id" > 2 AND "draft_number" < 19 OR draft_details != "l" UNION ALL SELECT document_id FROM Documents WHERE other_details = "q" OR "document_id" >= 7 OR document_type_code != "Hard Drive" OR document_status_code = "done"


Question: Can you give me a list of driver IDs that are both less than or equal to 4 and not equal to 9, considering only the driver IDs that appear in both the driver and school_bus tables?

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


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

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


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

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


Question: Can you find the smallest employee ID for employees who are either 36 years old or not from Bristol and named Tim Payne, and also find the smallest employee ID from the hiring table for shop IDs greater than 5 or start dates not equal to 2012, and then combine those two results?

SELECT MIN(Employee_ID) FROM employee WHERE "Age" = 36 OR City <> "Bristol" AND Name = "Tim Payne" UNION ALL SELECT MIN(Employee_ID) FROM hiring WHERE "Shop_ID" > 5 OR Start_from != "2012"


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

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


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

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 customer IDs from the payment records where the payment amount was $4773.16 and the customer ID is not 10, combined with a list of customer IDs from the customer records where either their birthdate isn't September 18, 1998, at 4:45 AM, their customer status isn't "Bad Customer", their last name is "Trantow" and their customer address ID is less than 1 and their email is mayert.judy@example.com, their customer ID is greater than or equal to 2, their phone number isn't 417.136.2900x672 and they became a customer on March 18, 2016, at 6:14 AM, or their first name isn't Dianna?

SELECT customer_id FROM Customer_Payments WHERE "amount_payment" = 4773.16 AND "customer_id" <> 10 UNION SELECT customer_id FROM Customers WHERE date_of_birth != "1998-09-18 04:45:01" OR customer_status_code != "Bad Customer" OR last_name = "Trantow" AND "customer_address_id" < 1 AND email_address = "mayert.judy@example.com" OR "customer_id" >= 2 OR phone_number != "417.136.2900x672" AND date_became_customer = "2016-03-18 06:14:18" OR first_name != "Dianna"


Question: Can you give me the creation date, contestant number, state, phone number, and vote ID for all votes, excluding those created on "2018-03-09 19:03:21" with a phone number greater than 5112677315, but including votes where the creation date is not "2018-03-09 19:03:36", the contestant number is 3 or greater, the vote ID is 3 or less, the state is NY, or the phone number is 6209222712 or greater?

SELECT created, contestant_number, state, phone_number, vote_id FROM VOTES WHERE created <> "2018-03-09 19:03:36" AND "contestant_number" >= 3 OR "vote_id" <= 3 OR state = "NY" OR "phone_number" >= 6209222712 EXCEPT SELECT created, contestant_number, state, phone_number, vote_id FROM VOTES WHERE created = "2018-03-09 19:03:21" AND "phone_number" > 5112677315


Question: Could you list the cities that appear in both of these sets: first, the cities of branches that are not named "Brooke Greville" and either didn't open in 2015 or don't have a membership amount of 1418; and second, the cities of branches that either have a Branch ID of 1, a membership amount of 1418, are named "Alexandre", or didn't open in 2014?

SELECT City FROM branch WHERE Name != "Brooke Greville" AND Open_year != "2015" OR membership_amount <> "1418" INTERSECT SELECT City FROM branch WHERE "Branch_ID" = 1 OR membership_amount = "1418" OR Name = "Alexandre" OR Open_year <> "2014"


Question: Can you list the description and the smallest aircraft ID for each type of aircraft, but only if the smallest aircraft ID is 4 or greater, considering only aircraft where the total disk area is not "4,900 ft² (460 m²)", or the maximum gross weight is "123,500 lb (56,000 kg)", or the description is "Turboshaft utility helicopter", or the maximum disk loading is not "8.8 lb/ft² (43 kg/m²)", and also list the description and the smallest aircraft ID for each type of aircraft where the total disk area is not "4,900 ft² (460 m²)", but only if the smallest aircraft ID is not 1?

SELECT MIN(Aircraft_ID), Description FROM aircraft WHERE Total_disk_area != "4,900 ft² (460 m²)" OR Max_Gross_Weight = "123,500 lb (56,000 kg)" OR Description = "Turboshaft utility helicopter" OR Max_disk_Loading != "8.8 lb/ft² (43 kg/m²)" GROUP BY Description HAVING MIN(Aircraft_ID) >= 4 UNION SELECT MIN(Aircraft_ID), Description FROM aircraft WHERE Total_disk_area <> "4,900 ft² (460 m²)" GROUP BY Description HAVING MIN(Aircraft_ID) <> 1


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

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


Question: Can you give me the IDs of drivers with an ID of 8 or less, excluding the IDs of school bus drivers with an ID of 3 or more?

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 greater than 10, excluding those driver IDs that are less than 4 and are also present 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: Could you give me the total number of drivers and the school ID for drivers who either live in Hartford, are named Edwin Vargas, have a school ID less than 5 and are not full-time, are younger than 42, or have worked for a number of years other than 6?

SELECT SUM(T1.Driver_ID), T2.School_ID FROM driver as T1 JOIN school_bus as T2 ON T1.Driver_ID = T2.Driver_ID WHERE Home_city = "Hartford" OR Name = "Edwin Vargas" OR "School_ID" < 5 AND If_full_time <> "T" OR "Age" < 42 OR "Years_Working" <> 6


Question: Could you give me the number of products and shop IDs for shops that meet these two sets of criteria: first, they're not in Helsinki, or their shop ID is greater than 7, or they're in the Lahden Stadion district, and their number of products isn't 15000, their name isn't FC Honka, and their manager isn't Tommi Kautonen; second, their number of products is less than 10000, their name isn't FC Inter, and they're in Valkeakoski, or their district isn't Magnum Areena, or their manager isn't Antti Muurinen?

SELECT Number_products, Shop_ID FROM shop WHERE Location != "Helsinki" OR "Shop_ID" > 7 OR District = "Lahden Stadion" OR "Number_products" != 15000 AND Name <> "FC Honka" AND Manager_name != "Tommi Kautonen" INTERSECT SELECT Number_products, Shop_ID FROM shop WHERE "Number_products" < 10000 AND Name <> "FC Inter" AND Location = "Valkeakoski" OR District <> "Magnum Areena" OR Manager_name <> "Antti Muurinen"


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


Question: Can you give me a list of aircraft IDs that are less than 4, but exclude any aircraft IDs that also appear in the airport aircraft list, unless that ID is 3?

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


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


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

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


Question: Can you give me a list of driver IDs, excluding driver ID 1, and combine it with a list of school bus driver IDs, excluding driver ID 4?

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


Question: Can you give me the number of templates, their effective dates, template types, and average template details, first for templates with version number 2 and an effective end date not equal to "1992-05-02 20:06:11", and then again for templates that are of type "PP" and not template ID 11, or have an effective end date not equal to "1994-12-07 13:26:23", or have a version number not equal to 5, an effective start date of "2002-08-25 13:26:23", and empty template details?

SELECT COUNT(Template_ID), Date_Effective_From, Template_Type_Code, AVG(Template_Details) FROM Templates WHERE "Version_Number" = 2 AND Date_Effective_To <> "1992-05-02 20:06:11" UNION SELECT COUNT(Template_ID), Date_Effective_From, Template_Type_Code, AVG(Template_Details) FROM Templates WHERE Template_Type_Code = "PP" AND "Template_ID" != 11 OR Date_Effective_To <> "1994-12-07 13:26:23" OR "Version_Number" != 5 AND Date_Effective_From = "2002-08-25 13:26:23" AND Template_Details = ""


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

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: Could you list the parties from the election table, excluding those where the delegate is Gail H. Bates or the first elected year is not before 2003, and then remove any parties that have a Party ID of 4 or less?

SELECT Party FROM election WHERE Delegate <> "Bates, Gail H. Gail H. Bates" OR "First_Elected" <= 2003.0 EXCEPT SELECT Party FROM party WHERE "Party_ID" <= 4


Question: Which driver IDs appear in the driver table, excluding ID 11, and also appear as driver IDs in the school bus table, but only including ID 7 from that table?

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


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

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


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

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


Question: Can you give me a list of aircraft IDs, excluding aircraft ID 1, that are not also aircraft IDs from a separate list where aircraft ID 5 is excluded?

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

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


Question: Which aircraft have an ID of 5 and are also associated with airports that don't have an aircraft ID of 2?

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


Question: Which driver IDs, excluding 7, appear in both the driver list and the school bus list, where only driver IDs greater than 4 are considered in the school bus list?

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: Which driver IDs, excluding driver ID 12, are present in the driver table but not in the school_bus table, also excluding driver ID 9 from the school_bus table?

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


Question: Can you tell me the earliest payment time, payment amount, payment method, and average customer ID for all payments, first excluding payments made at "2018-02-24 10:07:05", and then separately for payments where the amount is less than or equal to 8180.26?

SELECT MIN(datetime_payment), amount_payment, payment_method_code, AVG(customer_id) FROM Customer_Payments WHERE datetime_payment != "2018-02-24 10:07:05" UNION ALL SELECT MIN(datetime_payment), amount_payment, payment_method_code, AVG(customer_id) FROM Customer_Payments WHERE "amount_payment" <= 8180.26


Question: What is the smallest bed type for rooms with a base price of at least 175, and also the smallest bed type for rooms that either have fewer than 2 beds, or a room name that isn't "Harbinger but bequest" along with a decor that isn't "traditional" and a RoomId of "AOB" and a base price of 175, or a bed type that is "Double"?

SELECT MIN(bedType) FROM Rooms WHERE "basePrice" >= 175 UNION ALL SELECT MIN(bedType) FROM Rooms WHERE "beds" < 2 OR roomName <> "Harbinger but bequest" AND decor <> "traditional" AND RoomId = "AOB" AND "basePrice" = 175 OR bedType = "Double"


Question: Which driver IDs, that are 9 or less, are also driver IDs of school buses, specifically driver ID 9?

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


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

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


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


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

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


Question: Can you give me the Big Silver, Gold, Club ID, Bronze, Rank, and Small Silver values from the match results that satisfy both of these conditions: first, the Rank is not 1, or the Small Silver is 16, or the Gold is not 20, or the Big Silver is less than or equal to 12, or the Points are 139; and second, the Small Silver is not 10 and the Club ID is greater than 4, or the Big Silver is greater than 11 and the Gold is 13?

SELECT Big_Silver, Gold, Club_ID, Bronze, Rank, Small_Silver FROM match_result WHERE "Rank" != 1 OR "Small_Silver" = 16 OR "Gold" <> 20 OR "Big_Silver" <= 12 OR "Points" = 139 INTERSECT SELECT Big_Silver, Gold, Club_ID, Bronze, Rank, Small_Silver FROM match_result WHERE "Small_Silver" != 10 AND "Club_ID" > 4 OR "Big_Silver" > 11 AND "Gold" = 13


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

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


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


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

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


Question: Can you give me the IDs of aircraft with IDs less than or equal to 3, excluding those aircraft IDs that are not equal to 3 and are also present in the airport aircraft list?

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


Question: Which continents, excluding Africa, have a ContId of 1 or greater?

SELECT Continent FROM continents WHERE Continent <> "africa" INTERSECT SELECT Continent FROM continents WHERE "ContId" >= 1


Question: Can you list the names and numbers of all contestants, excluding those with number 6, and then remove from that list anyone with a number greater than 1 or named "Loraine NygrenTania Mattioli"?

SELECT contestant_name, contestant_number FROM CONTESTANTS WHERE "contestant_number" <> 6 EXCEPT SELECT contestant_name, contestant_number FROM CONTESTANTS WHERE "contestant_number" > 1 OR contestant_name = "Loraine NygrenTania Mattioli"


Question: What is the difference between the total driver ID of drivers who are either younger than 42 or live in Hartford and are not named Matthew Ritter and don't have a driver ID of 11, and the total driver ID of school bus drivers who have worked for more than 2 years, or don't have a driver ID of 9, or don't have a school ID of 7?

SELECT SUM(Driver_ID) FROM driver WHERE "Age" < 42 OR Home_city = "Hartford" AND Name <> "Matthew Ritter" AND "Driver_ID" <> 11 EXCEPT SELECT SUM(Driver_ID) FROM school_bus WHERE "Years_Working" > 2 OR "Driver_ID" <> 9 OR "School_ID" <> 7


Question: Can you give me the total ID and company ID from the airportflight database, grouped by altitude, considering only flights with a velocity of at least 240, and excluding groups where the pilot is Thompson, the company ID is less than 5, the city is Brussels, the date is August 4, 1966, the ICAO is ENBR, the country is not Spain, the altitude is not 3650, the airport ID is greater than 2, the velocity is not less than 240, and the IATA is AMS?

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


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

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


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

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


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

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


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

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


Question: Can you give me the total number of people of each nationality, their birth dates, and the first name alphabetically, excluding those with People ID 2 and those born on May 26, 1986, and those from Russia, but including Yevgeni Sivozhelez and anyone shorter than or equal to 205 cm, then remove from that list the total number of people of each nationality, their birth dates, and the first name alphabetically, where the people are not from Russia, are named Semen Poltavskiy, are shorter than 194 cm, and have a People ID greater than 2?

SELECT SUM(Nationality), Birth_Date, MIN(Name) FROM people WHERE "People_ID" != 2 AND Birth_Date <> "May 26, 1986" AND Nationality != "Russia" OR Name = "Yevgeni Sivozhelez" OR "Height" <= 205.0 EXCEPT SELECT SUM(Nationality), Birth_Date, MIN(Name) FROM people WHERE Nationality != "Russia" AND Name = "Semen Poltavskiy" AND "Height" < 194.0 AND "People_ID" > 2


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

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


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

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


Question: Can you give me a list of driver IDs, excluding driver ID 12, that are not also driver IDs less than or equal to 10 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 ICAO codes and IDs of airports that are either in Baltimore, have an ID of 6 or higher, are in the United States and named "El Prat Airport", or have an ICAO code that isn't "PANC", but exclude those with an ICAO code of "EBBR"?

SELECT ICAO, id FROM airport WHERE City = "Baltimore" OR "id" >= 6 OR Country = "United States" AND name = "El Prat Airport" OR ICAO <> "PANC" EXCEPT SELECT ICAO, id FROM airport WHERE ICAO = "EBBR"


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

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


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

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


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

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


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

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


Question: Can you give me the average profits, assets, sales, and company ID for companies with a market value of 202.2 billion, or those in the oil and gas industry, or those named HSBC with profits of 41.1 billion and sales over 102.6 billion, but exclude any results for companies named JPMorgan Chase that don't have profits of 14.4 billion?

SELECT AVG(Profits_in_Billion), Assets_in_Billion, Sales_in_Billion, Company_ID FROM company WHERE "Market_Value_in_Billion" = 202.2 OR Industry = "Oil and gas" OR Name = "HSBC" AND "Profits_in_Billion" = 41.1 AND "Sales_in_Billion" > 102.6 EXCEPT SELECT AVG(Profits_in_Billion), Assets_in_Billion, Sales_in_Billion, Company_ID FROM company WHERE "Profits_in_Billion" <> 14.4 AND Name = "JPMorgan Chase"


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

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


Question: Could you give me a list of club IDs for clubs that either started after 2011 and have an ID less than 5, or are not named "AIK" and are located in the UK, excluding any club IDs that belong to coaches with a rank less than 2 or who are not male?

SELECT Club_ID FROM club WHERE "Start_year" > 2011 AND "Club_ID" < 5 OR Club_name != "AIK" AND Region = "UK" EXCEPT SELECT Club_ID FROM coach WHERE "Rank" < 2 OR Gender <> "M"


Question: Can you show me the grade, school name, average location, type, and school ID for all schools that are not private or not named St. Francis Assisi, or are located in Honolulu, Hawaii, but exclude any schools located in Los Angeles, California, or any schools with grades 5th through 12th that are not Columbia University?

Grade School AVG(Location) Type School_ID

SELECT Grade, School, AVG(Location), Type, School_ID FROM school WHERE Type <> "Private" AND School != "St. Francis Assisi" OR Location = "Honolulu, Hawaii" EXCEPT SELECT Grade, School, AVG(Location), Type, School_ID FROM school WHERE Location = "Los Angeles, California" OR Grade = "5th-12th grade" AND School <> "Columbia University"


Question: Which driver IDs appear only once as driver IDs equal to 4 in the driver table, but not as driver IDs equal to 3 in the school_bus table?

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


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

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


Question: Can you list the aircraft IDs, combining those from the aircraft table that are greater than or equal to 2 with 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 aircraft IDs that are greater than 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, including those from the driver table where the ID is not 1, and those from the school bus table where the ID is greater than 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 aircraft IDs that are less than 5 and appear in both the aircraft and airport_aircraft tables, considering only the aircraft IDs less than or equal to 5 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 <= 5


Question: Can you give me a list of driver IDs, combining those from the driver table that are not equal to 2 with those from the school_bus table that are greater than 7, making sure to only list each ID once?

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 aircraft IDs, including aircraft ID 1 from the aircraft table, and any aircraft IDs greater than or equal to 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: What is the earliest contestant name and the number of contestants, excluding contestant number 8, and also, separately, what is the earliest contestant name and the number of contestants named Jessie Eichman, excluding contestant number 11?

SELECT MIN(contestant_name), COUNT(contestant_number) FROM CONTESTANTS WHERE "contestant_number" <> 8 UNION ALL SELECT MIN(contestant_name), COUNT(contestant_number) FROM CONTESTANTS WHERE contestant_name = "Jessie Eichman" AND "contestant_number" != 11


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


Question: Can you give me the IDs of players who are not named Jim Maloway and who also appear in the player-coach table with either a Player ID greater than 1, a starting year after 2012, or a Coach ID of 5 or higher?

SELECT Player_ID FROM player WHERE Player_name <> "Jim Maloway" INTERSECT SELECT Player_ID FROM player_coach WHERE "Player_ID" > 1 OR "Starting_year" > 2012 OR "Coach_ID" >= 5


Question: What continents, excluding Asia and those with a ContId of 4 or less, are not listed as countries with a CountryId other than 12?

SELECT Continent FROM continents WHERE Continent <> "asia" AND "ContId" > 4 EXCEPT SELECT Continent FROM countries WHERE "CountryId" <> 12


Question: Can you list the driver IDs that are less than 12, and also list the driver IDs from the school bus table that are 7 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 >= 7


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

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


Question: Can you give me the IDs of airports that are either in Iceland, or have an ICAO code that isn't LEBL and a name that isn't El Prat Airport, or have an ID of 9 and an IATA code that isn't BRU, or are not in Boston, excluding any IDs that are also associated with the operate company Air China?

SELECT id FROM airport WHERE Country = "Iceland" OR ICAO != "LEBL" AND name != "El Prat Airport" OR "id" = 9 AND IATA != "BRU" OR City <> "Boston" EXCEPT SELECT id FROM operate_company WHERE name = "Air China"


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

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


Question: How many template type descriptions are there for the template type code "AD" or for descriptions that are not "Advertisement", and how many template type descriptions are there for the template type code "PPT"?

SELECT Template_Type_Code, COUNT(Template_Type_Description) FROM Ref_Template_Types WHERE Template_Type_Code = "AD" OR Template_Type_Description <> "Advertisement" UNION ALL SELECT Template_Type_Code, COUNT(Template_Type_Description) FROM Ref_Template_Types WHERE Template_Type_Code = "PPT"


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

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


Question: Can you give me the school name, location, grade, and school ID for schools in Jakarta, Indonesia that are not Noelani Elementary School and either not private or not kindergarten, along with the school name, location, grade, and school ID for schools not in Jakarta, Indonesia that are not St. Francis Assisi and not public?

Columbia University
New York City
Junior–Senior year
6

Harvard Law School
Cambridge, Massachusetts
College
7

Noelani Elementary School
Honolulu, Hawaii
Kindergarten
1

Occidental College
Los Angeles, California
Freshman–Sophomore year
5

Punahou School
Honolulu, Hawaii
5th-12th grade
4

St. Francis Assisi
Jakarta, Indonesia
1st-3rd grade
2

State Elementary School Menteng 01
Jakarta, Indonesia
4th grade
3

SELECT School, Location, Grade, School_ID FROM school WHERE Type != "Private" OR Grade <> "Kindergarten" AND School != "Noelani Elementary School" AND Location = "Jakarta, Indonesia" UNION SELECT School, Location, Grade, School_ID FROM school WHERE Location <> "Jakarta, Indonesia" AND School != "St. Francis Assisi" AND Type != "Public"


Question: Can you give me a list of driver IDs from the driver table where each ID is less than or equal to 6, combined with a list of driver IDs from the school_bus table where each ID is not equal to 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 car models, excluding those made by Honda where the maker ID is 19, but including any model where the Model ID is greater than 12, or the model isn't a Buick, or the maker ID is less than 5?

SELECT Model FROM model_list WHERE "ModelId" > 12 OR Model != "buick" OR "Maker" < 5 EXCEPT SELECT Model FROM model_list WHERE "Maker" = 19 AND Model <> "honda"


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

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


Question: Which store IDs are found both among stores with an ID less than 3 or in district 15, and among stores in a district greater than 11 or with an ID less than 1?

SELECT Store_ID FROM store_district WHERE "Store_ID" < 3 OR "District_ID" = 15 INTERSECT SELECT Store_ID FROM store_district WHERE "District_ID" > 11 OR "Store_ID" < 1


Question: Can you give me a list of aircraft IDs that are not 3, and are also greater than or equal to 1?

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


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 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, excluding those driver IDs that are less than 4 and are also 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 < 4


Question: Which driver IDs are not equal to 1 and appear in the driver table, and are also not equal to 4 and appear 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 != 4


Question: Can you give me a list of Club IDs, positions, and student IDs for all club members who are not CTOs, excluding those who are presidents of club number 1?

SELECT ClubID, Position, StuID FROM Member_of_club WHERE Position != "CTO" EXCEPT SELECT ClubID, Position, StuID FROM Member_of_club WHERE "ClubID" = 1 AND Position = "President"


Question: Can you give me the driver ID that appears exactly once with the value 12 in the driver table, but only if that same driver ID doesn't appear in the school bus table with a value of 10 or greater?

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


Question: Can you give me the IDs of drivers that are less than 5, excluding those that are also bus drivers with an ID of 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 give me a list of driver IDs that are less than 7 and also appear in the list of school bus driver IDs, excluding driver ID 7?

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


Question: Can you give me a list of all Driver IDs from the driver table, excluding Driver ID 10, combined with a list of 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 all the endowment amounts where either the endowment ID is not 8 and the donator's name is Santiago, or the school ID is not 3, or the amount is 8.85, combined with all the endowment amounts where the school ID is less than or equal to 3, or the endowment ID is not 3?

SELECT amount FROM endowment WHERE "endowment_id" <> 8 AND donator_name = "Santiago" OR "School_id" <> 3 OR "amount" = 8.85 UNION SELECT amount FROM endowment WHERE "School_id" <= 3 OR "endowment_id" <> 3


Question: Can you give me the IDs from the airport table where the IATA code isn't ANC, the city isn't Boston, and the country isn't Belgium, or where the name is Ted Stevens Airport and the ICAO code isn't BIAR, or where the ID is greater than or equal to 1, combined with the IDs from the operate_company table where the ID is less than 11?

SELECT id FROM airport WHERE IATA != "ANC" AND City != "Boston" AND Country != "Belgium" OR name = "Ted Stevens Airport" AND ICAO != "BIAR" OR "id" >= 1 UNION SELECT id FROM operate_company WHERE "id" < 11


Question: Can you list the ranking and store name for all stores that are not a City Mall or don't have an area size of 21.73, combined with the ranking and store name for stores that either have an area size of 26.69 or greater and fewer than 17811 product categories, or have a store ID greater than 2, are not a City Mall, have a ranking less than 10, and are not named Neguac?

SELECT Ranking, Store_Name FROM store WHERE Type <> "City Mall" OR "Area_size" != 21.73 UNION ALL SELECT Ranking, Store_Name FROM store WHERE "Area_size" >= 26.69 AND "Number_of_product_category" < 17811.0 OR "Store_ID" > 2 OR Type <> "City Mall" AND "Ranking" < 10 AND Store_Name != "Neguac"


Question: Can you list the driver IDs that are less than 3 from the driver table, and also list the driver IDs that are greater than 7 from the school bus table, combining both lists?

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 a list of driver IDs, excluding driver ID 9, that are not also driver IDs of school buses where the school bus driver ID is 3 or greater?

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


Question: Can you give me a list of driver IDs, excluding driver ID 10, that are not also driver IDs, excluding driver ID 3, 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 give me a list of driver IDs that are 11 or greater, excluding any driver IDs that are 7 or less and are also in the school bus list?

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


Question: Can you give me a list of driver IDs that are both greater than or equal to 6 and not equal to 9, considering only the driver IDs that appear in both the driver and school_bus tables?

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


Question: Can you give me a list of album IDs where the ID is 121 and the title isn't "Powerslave", or the artist ID isn't 223, combined with a list of media type IDs that are greater than 1 and the name isn't "Purchased AAC audio file"?

SELECT id FROM albums WHERE "id" = 121 AND title != "Powerslave" OR "artist_id" != 223 UNION ALL SELECT id FROM media_types WHERE "id" > 1 AND name <> "Purchased AAC audio file"


Question: Can you give me the Club ID and Start Year for all clubs, including those with a Club ID of 1 or less, those located in Korea, those named "Halmstads BK" that started after 2011, and also including all clubs that didn't start in 2011?

SELECT Club_ID, Start_year FROM club WHERE "Club_ID" <= 1 OR Region = "Korea" OR "Start_year" > 2011 AND Club_name = "Halmstads BK" UNION ALL SELECT Club_ID, Start_year FROM club WHERE "Start_year" <> 2011


Question: Can you give me a list of contestant numbers, including those from contestants who are not named Jessie Alloway and are not contestant number 7, as well as those from votes that were not created on March 9, 2018 at 7:03:40 PM, or have a contestant number less than 3, or have a vote ID of 2 or less?

SELECT contestant_number FROM CONTESTANTS WHERE contestant_name != "Jessie Alloway" AND "contestant_number" != 7 UNION SELECT contestant_number FROM VOTES WHERE created <> "2018-03-09 19:03:40" OR "contestant_number" < 3 OR "vote_id" <= 2


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


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


Question: Can you list the aircraft IDs that are greater than or equal to 3, excluding those aircraft IDs that are less than 5 and are present 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: Which driver IDs are both equal to 10 and less than or equal to 10 in the driver and school bus records?

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


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

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


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

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


Question: Can you give me the IDs of drivers, up to ID 2, that are not also the IDs of school bus drivers up to ID 4?

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


Question: Can you give me a list of driver IDs that are less than 6, and also a list of driver IDs 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 aircraft IDs that appear in the aircraft table, excluding aircraft ID 2, and also excluding any aircraft IDs that appear in the airport_aircraft table with an ID of 1 or less?

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


Question: What is the total student ID for club members who are not presidents or whose student ID is 1007 or higher, combined with the total student ID for students who don't have a major of 600 and whose first name isn't Paul, or whose advisor number is 1148 or less and are not male, or who don't live in PIT?

SELECT SUM(StuID) FROM Member_of_club WHERE Position != "President" OR "StuID" >= 1007 UNION ALL SELECT SUM(StuID) FROM Student WHERE "Major" != 600 AND Fname != "Paul" OR "Advisor" <= 1148 AND Sex != "M" OR city_code != "PIT"


Question: Can you list all the aircraft IDs, excluding aircraft ID 3, and combine that with a list of all aircraft IDs from the airport aircraft table, excluding aircraft ID 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 the driver IDs that are less than 5 and also less than 9, considering only the driver IDs that appear in both the driver and school bus tables?

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


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

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 less than 11, excluding the driver ID 9, considering only unique driver IDs from the driver and school_bus tables?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 11 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 1, that are not also driver IDs less than or equal to 10 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 <= 10


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

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


Question: What are the highest address details and their corresponding address IDs for addresses with an ID of 9 or greater, excluding those where the address details are "MX"?

SELECT MAX(address_details), address_id FROM Addresses WHERE "address_id" >= 9 EXCEPT SELECT MAX(address_details), address_id FROM Addresses WHERE address_details != "MX"


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

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


Question: Can you give me a list of driver IDs that are 12 or greater from the driver table, excluding any driver IDs that appear in the school bus table where the driver ID is not 7?

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


Question: Could you give me a list of customer IDs from the payments table, excluding those customer IDs that are also in the customer table where the customer's birth date isn't August 30, 1996, their last name is Koelpin, their customer status isn't "Bad Customer", their first name isn't Estelle, their phone number isn't (662)490-3108, their outstanding amount isn't 9443.0, and their mobile phone number is +45(6)4872981083, or their customer ID is 5, or their email address isn't wehner.harold@example.com, and where the payment time isn't March 12, 2018 at 13:31:36, or the customer ID isn't 7, or the payment method isn't Direct Debit, or the payment amount is greater than 6782.84?

SELECT customer_id FROM Customer_Payments WHERE datetime_payment != "2018-03-12 13:31:36" OR "customer_id" != 7 OR payment_method_code != "Direct Debit" OR "amount_payment" > 6782.84 EXCEPT SELECT customer_id FROM Customers WHERE date_of_birth <> "1996-08-30 06:17:50" AND last_name = "Koelpin" AND customer_status_code != "Bad Customer" AND first_name <> "Estelle" AND phone_number != "(662)490-3108" AND "amount_outstanding" <> 9443.0 AND cell_mobile_phone_number = "+45(6)4872981083" OR "customer_id" = 5 OR email_address <> "wehner.harold@example.com"


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


Question: What aircraft IDs are both less than or equal to 1 when grouped in the aircraft table and less than or equal to 2 when grouped in the airport_aircraft table?

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


Question: What car models are both not made by "fiat x1.9" and are not "plymouth", and also are either not made by maker ID 19 or are not "bmw"?

SELECT Model FROM car_names WHERE Make != "fiat x1.9" AND Model <> "plymouth" INTERSECT SELECT Model FROM model_list WHERE "Maker" <> 19 OR Model != "bmw"


Question: Can you list the Party ID, Party name, Comptroller, Lieutenant Governor, and US Senate representative for all parties where either the Party ID is greater than 2 and the Party is not Democratic and the year is not 2006, or the Governor is Tom Golisano, or the Comptroller is not Alan Hevesi and the Attorney General is Eliot Spitzer; combined with the Party ID, Party name, Comptroller, Lieutenant Governor, and US Senate representative for all parties where either the Lieutenant Governor is not David Paterson, or the US Senator is Hillary Rodham Clinton and the Attorney General is not Eliot Spitzer, or the Governor is not Eliot Spitzer, or the Comptroller is Alan Hevesi and the Party is Independence and the Party ID is not 3?

1
Democratic
Carl McCall
Sandra Frankel
Charles Schumer

2
Liberal
Carl McCall
Jonathan Reiter
Charles Schumer

3
Democratic
Alan Hevesi
Dennis Mehiel
(no election)

4
Independence
John Faso
Mary Donohue
(no election)

5
Democratic
Alan Hevesi
David Paterson
Hillary Rodham Clinton

6
Independence
Alan Hevesi
David Paterson
Hillary Rodham Clinton

7
Working Families
Alan Hevesi
David Paterson
Hillary Rodham Clinton

SELECT Party_ID, Party, Comptroller, Lieutenant_Governor, US_Senate FROM party WHERE "Party_ID" > 2 AND Party <> "Democratic" AND "Year" != 2006.0 OR Governor = "Tom Golisano" OR Comptroller <> "Alan Hevesi" AND Attorney_General = "Eliot Spitzer" UNION SELECT Party_ID, Party, Comptroller, Lieutenant_Governor, US_Senate FROM party WHERE Lieutenant_Governor != "David Paterson" OR US_Senate = "Hillary Rodham Clinton" AND Attorney_General <> "Eliot Spitzer" OR Governor <> "Eliot Spitzer" OR Comptroller = "Alan Hevesi" AND Party = "Independence" AND "Party_ID" <> 3


Question: Can you give me the vehicle details that are "Truck" or have a vehicle ID of 2 or greater, but only if they also have a vehicle ID greater than 2?

SELECT vehicle_details FROM Vehicles WHERE vehicle_details = "Truck" OR "vehicle_id" >= 2 INTERSECT SELECT vehicle_details FROM Vehicles WHERE "vehicle_id" > 2


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

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


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

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


Question: Can you give me the department and head IDs for temporary acting managers with a head ID greater than 5, excluding those with a head ID of 4 who are not temporary acting?

SELECT department_ID, head_ID FROM management WHERE temporary_acting = "Yes" AND "head_ID" > 5 EXCEPT SELECT department_ID, head_ID FROM management WHERE temporary_acting <> "No" AND "head_ID" = 4


Question: What are the average pet type, total pet ID, and average weight for pets with IDs up to 2002, combined with the average pet type, total pet ID, and average weight for pets that aren't dogs and weigh less than 9.3?

SELECT AVG(PetType), SUM(PetID), AVG(weight) FROM Pets WHERE "PetID" <= 2002 UNION ALL SELECT AVG(PetType), SUM(PetID), AVG(weight) FROM Pets WHERE PetType <> "dog" AND "weight" < 9.3


Question: Which driver IDs, excluding driver ID 6, are not also driver IDs of school buses, excluding school bus driver ID 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 from the driver table excluding driver ID 4, and those from the school bus table with driver IDs greater than 4?

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


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

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


Question: Can you list the aircraft IDs that appear at least once in the aircraft table with an ID of 5 or greater, and also list the aircraft IDs that appear at least once in the airport_aircraft table with an ID greater than 2?

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: What aircraft IDs, excluding ID 1, are present in the aircraft table but not in the airport_aircraft table, also excluding ID 2 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 <> 2


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

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


Question: For each aircraft, what is the ID of the aircraft with the smallest ID that uses the same airport?

SELECT T1.Aircraft_ID, MIN(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 that are less than 9, excluding those driver IDs that are also less than or equal to 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: Can you list the aircraft IDs, first from the aircraft table excluding aircraft ID 5, and then from the airport_aircraft table including only aircraft IDs up to 5?

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


Question: Can you give me a list of driver IDs, excluding driver ID 7, 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 != 7 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 4


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

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


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

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


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

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


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

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


Question: Can you give me the year, invested amount, budgeted amount, and total budget percent invested from the budget table where the following two sets of conditions are both met: first, the budget invested percent is not 71.3, the school ID is greater than 2, the total budget percent invested is not 2.2, the budgeted amount is less than 4979, or the total budget percent budgeted is less than or equal to 2.0; and second, the total budget percent invested is greater than 2.0, the total budget percent budgeted is not 2.4, the school ID is greater than or equal to 2, the invested amount is less than or equal to 8335, the budgeted amount is not 3666, the budget invested percent is not 127.6, and the year is not 2005?

Year Invested Budgeted total_budget_percent_invested

SELECT Year, Invested, Budgeted, total_budget_percent_invested FROM budget WHERE Budget_invested_percent != "71.3" AND "School_id" > 2 AND "total_budget_percent_invested" != 2.2 OR "Budgeted" < 4979 OR "total_budget_percent_budgeted" <= 2.0 INTERSECT SELECT Year, Invested, Budgeted, total_budget_percent_invested FROM budget WHERE "total_budget_percent_invested" > 2.0 AND "total_budget_percent_budgeted" <> 2.4 AND "School_id" >= 2 AND "Invested" <= 8335 OR "Budgeted" != 3666 OR Budget_invested_percent != "127.6" AND "Year" != 2005


Question: Can you list the distances of aircraft where either the aircraft ID is not 7, the distance is not 2128, or the name is not "British Aerospace Jetstream 41", excluding distances that are also found among aircraft with an ID less than 10 and a distance greater than 1530?

SELECT distance FROM aircraft WHERE "aid" != 7 OR "distance" != 2128 OR name != "British Aerospace Jetstream 41" NOT IN (SELECT distance FROM aircraft WHERE "aid" < 10 AND "distance" > 1530)


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

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


Question: Which driver IDs are both greater than 6 and present in the driver table, and also greater than or equal to 4 and present in the school bus table?

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


Question: Can you list all the aircraft IDs from the aircraft table, excluding aircraft ID 3, and combine that with a list of aircraft IDs from the airport_aircraft table that are less than 1, removing any duplicates?

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


Question: Could you please provide the amount outstanding, email address, date they became a customer, and customer address ID for customers who meet either of these sets of criteria: first, those who are in the Customers table and are not named Ortiz, and whose mobile number is not 739-333-6966x187, or whose first name is Ray and their phone number is not +14(5)2351480248, or whose birthdate is not 1993-07-09 11:11:36 and became a customer on 2016-05-11 17:03:48, or whose customer address ID is not 10, or whose customer ID is less than 4, or whose customer status code is "Bad Customer"; and second, those who are also in the Customers table and became a customer on 2016-02-17 08:26:23, and whose phone number is not (297)122-0086, and whose customer address ID is not 2, or whose amount outstanding is less than 2099.0 and their date of birth is 1998-12-15 13:24:40?

SELECT amount_outstanding, email_address, date_became_customer, customer_address_id FROM Customers WHERE last_name != "Ortiz" AND cell_mobile_phone_number != "739-333-6966x187" OR first_name = "Ray" AND phone_number != "+14(5)2351480248" OR date_of_birth != "1993-07-09 11:11:36" AND date_became_customer = "2016-05-11 17:03:48" OR "customer_address_id" != 10 OR "customer_id" < 4 OR customer_status_code = "Bad Customer" INTERSECT SELECT amount_outstanding, email_address, date_became_customer, customer_address_id FROM Customers WHERE date_became_customer = "2016-02-17 08:26:23" AND phone_number != "(297)122-0086" AND "customer_address_id" != 2 OR "amount_outstanding" < 2099.0 AND date_of_birth = "1998-12-15 13:24:40"


Question: Could you give me the aircraft IDs that are both greater than 6 in the certificate table and either have an ID of 10 or a distance greater than 30 in the aircraft table?

SELECT aid FROM aircraft WHERE "aid" = 10 OR "distance" > 30 INTERSECT SELECT aid FROM certificate WHERE "aid" > 6


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

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


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


Question: Can you list the contestant number and name for all contestants, excluding contestant number 6, and also list the contestant number and name for all contestants, excluding contestant number 4?

SELECT contestant_number, contestant_name FROM CONTESTANTS WHERE "contestant_number" != 6 UNION ALL SELECT contestant_number, contestant_name FROM CONTESTANTS WHERE "contestant_number" != 4


Question: Can you list the aircraft IDs that are greater than 4 in the aircraft table, and also list the aircraft IDs that are less than 2 in the airport_aircraft table?

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


Question: Can you list all the driver IDs that are less than 5 from the driver table, combined with all the driver IDs that are less than 9 from the school_bus table, removing any duplicates?

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

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


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

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


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


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

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


Question: Can you give me the IDs of aircraft that are less than or equal to 3, excluding the IDs of aircraft in the airport_aircraft table that are not equal to 1?

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


Question: 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 exactly 4 from the school bus table?

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


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


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

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


Question: Could you list the names and parties of drivers who are either not Democrats or don't live in Hartford, but are also Democrats?

SELECT Name, Party FROM driver WHERE Party != "Dem" OR Home_city <> "Hartford" INTERSECT SELECT Name, Party FROM driver WHERE Party = "Dem"


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


Question: What is the smallest student ID that is both from a member of a club with a student ID less than or equal to 1001 or a club ID less than or equal to 1 and a position of "Teaching Coordinator", and also from a student whose advisor is not 7792?

SELECT MIN(StuID) FROM Member_of_club WHERE "StuID" <= 1001 OR "ClubID" <= 1 AND Position = "Teaching Coordinator" INTERSECT SELECT MIN(StuID) FROM Student WHERE "Advisor" <> 7792


Question: Can you show me the minimum earnings, average best finish, money rank, poker player ID, and minimum final tables made for poker players, combining two groups: first, those with 19 or fewer final tables made, earnings of 596462 or less, or a poker player ID less than 4; and second, those who either have a different number of final tables made than 19, earnings of at least 104871, a people ID of 7, and a poker player ID of 2 or less, or have a money rank of 166 and a best finish of 2?

SELECT MIN(Earnings), AVG(Best_Finish), Money_Rank, Poker_Player_ID, MIN(Final_Table_Made) FROM poker_player WHERE "Final_Table_Made" <= 19.0 OR "Earnings" <= 596462.0 OR "Poker_Player_ID" < 4 UNION SELECT MIN(Earnings), AVG(Best_Finish), Money_Rank, Poker_Player_ID, MIN(Final_Table_Made) FROM poker_player WHERE "Final_Table_Made" != 19.0 AND "Earnings" >= 104871.0 AND "People_ID" = 7 AND "Poker_Player_ID" <= 2 OR "Money_Rank" = 166.0 AND "Best_Finish" = 2.0


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 not 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: Can you give me a list of album IDs where the ID is 196 or greater and the title isn't "Great Opera Choruses", or the artist ID is 148 or greater, combined with a list of employee IDs where the title isn't "IT Staff", or the last name is "Adams", or the country isn't "Canada"?

SELECT id FROM albums WHERE "id" >= 196 AND title <> "Great Opera Choruses" OR "artist_id" >= 148 UNION ALL SELECT id FROM employees WHERE title != "IT Staff" OR last_name = "Adams" OR country != "Canada"


Question: Can you give me a list of driver IDs, removing duplicates, that includes all driver IDs from the driver table, excluding driver ID 7, and all driver IDs from the school_bus table, excluding driver ID 3?

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


Question: Can you give me the PetIDs from the Has_Pet table where either the PetID is not 2003 or the StuID is not 1002, but only if those PetIDs are also found in the Has_Pet table where the StuID is less than or equal to 1001 and the PetID is greater than or equal to 2001?

SELECT PetID FROM Has_Pet WHERE "PetID" != 2003 OR "StuID" <> 1002 IN (SELECT PetID FROM Has_Pet WHERE "StuID" <= 1001 AND "PetID" >= 2001)


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

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


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

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


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

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


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

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


Question: Can you list all the driver IDs, including those from the driver table excluding driver ID 9, and those from the school bus table with driver IDs up to 4?

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


Question: Can you give me the IDs of drivers that are less than 2, excluding the IDs of school bus drivers that are less than or equal to 7?

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


Question: Can you give me a list of driver IDs that are not 11, and are also not 3, considering drivers from both the driver and school bus lists?

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


Question: What is the total number of allergies, excluding ragweed, plus the total number of allergies including those that are not tree pollen or are associated with student ID 1010?

SELECT SUM(Allergy) FROM Allergy_Type WHERE Allergy != "Ragweed" UNION SELECT SUM(Allergy) FROM Has_Allergy WHERE Allergy <> "Tree Pollen" OR "StuID" = 1010


Question: Can you give me a list of aircraft IDs less than 5, excluding any aircraft IDs that are equal to 2 and are also associated with an airport?

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


Question: Can you tell me, for each name, the number of people born on January 22, 1987, the number of nationalities, and the average people ID, but only if the average people ID is exactly 4? Also, can you combine this with the number of people born on any date, the number of nationalities, and the average people ID for each name that isn't Yevgeni Sivozhelez and whose height is at least 207, but only if the number of nationalities is not equal to 1?

SELECT COUNT(Birth_Date), COUNT(Nationality), AVG(People_ID), Name FROM people WHERE Birth_Date = "January 22, 1987" GROUP BY Name HAVING AVG(People_ID) = 4.0 UNION SELECT COUNT(Birth_Date), COUNT(Nationality), AVG(People_ID), Name FROM people WHERE Name != "Yevgeni Sivozhelez" AND "Height" >= 207.0 GROUP BY Name HAVING COUNT(Nationality) != 1


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

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


Question: Can you give me a list of driver IDs from the driver table that are 10 or greater, combined with a list of driver IDs from the school_bus table that are 4 or greater?

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 10 or less, and those from the school bus table that are not equal to 9?

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


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

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


Question: Can you give me the maximum disk loading, the highest aircraft ID, total disk area, description, and the count of maximum gross weights for aircraft, combining two sets of results: first, where the maximum disk loading is not "14.5 lb/ft² (71 kg/m²)", the maximum gross weight is not "1,370 lb (635 kg)", and the aircraft ID is less than or equal to 2; and second, where the total disk area is "8,495 ft² (789 m²)", the maximum gross weight is "1,370 lb (635 kg)", the aircraft ID is not 3, and the aircraft is a "CH-47D Chinook"?

SELECT Max_disk_Loading, MAX(Aircraft_ID), Total_disk_area, Description, COUNT(Max_Gross_Weight) FROM aircraft WHERE Max_disk_Loading <> "14.5 lb/ft² (71 kg/m²)" AND Max_Gross_Weight <> "1,370 lb (635 kg)" AND "Aircraft_ID" <= 2 UNION ALL SELECT Max_disk_Loading, MAX(Aircraft_ID), Total_disk_area, Description, COUNT(Max_Gross_Weight) FROM aircraft WHERE Total_disk_area = "8,495 ft² (789 m²)" AND Max_Gross_Weight = "1,370 lb (635 kg)" AND "Aircraft_ID" <> 3 AND Aircraft = "CH-47D Chinook"


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

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


Question: Can you list the aircraft IDs that appear in the aircraft table, excluding aircraft ID 2, but only if they don't also appear in the airport_aircraft table with an aircraft ID of 2 or greater?

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


Question: Can you give me a list of driver IDs that are greater than 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: Could you give me a list of customer IDs from the payment records where either the payment wasn't made at "2018-02-01 06:15:31", or the payment amount wasn't 1708.18 and the customer ID isn't 2, combined with a list of customer IDs from the customer records where the mobile phone number is "081-097-3684" and the first name isn't "Rylan"?

SELECT customer_id FROM Customer_Payments WHERE datetime_payment != "2018-02-01 06:15:31" OR "amount_payment" != 1708.18 AND "customer_id" <> 2 UNION ALL SELECT customer_id FROM Customers WHERE cell_mobile_phone_number = "081-097-3684" AND first_name <> "Rylan"


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

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


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

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


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


Question: Can you give me a list of driver IDs, where each ID is 9 or greater, and the driver is in the driver table but not in the school_bus table if their ID is 3 or greater?

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


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

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


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

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


Question: Can you list the aircraft IDs, including those that appear exactly once in the aircraft table with an ID of 4, and those that appear in the airport_aircraft table with an ID other than 1?

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


Question: Which driver IDs are not equal to 5 and also less than or equal to 4, considering only the driver IDs that appear in both the driver and school_bus tables?

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


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

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


Question: Which driver IDs are greater than 1 and also not 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 both less than 11 and also greater than 4, considering only unique driver IDs from the driver and school_bus tables?

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


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

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


Question: Can you list all the cities of employees who either have an employee ID of 4 or less, or are named Tim Payne and are 43 years old or younger, and also list all the cities of employees who are not named Andrew Sheridan?

SELECT City FROM employee WHERE "Employee_ID" <= 4 OR "Age" <= 43 AND Name = "Tim Payne" UNION ALL SELECT City FROM employee WHERE Name != "Andrew Sheridan"