Question: Can you give me a list of driver IDs, combining those from the driver table that aren't 12 with those from the school bus table that are less than 10, removing any 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 < 10


Question: Which aircraft have an ID of 5 and also appear in the list of aircraft with IDs less than or equal to 5 at the airport?

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 list the maker, the lowest model ID, and the model name for all cars where either the maker isn't 16, the model ID is 10 or less, or the model isn't a Volvo, combined with a list of the maker, lowest model ID, and model name for cars where either the model ID is 35 or greater, or the maker isn't 4 and the model is a Buick?

SELECT Maker, MIN(ModelId), Model FROM model_list WHERE "Maker" != 16 OR "ModelId" <= 10 OR Model != "volvo" UNION SELECT Maker, MIN(ModelId), Model FROM model_list WHERE "ModelId" >= 35 OR "Maker" != 4 AND Model = "buick"


Question: What is the difference between the average user ID for users named Helen with an ID greater than 7 and the average user ID for all users with an ID greater than 6?

SELECT AVG(u_id) FROM useracct WHERE "u_id" > 7 AND name = "Helen" EXCEPT SELECT AVG(u_id) FROM useracct WHERE "u_id" > 6


Question: Can you give me a list of driver IDs, where each ID is greater than or equal to 2, but not equal to 7 if that driver ID is 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 != 7


Question: Could you give me a list of driver IDs that are both greater than or equal to 10 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 >= 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 that are both less than or equal to 12 and also greater than or equal to 9, considering only the unique driver IDs from the driver and school bus tables?

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


Question: Can you give me a list of employee IDs that includes employees who are 23 or younger, or have an employee ID greater than or equal to 1, combined with a list of employee IDs from evaluations where the bonus is 3000?

SELECT Employee_ID FROM employee WHERE "Age" <= 23 OR "Employee_ID" >= 1 UNION SELECT Employee_ID FROM evaluation WHERE "Bonus" = 3000.0


Question: What is the average employee ID for evaluations where the bonus is at least 2900 or the year awarded is 2015, combined with the average employee ID for hiring where the employee ID is not 1 and either they are full-time or started from 2011?

SELECT AVG(Employee_ID) FROM evaluation WHERE "Bonus" >= 2900.0 OR Year_awarded = "2015" UNION ALL SELECT AVG(Employee_ID) FROM hiring WHERE "Employee_ID" != 1 AND Is_full_time = "T" OR Start_from = "2011"


Question: Can you list all feature type names, including those that aren't amenities, along with any feature type names that aren't "Securiyt, eg Burglar Alarm." or have a feature type code of "Security"?

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


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 less than or equal to 9 from the school bus table, removing any duplicates?

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


Question: Can you list the aircraft IDs that are less than 3 when grouped in the aircraft table, but also not equal to 1 when grouped in the airport_aircraft table?

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


Question: Can you give me a list of driver IDs that are less than 2, but exclude 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: Can you give me a list of driver IDs that are greater than 9, but not including any driver IDs from the school bus list that are greater than or equal to 7?

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


Question: Which driver IDs are both greater than 3 and not equal to 10, considering only the unique driver IDs from both the driver and school bus lists?

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


Question: Can you give me the IDs of drivers, considering only those with an ID of 2 or less, but excluding any driver IDs that appear in the school bus list, unless that ID is 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: Could you list the Aircraft IDs that are less than 3 when looking at the aircraft table, but are also less than or equal to 2 when looking at the airport_aircraft table?

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


Question: Can you list the other details from documents with an ID of 80 or higher and a document name of "Introduction of OS", excluding those with "None" as the other details, combined with the other details from paragraphs with an ID less than 608931827?

SELECT Other_Details FROM Documents WHERE "Document_ID" >= 80 AND Document_Name = "Introduction of OS" AND Other_Details <> "None" UNION SELECT Other_Details FROM Paragraphs WHERE "Paragraph_ID" < 608931827


Question: Can you give me a list of driver IDs that are less than 11, excluding the driver ID 10, considering only unique driver IDs from the driver and school_bus tables?

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


Question: Which store IDs have an area size less than 26.69, excluding store ID 2?

SELECT Store_ID FROM store WHERE "Area_size" < 26.69 EXCEPT SELECT Store_ID FROM store_district WHERE "Store_ID" = 2


Question: Can you give me the ID of the driver that appears exactly once in the driver table, specifically with an ID of 1, but is not a driver with any ID other than 9 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 != 9


Question: Can you list all driver IDs from the driver table that are less than or equal to 5, and combine that with a list of all driver IDs from the school_bus table that are less than or equal to 9, making sure to only list each driver ID once?

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


Question: Which driver IDs are greater than 6 and also not equal to 3, considering only the unique driver IDs from both the driver and school_bus lists?

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


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


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

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


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

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


Question: Which aircraft IDs, excluding 3, are also aircraft IDs that are greater than or equal to 5 and found in the airport aircraft list?

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


Question: Can you give me the Driver IDs that are equal to 12 from the driver table and also the Driver IDs that are equal to 7 from the school_bus table?

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


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

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


Question: Can you give me the IDs of all items that are not titled "comb", excluding those items with an ID of 1 that are also not titled "pear"?

SELECT i_id FROM item WHERE title != "comb" NOT IN (SELECT i_id FROM item WHERE "i_id" = 1 AND title != "pear")


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

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


Question: Can you give me a list of driver IDs, excluding driver 8, from the driver table, combined with a list of driver IDs less than 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 a list of driver IDs, including those greater than 10 from the driver table and those less than 10 from the school bus table?

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


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

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 IDs of drivers with an ID of 2 or less, excluding those drivers whose IDs appear in the school bus table, unless that ID is 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 list the names of aircraft with an ID of 2 or less, or a distance that isn't 30 and a name that isn't "Boeing 777-300", along with the names of employees named "Richard Jackson" or with an employee ID of 310454876 or less?

SELECT name FROM aircraft WHERE "aid" <= 2 OR "distance" != 30 AND name <> "Boeing 777-300" UNION ALL SELECT name FROM employee WHERE name = "Richard Jackson" OR "eid" <= 310454876


Question: Can you give me a list of car makers, including those who make models that aren't Fords or have a ModelId of 16, and also those who make models with a ModelId of 13 that aren't Chryslers?

SELECT Maker FROM model_list WHERE Model != "ford" OR "ModelId" = 16 UNION SELECT Maker FROM model_list WHERE "ModelId" = 13 AND Model <> "chrysler"


Question: What is the lowest vehicle ID for lesson 3, and what is the lowest vehicle ID for a truck?

SELECT MIN(vehicle_id) FROM Lessons WHERE "lesson_id" = 3 UNION ALL SELECT MIN(vehicle_id) FROM Vehicles WHERE vehicle_details = "Truck"


Question: What are the driver IDs that are either less than or equal to 5, or not equal to 10?

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: What are the aircraft IDs that are greater than or equal to 4 in the aircraft table, but not present in the airport_aircraft table with IDs less than or equal to 3?

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


Question: Which driver IDs are less than 6 but not present in the school bus table with IDs greater than or equal to 7?

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


Question: What are the driver IDs that are either less than or equal to 9 from the driver table or greater than 7 from the school bus table?

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


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

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


Question: What are the driver IDs that are either less than or equal to 8 or not equal to 3, considering both the driver and school bus records?

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


Question: Which driver IDs are either equal to 1 or less than 10, considering driver and school bus information?

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: Which districts, election IDs, and counties represented are associated with elections where the party value is 7 or greater, or the election ID is 1 or greater, or the delegate is not "Bates, Gail H. Gail H. Bates", and also with elections where the committee is "Appropriations"?

SELECT District, Election_ID, Counties_Represented FROM election WHERE "Party" >= 7 OR "Election_ID" >= 1 OR Delegate <> "Bates, Gail H. Gail H. Bates" UNION SELECT District, Election_ID, Counties_Represented FROM election WHERE Committee = "Appropriations"


Question: What are the driver IDs that are both greater than or equal to 4 and also less than 7, considering only those drivers who are in the driver table and the school bus table?

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


Question: What are the driver IDs that are both less than or equal to 9 and present in the school bus table, excluding 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: What are the aircraft IDs, excluding ID 1, from the aircraft table, combined with 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 are the driver IDs that are less than 10 in the driver table or less than 3 in the school bus table?

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


Question: What are the aircraft IDs that are either greater than or equal to 4 in the aircraft table or not equal to 5 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 <> 5


Question: What is the maximum departure date, average arrival date, average aid, origin, average destination, count of flight numbers, sum of prices, and count of distances for flights, considering two scenarios: first, flights departing at 06:30 on 04/12/2005 but not arriving at 05:03 on 04/12/2005 and with flight numbers greater than 76; and second, flights arriving at 10:03 on 04/12/2005 and with flight number 76, or flights not departing at 12:45 on 04/12/2005 and with distance not equal to 5478, or with aid greater or equal to 5?

MAX(departure_date) AVG(arrival_date) AVG(aid) origin AVG(destination) COUNT(flno) SUM(price) COUNT(distance)

SELECT MAX(departure_date), AVG(arrival_date), AVG(aid), origin, AVG(destination), COUNT(flno), SUM(price), COUNT(distance) FROM flight WHERE arrival_date <> "04/12/2005 05:03" AND departure_date = "04/12/2005 06:30" AND "flno" > 76 UNION SELECT MAX(departure_date), AVG(arrival_date), AVG(aid), origin, AVG(destination), COUNT(flno), SUM(price), COUNT(distance) FROM flight WHERE departure_date != "04/12/2005 12:45" AND "distance" <> 5478 OR "aid" >= 5 AND arrival_date = "04/12/2005 10:03" AND "flno" = 76


Question: What is the sum of Store IDs and the minimum Product ID for products with ID 6, and also the sum of Store IDs and the minimum Product ID for products where the Store ID is less than 1 and the Product ID is less than 1?

SELECT SUM(Store_ID), MIN(Product_ID) FROM store_product WHERE "Product_ID" = 6 UNION ALL SELECT SUM(Store_ID), MIN(Product_ID) FROM store_product WHERE "Store_ID" < 1 AND "Product_ID" < 1


Question: What are the aircraft IDs that are not 1 and are present in the aircraft table but not in the airport_aircraft table, excluding those with IDs less than or equal to 5?

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


Question: What are the aircraft IDs that are either less than or equal to 3 in the aircraft table or equal to 1 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 = 1


Question: What are the driver IDs greater than 6 from the driver table, combined with the driver IDs not equal to 10 from the school bus table?

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


Question: What are the driver IDs that are both less than or equal to 9 and also not equal to 9, considering the driver IDs from the driver and school bus tables?

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: What are the driver IDs that are either 3 or not 4, considering driver IDs from both the driver and school bus tables?

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


Question: What is the minimum DPI and the count of products that meet the following criteria: DPI is less than 600 and the interface is not USB 2.0, or the color pages per minute is greater than or equal to 4, the dimensions are not 280 x 95 x 40, the product is Canon DR-2080C, and the max page size is not 216mm x 355mm, excluding the minimum DPI and count of products where the product is Plustek MobileOffice D28 Corporate, the dimensions are not 300 x 50 x 45, the product ID is less than or equal to 5, the color pages per minute is greater than 4.0, and the interface is USB 2.0?

SELECT MIN(dpi), COUNT(product) FROM product WHERE "dpi" < 600.0 AND interface != "USB 2.0" OR "pages_per_minute_color" >= 4.0 AND dimensions <> "280 x 95 x 40" AND product = "Canon DR-2080C" AND max_page_size <> "216mm x 355mm" EXCEPT SELECT MIN(dpi), COUNT(product) FROM product WHERE product = "Plustek MobileOffice D28 Corporate" AND dimensions <> "300 x 50 x 45" AND "product_id" <= 5 AND "pages_per_minute_color" > 4.0 AND interface = "USB 2.0"


Question: Which driver IDs are less than or equal to 7, excluding driver ID 7, considering only the driver table and school bus table?

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


Question: What are the maximum salaries and corresponding employee IDs, considering employees who are not employee ID 552455318 or not named Jennifer Thomas, and also considering employees who are not employee ID 269734834 or whose salary is not 23980 and not named Mary Johnson?

SELECT MAX(salary), eid FROM employee WHERE "eid" <> 552455318 OR name <> "Jennifer Thomas" INTERSECT SELECT MAX(salary), eid FROM employee WHERE "eid" != 269734834 OR "salary" != 23980 AND name != "Mary Johnson"


Question: Which driver IDs are equal to 11 in the driver table but not equal to 10 in the school bus table?

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


Question: What are the aircraft IDs that are not equal to 2, but are not also aircraft IDs less than or equal to 5 that are associated with an airport?

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


Question: What are the budget invested percentages, school IDs, budgeted amounts, years, invested amounts, total budgeted percent invested, and total budgeted percent budgeted for budget entries that meet either of these two sets of criteria: the first set where the total budgeted percent budgeted is not 2.0, or the total budgeted percent invested is not 2.0, or the budgeted amount is less than 6803, or the year is before 2003 and the invested amount is not 5840, or the budget invested percentage is not 42.9; and the second set where the total budgeted percent budgeted is 2.4, or the invested amount is 5840, or the year is 2003 or later and the budget invested percentage is not 122.5 and the school ID is not 5?

SELECT Budget_invested_percent, School_id, Budgeted, Year, Invested, total_budget_percent_invested, total_budget_percent_budgeted FROM budget WHERE "total_budget_percent_budgeted" <> 2.0 OR "total_budget_percent_invested" <> 2.0 OR "Budgeted" < 6803 OR "Year" < 2003 AND "Invested" <> 5840 OR Budget_invested_percent != "42.9" INTERSECT SELECT Budget_invested_percent, School_id, Budgeted, Year, Invested, total_budget_percent_invested, total_budget_percent_budgeted FROM budget WHERE "total_budget_percent_budgeted" = 2.4 OR "Invested" = 5840 OR "Year" >= 2003 AND Budget_invested_percent != "122.5" AND "School_id" <> 5


Question: Which driver IDs are not 1 and are in the driver table, but not in the school bus table, excluding driver ID 4?

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


Question: Which driver IDs are either less than or equal to 5, or equal to 10, considering driver information from both the driver and school bus tables?

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: What are the allergy types and allergies that are not environmental allergies and also not rodent allergies?

SELECT AllergyType, Allergy FROM Allergy_Type WHERE AllergyType != "environmental" INTERSECT SELECT AllergyType, Allergy FROM Allergy_Type WHERE Allergy <> "Rodent" OR AllergyType <> "environmental"


Question: Which driver IDs are either 4 or not 4, considering driver and school bus information?

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


Question: What are the aircraft IDs that are both less than or equal to 3 and also greater than or equal to 2, considering only aircraft IDs present in both the aircraft and airport_aircraft tables?

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: Which driver IDs are either less than or equal to 3, or greater than 9?

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


Question: What are the last and first names of students who are either 18 or older, or whose first name is Paul, or whose sex is male, or whose last name is not Schmidt, and also have a major other than 50, or a student ID greater than 1015, or an advisor greater than 7271, and are not female and whose first name is not Dinesh?

SELECT LName, Fname FROM Student WHERE "Age" >= 18 OR Fname = "Paul" OR Sex = "M" OR LName <> "Schmidt" INTERSECT SELECT LName, Fname FROM Student WHERE "Major" != 50 OR "StuID" > 1015 OR "Advisor" > 7271 AND Sex <> "F" AND Fname != "Dinesh"


Question: What are the driver IDs that are less than or equal to 1, but not driver IDs that are greater than or equal to 3, considering drivers from the 'driver' table and school buses?

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: What are the driver IDs, excluding driver ID 10, that are present in both the driver and school bus tables, where the school bus driver ID is 7 or greater?

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


Question: What are the aircraft IDs that appear in both the aircraft table (with IDs greater than 1) and the airport_aircraft table (with IDs greater than or equal to 1)?

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


Question: Which driver IDs are either 9 or 10 or greater?

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


Question: What are the driver IDs, excluding ID 11, that are present in both the driver and school bus records, where the school bus driver IDs are greater than 9?

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


Question: What are the driver IDs that are less than 6, and also the driver ID 3?

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


Question: What driver IDs are both equal to 7 in the driver table and not equal to 4 in the school bus table?

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


Question: What are the aircraft IDs that are either less than or equal to 4 in the aircraft table or equal to 1 in the airport_aircraft table?

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


Question: What are the aircraft IDs that are either aircraft ID 2 or any aircraft ID except 3 from the airport aircraft table?

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


Question: What are the driver IDs greater than 5 from the driver table, combined with driver ID 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: What are the driver IDs that are greater than or equal to 9, or the driver IDs that are less than or equal to 7?

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: What are the IDs of drivers, excluding driver 4, and the IDs of school buses, excluding bus 10?

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


Question: What are the aircraft IDs that are both less than or equal to 2 and also appear in the airport aircraft table with IDs less than or equal to 3?

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: What are the driver IDs that are less than 5 from the driver table, combined with the driver IDs that are less than 10 from the school bus table?

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


Question: What are the driver IDs that are both less than or equal to 9 and also not equal to 7, considering only those IDs present in both the driver and school bus tables?

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


Question: What are the aircraft IDs that are not 4 and are present in the aircraft table, but not in the airport_aircraft table (excluding aircraft ID 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: What are the driver IDs greater than 8 that are also present in the school bus table with driver IDs greater than 9?

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


Question: Which driver IDs are not equal to 2 and are not present in the school bus table with driver IDs 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: What are the aircraft IDs, excluding aircraft ID 3, from the aircraft table, combined with aircraft IDs greater than 2 from the airport_aircraft table?

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


Question: Which driver IDs are less than 10 but not equal to 7, considering only the drivers and school buses?

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


Question: What are the employee IDs and bonuses, but only for bonuses not awarded in 2011 or for employees named Matt Stevens who are older than 23?

SELECT T1.Employee_ID, T2.Bonus FROM employee as T1 JOIN evaluation as T2 ON T1.Employee_ID == T2.Employee_ID GROUP BY Bonus HAVING Year_awarded <> "2011" OR Name = "Matt Stevens" AND Age > 23


Question: What are the driver IDs, excluding driver ID 5, that are present in both the driver and school bus tables, where the driver ID is less than 10 in the school bus table?

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


Question: What are the aircraft IDs greater than 2, and also the aircraft IDs that are less than or equal to 5, considering both the aircraft and airport_aircraft tables?

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: What are the aircraft IDs that are less than 1, and also the aircraft IDs that are at most 3?

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


Question: What are the driver IDs greater than 1 from the driver table, combined with the driver IDs from the school bus table that are not equal to 4?

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


Question: What are the aircraft IDs that are not 3 and are also present in the airport aircraft table, excluding aircraft ID 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: What is the highest document ID from the circulation history where the document ID is greater than 1 or the employee ID is 8 or more and the draft number is greater than 1, excluding the highest document ID from the document drafts where the document ID is 2 or greater?

SELECT MAX(document_id) FROM Circulation_History WHERE "document_id" > 1 OR "employee_id" >= 8 AND "draft_number" > 1 EXCEPT SELECT MAX(document_id) FROM Document_Drafts WHERE "document_id" >= 2


Question: What are the distance, departure date, average origin, count of destinations, and arrival date for flights that meet all of these conditions: the flight number is greater than 34, or the price is not 182.0, or the airline ID is 7, and the arrival date is 04/12/2005 12:02, and the origin is not Los Angeles, and the distance is at least 1749, and the destination is not Dallas, and also meet at least one of these conditions: the airline ID is greater than or equal to 1, or the distance is 2551, or the origin is Chicago, but the departure date is not 04/12/2005 06:30?

SELECT distance, departure_date, AVG(origin), COUNT(destination), arrival_date FROM flight WHERE "flno" > 34 OR "price" <> 182.0 OR "aid" = 7 AND arrival_date = "04/12/2005 12:02" AND origin != "Los Angeles" AND "distance" >= 1749 AND destination <> "Dallas" INTERSECT SELECT distance, departure_date, AVG(origin), COUNT(destination), arrival_date FROM flight WHERE "aid" >= 1 OR "distance" = 2551 AND departure_date <> "04/12/2005 06:30" OR origin = "Chicago"


Question: What are the aircraft IDs, excluding aircraft ID 2, from the aircraft table, combined with aircraft IDs less than 5 from the airport_aircraft table?

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


Question: Which driver IDs are present in both the driver and school bus tables, where the driver ID is at least 5 in the driver table and at least 3 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 >= 3


Question: What are the aircraft IDs that are either less than or equal to 3 in the aircraft table or not equal to 3 in the airport_aircraft table?

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


Question: Which driver IDs are greater than or equal to 11 but not found in the school bus table with driver IDs greater than 9?

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: Which driver IDs are in the driver table but not in the school bus table, excluding driver ID 1 from the driver table and driver IDs 9 or less 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 <= 9


Question: What are the aircraft IDs that are not 4, and also the aircraft IDs that are less than or equal to 1, considering both the aircraft and airport_aircraft tables?

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 less than or equal to 12 in the driver table, but not 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: What are the driver IDs, excluding driver ID 9, that are present in both the driver table and the school bus table, where the school bus driver IDs are less than 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: What are the driver IDs, excluding ID 9, from the driver table and the driver IDs, excluding ID 10, from the school bus table, combined into a single list?

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


Question: What are the IDs of drivers, excluding driver ID 9, and also the IDs of school bus drivers, excluding driver ID 7?

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: What are the driver IDs that are not 1 and are not found in the school bus table with driver IDs greater than or equal to 4?

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


Question: Which driver IDs, excluding ID 1, are present in both the driver and school bus tables, excluding ID 9?

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


Question: What are the driver IDs, excluding ID 10, from the driver table and the driver IDs greater than 7 from the school bus table?

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


Question: What are the driver IDs that are both less than 11 and also not equal to 10, considering only drivers and school buses?

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


Question: What are the names and the number of product categories for village stores with an ID greater than 2 and an area size not equal to 7.23, or stores with a number of product categories not equal to 17811, or stores with a ranking greater than 1, or stores not named "Doaktown"? Also, what are the names and the number of product categories for stores with fewer than 1170 product categories that are not city malls?

SELECT Store_Name, Number_of_product_category FROM store WHERE Type = "Village Store" AND "Store_ID" > 2 AND "Area_size" <> 7.23 OR "Number_of_product_category" != 17811.0 OR "Ranking" > 1 OR Store_Name != "Doaktown" UNION SELECT Store_Name, Number_of_product_category FROM store WHERE "Number_of_product_category" < 1170.0 AND Type != "City Mall"


Question: What are the aircraft IDs that are either less than or equal to 5, or not equal to 3?

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: What are the aircraft IDs that are greater than 2 in the aircraft table, combined with the aircraft IDs that are not equal to 2 in the airport_aircraft table?

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


Question: Which driver IDs, excluding driver ID 10, are in the driver table but not in the school bus table, excluding driver ID 7?

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


Question: What are the customer status codes, phone numbers, the earliest email addresses, and last names of customers who meet the following criteria: either their customer address ID is not 10 and their customer ID is at least 7, or their email address is not "kitty.hand@example.net", and their date of birth is "1998-12-15 13:24:40", and their date of becoming a customer is "2016-04-08 00:28:15", and their last name is not "Ortiz", or their cell phone number is not "00659133944", or their phone number is "(729)396-4354x3576" and their customer status is "Good Customer" and their outstanding amount is less than or equal to 7093.0; and also, either their first name is "Marina", or their date of becoming a customer is not "2017-10-05 14:15:46", or their outstanding amount is not 5687.0 and their date of birth is not "1994-05-07 01:32:16"?

SELECT customer_status_code, phone_number, MIN(email_address), last_name FROM Customers WHERE "customer_address_id" <> 10 AND "customer_id" >= 7 OR email_address <> "kitty.hand@example.net" AND date_of_birth = "1998-12-15 13:24:40" AND date_became_customer = "2016-04-08 00:28:15" AND last_name <> "Ortiz" OR cell_mobile_phone_number <> "00659133944" OR phone_number = "(729)396-4354x3576" AND customer_status_code = "Good Customer" AND "amount_outstanding" <= 7093.0 INTERSECT SELECT customer_status_code, phone_number, MIN(email_address), last_name FROM Customers WHERE first_name = "Marina" OR date_became_customer <> "2017-10-05 14:15:46" OR "amount_outstanding" != 5687.0 AND date_of_birth != "1994-05-07 01:32:16"


Question: Which staff IDs are in lessons that are not lesson ID 4, or have a vehicle ID of 2 or greater, or are not at time 9, or have staff ID 12 and a lesson date not on 2018-03-16 07:08:52, but are not staff with a last name other than Herzog or a date left staff on 2018-03-06 23:17:41 and a middle name other than Duane?

SELECT staff_id FROM Lessons WHERE "lesson_id" != 4 AND lesson_status_code = "Completed" OR "vehicle_id" >= 2 OR lesson_time != "9" OR "staff_id" = 12 AND lesson_date != "2018-03-16 07:08:52" EXCEPT SELECT staff_id FROM Staff WHERE last_name <> "Herzog" OR date_left_staff = "2018-03-06 23:17:41" AND middle_name != "Duane"


Question: What are the prices, lesson IDs, and lesson times for lessons that are not cancelled and not on March 17, 2018 at 19:02:07, where the customer ID is not 3 or the vehicle ID is less than or equal to 1 and the price is 277.0 and the staff ID is greater than or equal to 12, combined with the prices, lesson IDs, and lesson times for lessons where the price is not 199.0 and the lesson ID is greater than or equal to 9 and the customer ID is greater than 11 or the staff ID is greater than or equal to 11?

SELECT price, lesson_id, lesson_time FROM Lessons WHERE lesson_status_code <> "Cancelled" AND lesson_date <> "2018-03-17 19:02:07" AND "customer_id" != 3 OR "vehicle_id" <= 1 AND "price" = 277.0 AND "staff_id" >= 12 UNION SELECT price, lesson_id, lesson_time FROM Lessons WHERE "price" != 199.0 AND "lesson_id" >= 9 AND "customer_id" > 11 OR "staff_id" >= 11


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


Question: What are the IDs of drivers, excluding driver 9, and the IDs of school buses, excluding bus 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: What are the aircraft IDs that are less than 3, or any aircraft IDs except 3, found in either the aircraft or airport aircraft tables?

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


Question: For each year, and for party ID 7 or where the governor isn't Carl McCall or the attorney general isn't Eliot Spitzer, and also for years before 2006 or where the lieutenant governor isn't David Paterson and the US Senate member isn't Hillary Rodham Clinton and the governor isn't Peter Vallone or the attorney general isn't Andrew Cuomo and the party isn't Liberal, how many governors and lieutenant governors are there, what's the sum of the attorney generals, and what are the party IDs?

SELECT COUNT(Governor), Party_ID, COUNT(Lieutenant_Governor), Year, SUM(Attorney_General) FROM party WHERE Comptroller <> "Carl McCall" OR Party != "Democratic" AND US_Senate <> "Hillary Rodham Clinton" AND Lieutenant_Governor <> "Jonathan Reiter" AND "Party_ID" = 7 OR Governor <> "Carl McCall" OR Attorney_General != "Eliot Spitzer" UNION SELECT COUNT(Governor), Party_ID, COUNT(Lieutenant_Governor), Year, SUM(Attorney_General) FROM party WHERE Lieutenant_Governor <> "David Paterson" AND US_Senate <> "Hillary Rodham Clinton" AND Governor <> "Peter Vallone" OR "Year" < 2006.0 OR Attorney_General != "Andrew Cuomo" AND Party != "Liberal"


Question: What are the number of employees, average department name, and department ID for departments that have a budget of 46.2 billion and are not named "Health and Human Services" and have 235,000 or fewer employees, combined with departments that have 67,000 or fewer employees or have a department ID greater than 7?

SELECT Num_Employees, AVG(Name), Department_ID FROM department WHERE "Budget_in_Billions" = 46.2 AND Name <> "Health and Human Services" AND "Num_Employees" <= 235000.0 UNION ALL SELECT Num_Employees, AVG(Name), Department_ID FROM department WHERE "Num_Employees" <= 67000.0 OR "Department_ID" > 7


Question: Which driver IDs are less than 9 but not greater than 3, considering only driver IDs?

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


Question: What is the sum of the shipping agent descriptions, excluding those described as "w", combined with the sum of the shipping agent descriptions for agents that are not "UPS"?

SELECT SUM(shipping_agent_description) FROM Ref_Shipping_Agents WHERE shipping_agent_description != "w" UNION SELECT SUM(shipping_agent_description) FROM Ref_Shipping_Agents WHERE shipping_agent_name <> "UPS"


Question: What are the driver IDs of drivers with ID 6 or school buses with ID 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: What are the incorporation locations and types of "Air China Cargo" where the group equity shareholding is not 40.0, or the principal activities are not "Ground handling" and the type is not "Joint Venture", or the ID is greater than 10 and the incorporation location is not "Hong Kong", excluding those with type "Joint Venture" and ID greater than or equal to 10?

SELECT Incorporated_in, Type FROM operate_company WHERE "Group_Equity_Shareholding" != 40.0 OR Principal_activities <> "Ground handling" AND Type <> "Joint Venture" AND name = "Air China Cargo" OR "id" > 10 AND Incorporated_in != "Hong Kong" EXCEPT SELECT Incorporated_in, Type FROM operate_company WHERE Type = "Joint Venture" AND "id" >= 10


Question: What is the sum of the 'Party' values from the 'election' table where 'Party' is less than 1 and the 'Election_ID' is 5, excluding the sum of 'Party' from the 'party' table where the 'Attorney_General' is not "Jeanine Pirro" and the 'Year' is greater than 2006, or the 'Governor' is not "Carl McCall", or the 'Lieutenant_Governor' is not "Sandra Frankel" and the 'Party' is "Independence", or the 'US_Senate' is not "Charles Schumer" and the 'Party_ID' is not 4, or the 'Comptroller' is not "Alan Hevesi"?

SELECT SUM(Party) FROM election WHERE "Party" < 1 AND "Election_ID" = 5 EXCEPT SELECT SUM(Party) FROM party WHERE Attorney_General <> "Jeanine Pirro" AND "Year" > 2006.0 AND Governor <> "Carl McCall" OR Lieutenant_Governor != "Sandra Frankel" AND Party = "Independence" OR US_Senate <> "Charles Schumer" AND "Party_ID" != 4 OR Comptroller != "Alan Hevesi"


Question: What are the aircraft IDs that are less than 1, and also the aircraft ID 5?

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


Question: What are the driver IDs, excluding driver ID 3, and also any driver IDs from school buses that are 7 or greater?

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: What are the aircraft IDs that are either equal to 1 in the aircraft table or not equal to 1 in 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 != 1


Question: What are the club IDs of coaches who are not Jameson Tomas, combined with the club IDs from match results where the bronze value isn't 10 and the small silver value is greater than 4 and the big silver value isn't 12, or the club ID isn't 1 and the points are greater than 102 and the gold value isn't 20, or the rank is 3?

SELECT Club_ID FROM coach WHERE Coach_name <> "Jameson Tomas" UNION ALL SELECT Club_ID FROM match_result WHERE "Bronze" != 10 AND "Small_Silver" > 4 AND "Big_Silver" <> 12 OR "Club_ID" <> 1 AND "Points" > 102 AND "Gold" <> 20 OR "Rank" = 3


Question: Which driver IDs are not equal to 11, but are not found in the school bus table with driver ID 7?

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


Question: What are the employee IDs from the certificate table where the employee ID is not 142519864 or the activity ID is less than 7, but not including those employee IDs from the employee table where the employee ID is not 567354612 and the salary is 289950?

SELECT eid FROM certificate WHERE "eid" != 142519864 OR "aid" < 7 EXCEPT SELECT eid FROM employee WHERE "eid" != 567354612 AND "salary" = 289950


Question: What are the IDs of drivers, excluding driver 2, and also the IDs of school bus drivers, excluding driver 4?

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


Question: What are the aircraft IDs that are either less than or equal to 3, or not equal to 5?

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


Question: Which driver IDs are not equal to 9 but are present in the driver table, excluding those driver IDs that are equal to 9 in the school bus table?

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


Question: What are the aircraft IDs that are both greater than or equal to 5 and not equal to 1, considering only those aircraft IDs present in both the aircraft and airport_aircraft tables?

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


Question: Which driver IDs, excluding driver ID 5, are associated with drivers, and which driver IDs, less than 10, are associated with school buses?

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: What is the sum of `document_type_code` from the `Documents` table where `shipping_agent_code` is not "UP", `document_type_code` is not "Paper", `receipt_number` is not "114", `other_details` is "p", `document_status_code` is not "done", and `document_id` is 1, combined with the sum of `document_type_code` from `Ref_Document_Types` where `document_type_code` is not "CD"?

SELECT SUM(document_type_code) FROM Documents WHERE shipping_agent_code <> "UP" AND document_type_code <> "Paper" OR receipt_number <> "114" AND other_details = "p" AND document_status_code != "done" AND "document_id" = 1 UNION ALL SELECT SUM(document_type_code) FROM Ref_Document_Types WHERE document_type_code != "CD"


Question: What are the driver IDs that are either greater than or equal to 5 from the driver table, or not equal to 9 from the school bus table?

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


Question: Which driver IDs, up to 4, are in the driver table but not in the school bus table, considering only driver IDs up 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: Which store IDs are not from a store named Miramichi and don't have a ranking of 3, or are associated with a product ID of 3 or less?

SELECT Store_ID FROM store WHERE Store_Name != "Miramichi" AND "Store_ID" <> 3 OR "Ranking" != 3 UNION ALL SELECT Store_ID FROM store_product WHERE "Product_ID" <= 3


Question: What are the aircraft IDs greater than 4 that are not present in the airport_aircraft table with IDs less than or equal to 2?

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


Question: What are the aircraft IDs that are less than 2 and are not aircraft ID 2, considering the aircraft and airport aircraft information?

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: Which driver IDs are not from Bethel and not Democrats, or whose names are not Timothy Ackert and have a driver ID greater than 8, or are 38 years old, but are not driver IDs from school buses where the school ID is greater than 1, the driver ID is not 10, and the driver is not part-time?

SELECT Driver_ID FROM driver WHERE Home_city != "Bethel" AND Party != "Dem" OR Name != "Timothy Ackert" AND "Driver_ID" > 8 OR "Age" = 38 EXCEPT SELECT Driver_ID FROM school_bus WHERE "School_ID" > 1 AND "Driver_ID" <> 10 AND If_full_time != "F"


Question: Which driver IDs are in the driver table but not in the school bus table, excluding driver ID 3 from the driver table and driver ID 9 from the school bus table?

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


Question: What are the aircraft IDs, excluding aircraft ID 4, and also the aircraft IDs that are less than or equal to 1, considering both the aircraft and airport_aircraft tables?

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 less than 9 but not equal to 9, based on the driver and school bus information?

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


Question: What are the driver IDs that are less than 3, and also the driver IDs that are less than or equal to 7?

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


Question: What are the driver IDs that are equal to 5, excluding those driver IDs that are not equal to 4?

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


Question: What are all the contestant numbers, including contestant number 8 and any contestant numbers greater than 9, or any contestant numbers where the contestant name is not "Loraine NygrenTania Mattioli"?

SELECT contestant_number FROM CONTESTANTS WHERE "contestant_number" = 8 UNION ALL SELECT contestant_number FROM CONTESTANTS WHERE contestant_name != "Loraine NygrenTania Mattioli" OR "contestant_number" > 9


Question: What are the driver IDs that are either 5 or 9, considering driver IDs from both the driver and school bus tables?

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: What are the vehicle IDs from lessons that aren't on February 26, 2018, or have a customer ID other than 2, a lesson time other than 4, a lesson ID other than 10, a lesson status that isn't "Cancelled", and a price greater than 199, plus the vehicle IDs of all vans?

SELECT vehicle_id FROM Lessons WHERE lesson_date <> "2018-02-26 02:36:35" OR "customer_id" != 2 AND lesson_time <> "4" AND "lesson_id" <> 10 AND lesson_status_code != "Cancelled" AND "price" > 199.0 AND "vehicle_id" >= 1 UNION ALL SELECT vehicle_id FROM Vehicles WHERE vehicle_details = "Van"


Question: What is the average Template ID from the Documents table where Other Details is not "None", Template ID is less than or equal to 25, Document Description is not "y", and Document Name is not "Palm reading", combined with the average Template ID from the Templates table where Date Effective From is not "2005-02-20 00:31:34" and Template ID is less than 9?

SELECT AVG(Template_ID) FROM Documents WHERE Other_Details <> "None" AND "Template_ID" <= 25 AND Document_Description <> "y" AND Document_Name <> "Palm reading" UNION ALL SELECT AVG(Template_ID) FROM Templates WHERE Date_Effective_From != "2005-02-20 00:31:34" AND "Template_ID" < 9


Question: Which driver IDs, excluding ID 3, are present in both the 'driver' table and the 'school_bus' table, where the 'school_bus' table specifically includes driver ID 10?

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


Question: What are the aircraft IDs that are not equal to 2, but are not present in the airport aircraft table with an ID less than or equal to 1?

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


Question: What are the smallest school IDs from the School table where the enrollment is 316, or the school name isn't "Knox Community", or the IHSAA class isn't "AA" and the location is "Bourbon", or the football class isn't "AA", or the mascot is "Trojans" and the county isn't "50 Marshall"? Also, what are the smallest school IDs from the endowment table where the amount isn't 8.85, or the donor name isn't "Valverde", or the endowment ID is less than 1, or the school ID is less than or equal to 3?

SELECT MIN(School_id) FROM School WHERE "Enrollment" = 316 OR School_name <> "Knox Community" OR IHSAA_Class <> "AA" AND Location = "Bourbon" OR IHSAA_Football_Class <> "AA" OR Mascot = "Trojans" AND County <> "50 Marshall" UNION ALL SELECT MIN(School_id) FROM endowment WHERE "amount" <> 8.85 AND donator_name != "Valverde" OR "endowment_id" < 1 OR "School_id" <= 3


Question: What are the driver IDs that are greater than 3 and also greater than or equal to 7, considering only the driver IDs present in both 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 >= 7


Question: Which driver IDs are less than 3 but not greater than or equal to 4, considering only the driver IDs found in the driver table and excluding those found in the school bus table?

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


Question: What are the effective start dates, counts of template details, template type codes, and effective end dates for templates, excluding those where the effective start date is "2012-04-05 07:11:42", the version number is greater than 5, or the template ID is less than or equal to 20, and the effective end date is not "2007-06-06 06:18:53", or the template details are empty, or the template type code is "PP", but also excluding those where the version number is greater than 5, or the template type code is not "AD" and the effective end date is "1993-03-24 14:30:23", or the template details are not empty, or the effective start date is "1975-10-20 02:28:58"?

SELECT Date_Effective_From, COUNT(Template_Details), Template_Type_Code, Date_Effective_To FROM Templates WHERE Date_Effective_From != "2012-04-05 07:11:42" AND "Version_Number" <= 5 AND "Template_ID" > 20 AND Date_Effective_To = "2007-06-06 06:18:53" OR Template_Details <> "" OR Template_Type_Code != "PP" EXCEPT SELECT Date_Effective_From, COUNT(Template_Details), Template_Type_Code, Date_Effective_To FROM Templates WHERE "Version_Number" <= 5 OR Template_Type_Code != "AD" AND Date_Effective_To <> "1993-03-24 14:30:23" OR Template_Details != "" OR Date_Effective_From = "1975-10-20 02:28:58"


Question: What are the aircraft IDs greater than 4, and also the aircraft ID 3?

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


Question: Which driver IDs are less than or equal to 1 but not present in the school bus table with driver IDs less than or equal to 3?

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: What are the IDs of albums that aren't "Handel: Music for the Royal Fireworks (Original Version 1749)" and the IDs of playlists that are not 18?

SELECT id FROM albums WHERE title <> "Handel: Music for the Royal Fireworks (Original Version 1749)" UNION ALL SELECT id FROM playlists WHERE "id" != 18


Question: Which driver IDs are less than 6 but not equal to 9, considering only the driver IDs present in the driver table and excluding those 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: Which driver IDs are greater than 1 and also appear in the school bus table with IDs greater than or equal to 10?

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


Question: What are the driver IDs that are less than 8, and also the driver IDs from school buses that are less than 7?

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


Question: What are the driver IDs that are less than 3, considering both drivers and school buses, and combining the results?

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: Which driver IDs are either 6 or not 10, considering driver and school bus information?

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


Question: What are the aircraft IDs that are both less than or equal to 3 and not equal to 1, considering only aircraft IDs present in both the aircraft and airport_aircraft tables?

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

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


Question: What are the driver IDs greater than 3 that are also present in the school bus table with driver IDs less than or equal to 9?

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


Question: Which driver IDs are less than or equal to 10 but not present in the school bus table with driver IDs greater than or equal to 3?

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


Question: What are the driver IDs that are both 7 and not 9, considering driver IDs from the driver and school bus tables?

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


Question: What are all the continents, excluding the one with ID 1, and also all the continents from countries except for New Zealand?

SELECT Continent FROM continents WHERE "ContId" != 1 UNION ALL SELECT Continent FROM countries WHERE CountryName != "new zealand"


Question: Which aircraft IDs are greater than or equal to 1 in the aircraft table but not equal to 3 in the airport_aircraft table?

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


Question: Which driver IDs are less than 2, and which driver ID is 10, considering both drivers and school buses?

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


Question: What are the names and regions of clubs where the club ID is 2 and the club name isn't Helsingborgs IF, or the start year is before or equal to 2005? Also, include the names and regions of clubs where the club ID is greater than 1, or the start year is not 2005 and the region is Korea.

SELECT Club_name, Region FROM club WHERE "Club_ID" = 2 AND Club_name != "Helsingborgs IF" OR "Start_year" <= 2005 UNION SELECT Club_name, Region FROM club WHERE "Club_ID" > 1 OR "Start_year" <> 2005 AND Region = "Korea"


Question: What are the driver IDs greater than 1, and also the driver ID 9?

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


Question: What are the property type descriptions and codes for property types that are "Field" but not "House, Bungalow, etc.", excluding those that are "Shop"?

SELECT property_type_description, property_type_code FROM Ref_Property_Types WHERE property_type_code = "Field" AND property_type_description <> "House, Bungalow, etc." EXCEPT SELECT property_type_description, property_type_code FROM Ref_Property_Types WHERE property_type_code = "Shop"


Question: What are the driver IDs that are less than or equal to 7, excluding those driver IDs that are greater than 4 in the school bus records?

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


Question: What are the aircraft IDs greater than 3, excluding aircraft ID 5, considering only the 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: What are the driver IDs that are both equal to 3 in the driver table and not equal to 9 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 != 9


Question: What is the smallest branch ID from the branch table where the branch ID is greater than 8, or the opening year is not 2009, and the city is not London, and the membership amount is not 91, and the name is not Cochrane? Also, what is the smallest branch ID from the purchase table where the year is 2017, or the branch ID is 5, or the member ID is not 3, or the total pounds is less than 321.13?

SELECT MIN(Branch_ID) FROM branch WHERE "Branch_ID" > 8 OR Open_year <> "2009" AND City <> "London" AND membership_amount <> "91" AND Name != "Cochrane" UNION SELECT MIN(Branch_ID) FROM purchase WHERE Year = "2017" OR Branch_ID = "5" OR "Member_ID" <> 3 OR "Total_pounds" < 321.13


Question: What are the aircraft IDs that are either 3 or less than 5?

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


Question: Which driver IDs are less than or equal to 7, excluding driver ID 3, considering only the driver IDs present in the driver table?

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


Question: What are the driver IDs that are less than 10 in the driver table, combined with the driver IDs that are greater than 10 in 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: Which driver IDs are less than or equal to 11 but not present in the school bus table with driver IDs greater than or equal to 9?

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: What are the driver IDs that are greater than 5 in the driver table, combined with the driver IDs that are greater than or equal to 4 in the school bus table?

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


Question: Which driver IDs, excluding driver ID 10, are greater than 3?

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


Question: What are the driver IDs that are either 2 or 3?

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


Question: What is the minimum ID and the pilot's name from the airport and flight tables where the IATA code is BLL and the minimum altitude is not 3650, or the airport ID is not 1, or the airport name is Bergen Airport, or the minimum company ID is at least 11 and the country is Belgium, or the minimum velocity is not 240 and the date is October 25, 1963, or the city is Akureyri, or the pilot's name is not Thompson?

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


Question: What are the aircraft IDs, excluding ID 3, from the aircraft table, combined with the aircraft IDs, excluding ID 2, from the airport_aircraft table?

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


Question: What are the driver IDs, excluding driver ID 2, that are in the driver table but not in the school bus table, where the driver IDs in the school bus table are less than or equal to 4?

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


Question: What is the minimum aircraft ID and airport ID for aircraft, excluding those at airport 9, grouped by maximum gross weight, where the description is "Tandem rotor helicopter" and the aircraft is not "CH-47D Chinook" and the maximum disk loading is not "14.5 lb/ft² (71 kg/m²)" or the airport ID is less than 9?

SELECT MIN(T1.Aircraft_ID), T2.Airport_ID FROM aircraft as T1 JOIN airport_aircraft as T2 ON T1.Aircraft_ID = T2.Aircraft_ID WHERE "Airport_ID" <> 9 GROUP BY Max_Gross_Weight HAVING Description = "Tandem rotor helicopter" AND Aircraft <> "CH-47D Chinook" AND Max_disk_Loading <> "14.5 lb/ft² (71 kg/m²)" OR Airport_ID < 9


Question: What are the template details, average effective dates, sum of template type codes, average version numbers, and template IDs for templates with version number 4 and effective to dates not equal to October 28, 1976, and also for templates with IDs less than 7?

SELECT Template_Details, AVG(Date_Effective_From), SUM(Template_Type_Code), AVG(Version_Number), Template_ID FROM Templates WHERE "Version_Number" = 4 AND Date_Effective_To <> "1976-10-28 10:08:50" UNION ALL SELECT Template_Details, AVG(Date_Effective_From), SUM(Template_Type_Code), AVG(Version_Number), Template_ID FROM Templates WHERE "Template_ID" < 7


Question: What are the aircraft IDs, excluding aircraft ID 5, from the aircraft table, combined with aircraft IDs less than 1 from the airport_aircraft table?

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


Question: What are the continents listed in the 'continents' table where the continent ID is less than or equal to 1, combined with the continents from the 'countries' table where the country name is not "uk", the country ID is greater than or equal to 3, and the continent value is greater than or equal to 4?

SELECT Continent FROM continents WHERE "ContId" <= 1 UNION ALL SELECT Continent FROM countries WHERE CountryName <> "uk" AND "CountryId" >= 3 AND "Continent" >= 4


Question: What are the driver IDs that are both greater than or equal to 2 and less than or equal to 10, considering only those IDs present in both the driver and school bus tables?

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


Question: What are the names of employees whose employee ID is greater than or equal to 269734834 and are not Lisa Walker, or whose salary is greater than 152013, combined with the names of employees whose employee ID is greater than or equal to 287321212?

SELECT name FROM employee WHERE "eid" >= 269734834 AND name != "Lisa Walker" OR "salary" > 152013 UNION SELECT name FROM employee WHERE "eid" >= 287321212


Question: Which aircraft have ID 2, or which aircraft have ID 1?

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


Question: What are the driver IDs that are less than 11 and also greater than 4, considering only the driver IDs present in both the driver and school bus tables?

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


Question: What are the club IDs of clubs not in the USA that have a club ID of 6 or a club name that is not BK Häcken, combined with the club IDs from match results where Small_Silver is 4, or Bronze is less than 8 and Points is not 102, or Rank is 6, or Club_ID is greater than or equal to 1, or Big_Silver is not 14?

SELECT Club_ID FROM club WHERE Region <> "USA" AND "Club_ID" = 6 OR Club_name <> "BK Häcken" UNION SELECT Club_ID FROM match_result WHERE "Small_Silver" = 4 OR "Bronze" < 8 AND "Points" != 102 OR "Rank" = 6 OR "Club_ID" >= 1 OR "Big_Silver" != 14


Question: What are the feature type codes for features that are not "Pool", excluding those feature type codes associated with feature types that are not "Security, eg Burglar Alarm."?

SELECT feature_type_code FROM Other_Available_Features WHERE feature_name <> "Pool" EXCEPT SELECT feature_type_code FROM Ref_Feature_Types WHERE feature_type_name <> "Securiyt, eg Burglar Alarm."


Question: Which driver IDs are less than or equal to 3, excluding those with driver ID 7?

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


Question: What are the aircraft IDs that are not 3, and also have an ID greater than or equal to 5 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 >= 5


Question: What are the driver IDs greater than 3 that are not present in the school bus table with driver IDs less than 3?

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


Question: What are the driver IDs that are both less than 10 and also greater than or equal to 7, considering only driver IDs present in both the driver and school bus tables?

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


Question: What are the driver IDs, excluding driver ID 4, from the driver table, and also the driver IDs greater than 3 from the school bus table?

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


Question: What are the driver IDs, excluding driver ID 9, and also driver IDs greater than 9, from the driver and school bus tables?

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


Question: What are the driver IDs that are either 4 or higher, or greater than 7, considering both drivers and school buses?

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


Question: What is the average club name, club ID, location, and description for clubs that have a club ID other than 2, or a location that is not AKW, or a description that is not "Venture capital fund for student business.", and also for clubs that have a club ID of 1, or a location that is not AKW?

AVG(ClubName) ClubID ClubLocation ClubDesc

Refurbish computers; teach kids and adults about computer basics.

SELECT AVG(ClubName), ClubID, ClubLocation, ClubDesc FROM Club WHERE "ClubID" <> 2 OR ClubLocation != "AKW" OR ClubDesc != "Venture capital fund for student business." INTERSECT SELECT AVG(ClubName), ClubID, ClubLocation, ClubDesc FROM Club WHERE "ClubID" = 1 OR ClubLocation != "AKW"


Question: What are the driver IDs that are both less than 11 and also greater than or equal to 3, considering only the driver IDs present in both the driver and school bus tables?

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


Question: What are the names of employees whose ID is less than or equal to 242518965 and salary is less than 114323, or whose name is Betty Adams? Also, what are the names of employees who are not Chad Stewart, or whose ID is 90873519?

SELECT name FROM employee WHERE "eid" <= 242518965 AND "salary" < 114323 OR name = "Betty Adams" UNION SELECT name FROM employee WHERE name != "Chad Stewart" OR "eid" = 90873519


Question: What are the aircraft IDs that are not 3 and also have an ID of 5 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 = 5


Question: What are the driver IDs that are either less than or equal to 3 in the driver table or less than 7 in the school bus table?

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: What are the driver IDs that are either greater than or equal to 11 in the driver table or greater than 3 in the school bus table?

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


Question: Which driver IDs are present in both the driver table (with driver ID greater than or equal to 3) and the school bus table (with driver ID not equal to 10)?

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


Question: What are the aircraft IDs that are either less than or equal to 2, or greater than 2, considering both the aircraft and airport_aircraft tables?

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: What are the aircraft IDs, excluding aircraft ID 5, from the aircraft table, and also the aircraft IDs, excluding aircraft ID 2, from the airport_aircraft table?

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


Question: What are the aircraft IDs that are not 2 and also appear in the airport_aircraft table with an ID of 3?

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


Question: Which driver IDs are not 8 and are in the driver table, or which driver IDs are at least 4 and are in 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 >= 4


Question: What are the aircraft IDs that are less than 1, and also the aircraft IDs that are greater than 1, considering the aircraft and airport aircraft tables?

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


Question: Which driver IDs are either 2 or less than or equal to 4?

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


Question: What are the property type codes for properties that have other details not equal to "None", or an apt feature not equal to "fuga", or a sale date not equal to "1998-09-15 05:26:22", or an agreed selling price not equal to 4201.8, excluding those property type codes that are not "House"?

SELECT property_type_code FROM Properties WHERE other_property_details != "None" OR apt_feature_1 != "fuga" OR date_sold != "1998-09-15 05:26:22" OR "agreed_selling_price" != 4201.8 EXCEPT SELECT property_type_code FROM Ref_Property_Types WHERE property_type_code <> "House"


Question: How many students are in WAS or under 19, and what's the sum of their majors? Also, how many students are not StuID 1016 and not Jandy, or have advisor 8741, or are male and not 22, or have a major other than 600 and a last name of Han, and what's the sum of their majors?

SELECT COUNT(Fname), SUM(Major) FROM Student WHERE city_code = "WAS" OR "Age" < 19 UNION ALL SELECT COUNT(Fname), SUM(Major) FROM Student WHERE "StuID" != 1016 AND Fname != "Jandy" OR "Advisor" = 8741 OR Sex = "M" AND "Age" != 22 OR "Major" != 600 AND LName = "Han"


Question: What are the driver IDs that are less than 3 but not greater than 7?

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


Question: What are the count and minimum ID for car makers where the full name isn't Opel, the country isn't 1, the ID is 15 or greater, or the maker isn't gm, and also where the ID isn't 8 or the country isn't 6 and the full name isn't Opel?

SELECT COUNT(FullName), MIN(Id) FROM car_makers WHERE FullName != "Opel" OR Country <> "1" OR "Id" >= 15 OR Maker <> "gm" INTERSECT SELECT COUNT(FullName), MIN(Id) FROM car_makers WHERE "Id" <> 8 OR Country <> "6" AND FullName != "Opel"


Question: What is the sum of coach IDs, coach name, average rank, count of gender, and club ID for male coaches who are not in club 1 or whose name is not James Wong and whose coach ID is not 4 and rank is less than 4, excluding those who are not male and have a coach ID of 2 or more?

SELECT SUM(Coach_ID), Coach_name, AVG(Rank), COUNT(Gender), Club_ID FROM coach WHERE "Club_ID" != 1 AND Gender = "M" OR Coach_name != "James Wong" AND "Coach_ID" != 4 AND "Rank" < 4 EXCEPT SELECT SUM(Coach_ID), Coach_name, AVG(Rank), COUNT(Gender), Club_ID FROM coach WHERE Gender <> "M" AND "Coach_ID" >= 2


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


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

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


Question: What are the driver IDs greater than 10, and also any driver IDs from the school bus table that are not 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: What are the aircraft IDs that appear in both the aircraft and airport_aircraft tables, where the aircraft ID is 5 or greater?

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: Which driver IDs are in the driver table but not in the school bus table, excluding driver ID 1 from the driver table and driver IDs 10 and above 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 >= 10


Question: Which driver IDs, excluding ID 11, are present in both the driver and school bus records, excluding ID 9?

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


Question: Which driver IDs are either less than or equal to 5, or equal to 10, considering driver and school bus information?

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: What are the driver IDs that are present in both the driver table (excluding driver ID 7) and the school bus table (with driver ID 9)?

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


Question: What are the customer IDs of customers who meet at least one of the following conditions: their first name is Carole, their mobile phone number is 1-387-258-1016x96963, and their date of birth is 1988-09-19 14:45:56; or their phone number is not 1-875-045-0806; or their customer address ID is greater than or equal to 2; or their customer ID is greater than 3 and their email address is karina.carroll@example.net; or their last name is Spinka, their amount outstanding is 8144.0, their customer status code is not Good Customer, and their date became a customer is 2016-03-18 06:14:18; but exclude any customer IDs that are also associated with lessons where the lesson ID is greater than or equal to 9, or the price is not 199.0, or the customer ID is not 2 and the staff ID is not 12, or the lesson date is 2018-03-07 22:03:49?

SELECT customer_id FROM Customers WHERE first_name = "Carole" AND cell_mobile_phone_number = "1-387-258-1016x96963" AND date_of_birth = "1988-09-19 14:45:56" OR phone_number <> "1-875-045-0806" AND "customer_address_id" >= 2 OR "customer_id" > 3 AND email_address = "karina.carroll@example.net" OR last_name = "Spinka" AND "amount_outstanding" = 8144.0 AND customer_status_code <> "Good Customer" AND date_became_customer = "2016-03-18 06:14:18" EXCEPT SELECT customer_id FROM Lessons WHERE "lesson_id" >= 9 OR "price" <> 199.0 OR "customer_id" <> 2 AND "staff_id" <> 12 OR lesson_date = "2018-03-07 22:03:49"


Question: Which member IDs meet either of these conditions: their level is 6 or higher, or their name is not Jeremy Jarmon and their hometown is not Fort Campbell, Kentucky; or meet any of these conditions: their member ID is greater than 3, their branch ID is 6, or their registration year is not 2016?

SELECT Member_ID FROM member WHERE "Level" >= 6 OR Name != "Jeremy Jarmon" AND Hometown != "Fort Campbell, Kentucky" UNION ALL SELECT Member_ID FROM membership_register_branch WHERE "Member_ID" > 3 OR Branch_ID = "6" OR Register_Year != "2016"


Question: Which school IDs satisfy all of these conditions: they have a total budget percentage invested less than 2.0 and an invested amount less than 85249, or a budgeted amount not equal to 61283, or a school ID greater than or equal to 2 and a budget invested percentage not equal to 228.6, AND they also have a donor named Santiago and a school ID greater than or equal to 4?

SELECT School_id FROM budget WHERE "total_budget_percent_invested" < 2.0 AND "Invested" < 85249 OR "Budgeted" <> 61283 OR "School_id" >= 2 AND Budget_invested_percent <> "228.6" INTERSECT SELECT School_id FROM endowment WHERE donator_name = "Santiago" AND "School_id" >= 4


Question: What are the counts of assets, maximum profits, sales, and counts of headquarters for companies, excluding those with assets not equal to 302.6 and market value less than 294.7, or headquartered in the UK and in the Banking industry and with company ID 17, or with sales greater than 143.7? Group the results by sales, and only include groups where the count of assets is greater than 1, or the maximum profit is greater than 11.1, or the count of headquarters is less than 1. Then, exclude the results where the industry is not "Oil and gas" and profits are greater than 25.1, or the market value is greater than or equal to 79.5 and the company ID is greater than 10, or the assets are not equal to 209.5 and the headquarters is not in the USA and sales are greater than 433.5 and the company name is not "Walmart". Group these excluded results by sales, and only include groups where the count of assets is not 1 and the count of headquarters is less than or equal to 1.

SELECT COUNT(Assets_in_Billion), MAX(Profits_in_Billion), Sales_in_Billion, COUNT(Headquarters) FROM company WHERE "Assets_in_Billion" <> 302.6 AND "Market_Value_in_Billion" < 294.7 OR Headquarters = "UK" AND Industry = "Banking" AND "Company_ID" = 17.0 OR "Sales_in_Billion" > 143.7 GROUP BY Sales_in_Billion HAVING COUNT(Assets_in_Billion) > 1 OR MAX(Profits_in_Billion) > 11.1 OR COUNT(Headquarters) < 1 EXCEPT SELECT COUNT(Assets_in_Billion), MAX(Profits_in_Billion), Sales_in_Billion, COUNT(Headquarters) FROM company WHERE Industry <> "Oil and gas" AND "Profits_in_Billion" > 25.1 OR "Market_Value_in_Billion" >= 79.5 AND "Company_ID" > 10.0 OR "Assets_in_Billion" != 209.5 AND Headquarters <> "USA" AND "Sales_in_Billion" > 433.5 AND Name <> "Walmart" GROUP BY Sales_in_Billion HAVING COUNT(Assets_in_Billion) <> 1 AND COUNT(Headquarters) <= 1


Question: Which driver IDs are equal to 5, or less than 3?

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


Question: What are the driver IDs, excluding driver ID 4, and also the driver IDs greater than 4, from the driver and school bus tables?

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: What are the aircraft IDs that are both less than or equal to 5 and also greater than or equal to 3, considering only aircraft IDs present in both the aircraft and airport_aircraft tables?

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


Question: What are the aircraft IDs that are not 1 and are present in the aircraft table but not in the airport_aircraft table where the aircraft ID is 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: What are the driver IDs that are less than 4, excluding those that are not equal to 9 in the school bus records?

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: What are the driver IDs that are equal to 10 but not less than 9, considering driver IDs from the driver table and 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 < 9


Question: What is the highest lesson ID, considering lessons where the staff ID isn't 11 and the price is at least 456, or where the lesson ID is less than 12, or where the customer ID isn't 8? Also, what is the highest lesson ID for lessons where the vehicle ID is less than 1 and the customer ID is at most 2, or where the lesson status isn't "Cancelled"?

SELECT MAX(lesson_id) FROM Lessons WHERE "staff_id" <> 11 AND "price" >= 456.0 AND "lesson_id" < 12 OR "customer_id" <> 8 UNION ALL SELECT MAX(lesson_id) FROM Lessons WHERE "vehicle_id" < 1 AND "customer_id" <= 2 OR lesson_status_code <> "Cancelled"


Question: What are the payment methods, minimum payment amounts, earliest payment dates, and maximum customer IDs for payments that are not Direct Debit and either belong to customer 10 or have an amount greater than or equal to 6970.98, or were made on March 12, 2018 at 1:31:36 PM?

SELECT payment_method_code, MIN(amount_payment), MIN(datetime_payment), MAX(customer_id) FROM Customer_Payments WHERE payment_method_code <> "Direct Debit" AND "customer_id" = 10 OR "amount_payment" >= 6970.98 UNION SELECT payment_method_code, MIN(amount_payment), MIN(datetime_payment), MAX(customer_id) FROM Customer_Payments WHERE payment_method_code <> "Direct Debit" AND datetime_payment = "2018-03-12 13:31:36"


Question: What is the sum of feature type codes from the 'Other_Available_Features' table where the feature type code is not "Amenity", or the feature name is not "BurglarAlarm", or the feature description is not "Air Conditioning." and the feature ID is greater than 3, intersected with the sum of feature type codes from the 'Ref_Feature_Types' table where the feature type name is not "Securiyt, eg Burglar Alarm." or the feature type code is not "Amenity"?

SELECT SUM(feature_type_code) FROM Other_Available_Features WHERE feature_type_code != "Amenity" OR feature_name != "BurglarAlarm" OR feature_description != "Air Conditioning." AND "feature_id" > 3 INTERSECT SELECT SUM(feature_type_code) FROM Ref_Feature_Types WHERE feature_type_name != "Securiyt, eg Burglar Alarm." OR feature_type_code != "Amenity"


Question: What are the driver IDs greater than 11 from the driver table, combined with the driver IDs greater than 3 from the school bus table?

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


Question: What are the document IDs from draft documents that don't have "x" as draft details, combined with the document IDs from documents that don't have a receipt date of "1996-05-31 06:51:58"?

SELECT document_id FROM Document_Drafts WHERE draft_details <> "x" UNION ALL SELECT document_id FROM Documents WHERE receipt_date <> "1996-05-31 06:51:58"


Question: What are the IDs of airports that are not in Anchorage, Norway, or with ICAO code ENBR, and also IDs of flights where the pilot is not Peterson, the flight ID is not 12, the flight number is not M2-F1 #71, the date is not March 30, 1964, the airport ID is not 9, the altitude is not at least 3650.0, and the company ID is not greater than 6?

SELECT id FROM airport WHERE IATA != "ANC" OR Country <> "Norway" OR City != "Anchorage" OR ICAO <> "ENBR" INTERSECT SELECT id FROM flight WHERE Pilot != "Peterson" OR "id" != 12 OR Vehicle_Flight_number <> "M2-F1 #71" OR Date <> "March 30, 1964" OR "airport_id" != 9 OR "Altitude" >= 3650.0 OR "company_id" > 6


Question: Which driver IDs are less than 11, and also include driver ID 9?

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