Question: Can you list the ranks from match results where the gold score is greater than 12 or the big silver score is 7, and also list the ranks of all female players except for Ross Eadie?

SELECT Rank FROM match_result WHERE "Gold" > 12 OR "Big_Silver" = 7 UNION ALL SELECT Rank FROM player WHERE Gender = "F" AND Player_name <> "Ross Eadie"


Question: What is the difference between the sum of the IDs of artists named "Aerosmith & Sierra Leone's Refugee Allstars" and the sum of the IDs of employees where the ID is less than or equal to 8, or who meet a complex set of criteria based on their fax number, last name, first name, postal code, email, state, reports_to value, phone number, title, city, address, country, and birth date?

SELECT SUM(id) FROM artists WHERE name = "Aerosmith & Sierra Leone's Refugee Allstars" EXCEPT SELECT SUM(id) FROM employees WHERE "id" <= 8 OR fax = "+1 (403) 456-8485" AND last_name <> "Adams" OR first_name <> "Jane" AND postal_code != "T3B 0C5" AND email != "andrew@chinookcorp.com" OR state != "AB" AND "reports_to" > 6.0 OR phone != "+1 (403) 262-3443" AND title = "IT Staff" AND city <> "Lethbridge" OR address = "1111 6 Ave SW" AND country = "Canada" AND birth_date = "1947-09-19 00:00:00"


Question: Can you show me the final table appearances, earnings, best finish, average money rank, and player ID for poker players, excluding those with earnings of $189,233, a money rank of 166 or higher, or a player ID of 3, but then remove any players who have a people ID of 2 or higher, a best finish better than 3, earnings less than $104,871, final table appearances of 42 or fewer, or a player ID less than 5?

SELECT Final_Table_Made, Earnings, Best_Finish, AVG(Money_Rank), Poker_Player_ID FROM poker_player WHERE "Earnings" <> 189233.0 AND "Money_Rank" < 166.0 AND "Poker_Player_ID" <> 3 EXCEPT SELECT Final_Table_Made, Earnings, Best_Finish, AVG(Money_Rank), Poker_Player_ID FROM poker_player WHERE "People_ID" >= 2 OR "Best_Finish" > 3.0 AND "Earnings" < 104871.0 OR "Final_Table_Made" <= 42.0 OR "Poker_Player_ID" < 5


Question: Can you give me a list of aircraft IDs less than 4 that appear in the aircraft table, excluding those aircraft IDs less than 3 that appear in the airport_aircraft table?

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


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

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


Question: Can you give me a list of album IDs that are less than 142, along with the ID of any playlist named "Heavy Metal Classic"?

SELECT id FROM albums WHERE "id" < 142 UNION ALL SELECT id FROM playlists WHERE name = "Heavy Metal Classic"


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

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


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


Question: Can you give me the driver ID of drivers with ID 11, excluding any driver IDs from the school bus table that are not 9?

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


Question: Can you give me a list of driver IDs that are both not equal to 5, and also greater than or equal to 10?

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


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

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


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

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


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

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


Question: Can you give me the IDs of drivers, where each ID is less than 2, excluding any driver IDs that are also in the school bus list where those IDs are greater than 9?

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


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


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

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


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

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


Question: Can you give me a list of driver IDs, combining those from the driver table that aren't 3 with those from the school bus table that are greater than 3?

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


Question: Can you give me the driver ID of drivers with ID 10, excluding any driver IDs less than or equal to 7 that are also school bus drivers?

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


Question: Can you give me a list of driver IDs that are not 9 and are also less than 7, considering only drivers who are in both the driver and school bus records?

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


Question: Can you give me a list of driver IDs that are less than 12 from the driver table, combined with a list of driver IDs that are exactly 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 all employee IDs from the certificate table, and also all employee IDs from the employee table, but exclude employee ID 269734834 from the certificate table and employees named Robert Brown from the employee table?

SELECT eid FROM certificate WHERE "eid" != 269734834 UNION ALL SELECT eid FROM employee WHERE name != "Robert Brown"


Question: Can you give me a list of all driver IDs, excluding driver ID 11 from the driver table and excluding driver ID 7 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 <> 7


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

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


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

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


Question: What is the average airport ID associated with each aircraft ID?

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


Question: What are the total number of stores and the sum of district IDs, first considering only stores that are not store ID 2 or are in district ID 3, and then separately considering only stores with a store ID greater than 2?

SELECT COUNT(Store_ID), SUM(District_ID) FROM store_district WHERE "Store_ID" != 2 OR "District_ID" = 3 UNION SELECT COUNT(Store_ID), SUM(District_ID) FROM store_district WHERE "Store_ID" > 2


Question: Can you give me a list of School IDs from the budget table where either the budgeted amount is less than 6803 and the year is after 1999, or the invested amount is exactly 146102, or the budget invested percentage is not equal to 159.3 and the School ID is greater than 2, combined with a list of School IDs from the endowment table where the amount is not 9.05, or the School ID is 8 or greater, or the donator name is "La Vega", or the endowment ID is not 4?

SELECT School_id FROM budget WHERE "Budgeted" < 6803 AND "Year" > 1999 OR "Invested" = 146102 OR Budget_invested_percent <> "159.3" AND "School_id" > 2 UNION ALL SELECT School_id FROM endowment WHERE "amount" != 9.05 OR "School_id" >= 8 OR donator_name = "La Vega" OR "endowment_id" != 4


Question: Can you give me a list of driver IDs, excluding driver ID 2 from the driver table and driver ID 4 from the school_bus table, making sure to list each driver ID only once?

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


Question: What is the highest Book ID for books written by Dave Gibbons, excluding Book ID 7, with more than 12 issues, and not titled "Cyberella", combined with the highest Book ID from publications where the Publication ID is 1 or the Book ID is 9 or greater?

SELECT MAX(Book_ID) FROM book WHERE Writer = "Dave Gibbons" AND "Book_ID" != 7 AND "Issues" > 12.0 AND Title != "Cyberella" UNION SELECT MAX(Book_ID) FROM publication WHERE "Publication_ID" = 1 OR "Book_ID" >= 9


Question: Can you give me a list of driver IDs that are less than 4, excluding any driver IDs that are not 7 and are also found 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 != 7


Question: Can you list the votes, occupation, gender, rank, and player name for all players who either have 8734 or fewer votes, or have a Player ID less than 12 and are not a "Product Consultant - MLCC", combined with a list of players who either live in Selkirk, have a sponsor name other than "Dauphin—Swan River—Marquette", are named "Patricia Cordner", or have more than 14097 votes and are not "Retired"?

Votes Occupation Gender Rank Player_name

SELECT Votes, Occupation, Gender, Rank, Player_name FROM player WHERE "Votes" <= 8734 OR "Player_ID" < 12 AND Occupation <> "Product Consultant - MLCC" UNION ALL SELECT Votes, Occupation, Gender, Rank, Player_name FROM player WHERE Residence = "Selkirk" OR Sponsor_name != "Dauphin—Swan River—Marquette" OR Player_name = "Patricia Cordner" OR "Votes" > 14097 AND Occupation != "Retired"


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

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


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

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


Question: Could you list the document IDs and draft numbers from the circulation history for entries where the copy number is 10 or higher, or the document ID is less than 2, combined with the document IDs and draft numbers from the document drafts where the draft details are not "b" and the document ID is 7 or higher?

SELECT document_id, draft_number FROM Circulation_History WHERE "copy_number" >= 10 OR "document_id" < 2 UNION ALL SELECT document_id, draft_number FROM Document_Drafts WHERE draft_details != "b" AND "document_id" >= 7


Question: Can you give me a list of student IDs from the Has_Pet table, including those where the student ID is not 1001 or the pet ID is less than or equal to 2002, combined with a list of student IDs from the Student table where the city code is not HKG, the sex is not M, the first name is not Ian, the age is less than or equal to 20, or the last name is not Andreou, and the major is greater than 520, the student ID is greater than 1014, and the advisor is less than 8423?

SELECT StuID FROM Has_Pet WHERE "StuID" != 1001 OR "PetID" <= 2002 UNION ALL SELECT StuID FROM Student WHERE city_code != "HKG" OR Sex <> "M" OR Fname != "Ian" OR "Age" <= 20 OR LName != "Andreou" AND "Major" > 520 AND "StuID" > 1014 AND "Advisor" < 8423


Question: Can you list all the property feature descriptions where the property ID is not 6, or the feature ID is less than or equal to 2, or the description is "illo", and also include all property feature descriptions that are "modi" or where the property ID is not 7?

SELECT property_feature_description FROM Other_Property_Features WHERE "property_id" != 6 OR "feature_id" <= 2 OR property_feature_description = "illo" UNION ALL SELECT property_feature_description FROM Other_Property_Features WHERE property_feature_description = "modi" OR "property_id" != 7


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

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


Question: Can you give me a list of driver IDs, including driver ID 4 from the driver table, and all driver IDs except 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: Can you give me a list of driver IDs, including those greater than 8 from the driver table, and those not equal to 10 from the school bus table?

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


Question: Can you give me a list of employee IDs, combining those from employees who are 29 or younger and live in Bath, or whose name isn't Andrew Sheridan, with those from evaluations awarded in years other than 2011, or belonging to an employee ID other than 7, or with a bonus less than 4000?

SELECT Employee_ID FROM employee WHERE "Age" <= 29 AND City = "Bath" OR Name != "Andrew Sheridan" UNION SELECT Employee_ID FROM evaluation WHERE Year_awarded <> "2011" OR Employee_ID != "7" OR "Bonus" < 4000.0


Question: Can you give me a list of aircraft IDs that are less than 5, excluding any aircraft IDs greater than 3 that are also listed in the airport aircraft table?

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


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

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


Question: Can you give me a list of driver IDs, including those from the driver table that are less than 6, and those from the school_bus table that are greater than 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: Can you give me the Driver IDs that appear exactly as '2' in the driver table, excluding any Driver IDs that are '4' or greater in the school_bus table?

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


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

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


Question: Which aircraft have an ID of 1 and are also associated with airports, but not with an airport that has an ID of 2?

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


Question: Which aircraft have an ID of 2 and are also associated with airports having an aircraft ID greater than 1?

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


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

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


Question: Which driver IDs are both equal to 3 and 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: Can you give me a list of aircraft IDs from the aircraft table that are greater than or equal to 2, excluding any aircraft IDs from the airport_aircraft table that are less than 5?

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


Question: Can you give me a list of driver IDs, including those with ID 3 from the driver table and those with IDs up to 10 from 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 <= 10


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

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


Question: What is the difference between the total employee ID from the certificate table, excluding those with an aid of 14, and the total employee ID from the employee table where the salary is less than 43723 and the employee ID is greater than or equal to 574489457, or the employee's name is Dorthy Lewis?

SELECT SUM(eid) FROM certificate WHERE "aid" != 14 EXCEPT SELECT SUM(eid) FROM employee WHERE "salary" < 43723 AND "eid" >= 574489457 OR name = "Dorthy Lewis"


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

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


Question: Can you list all the aircraft IDs, including those with ID 4 from the aircraft table and those with IDs of 1 or greater from the airport_aircraft table?

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


Question: Can you list all the years worked for companies with an ID less than 13, and also list all the years worked when the person's ID is 1 and they worked for at least 2 years?

SELECT Year_working FROM employment WHERE "Company_ID" < 13 UNION ALL SELECT Year_working FROM employment WHERE "People_ID" = 1 AND "Year_working" >= 2


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

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


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

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


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

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


Question: What are the average feature type code, the sum of feature IDs, and the earliest feature name for features named "AirCon" with a feature ID of 3 and a feature description that is not "Burglar Alarm", excluding the average feature type code, sum of feature IDs, and earliest feature name for features that don't have a feature type code of "Amenity"?

SELECT AVG(feature_type_code), SUM(feature_id), MIN(feature_name) FROM Other_Available_Features WHERE feature_name = "AirCon" AND "feature_id" = 3 AND feature_description <> "Burglar Alarm" EXCEPT SELECT AVG(feature_type_code), SUM(feature_id), MIN(feature_name) FROM Other_Available_Features WHERE feature_type_code != "Amenity"


Question: Can you list the student IDs and pet IDs for all students with IDs less than or equal to 1002, including those with IDs less than or equal to 1001?

SELECT StuID, PetID FROM Has_Pet WHERE "StuID" <= 1001 UNION SELECT StuID, PetID FROM Has_Pet WHERE "StuID" <= 1002


Question: Could you list the zip codes and populations for counties that meet either of these conditions: the county is not Baltimore County, the zip code is not D08, the population is no more than 79,000, and the county ID is 5; or the zip code is not D09 and the county ID is less than 3?

SELECT Zip_code, Population FROM county WHERE County_name != "Baltimore County" AND Zip_code != "D08" AND "Population" <= 79000.0 AND "County_Id" = 5 UNION ALL SELECT Zip_code, Population FROM county WHERE Zip_code != "D09" AND "County_Id" < 3


Question: Can you give me a list of aircraft IDs, excluding aircraft ID 5, that are present in the aircraft table but not in the airport_aircraft table where the aircraft ID is 1?

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


Question: Can you give me a list of driver IDs, excluding driver ID 1, that are not also driver IDs, excluding driver ID 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: Which driver IDs are both greater than 6 and not equal to 10?

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


Question: Can you list all property type codes and descriptions, including those that aren't 'Shop' and those that aren't 'Apartment'?

SELECT property_type_code, property_type_description FROM Ref_Property_Types WHERE property_type_code != "Shop" UNION SELECT property_type_code, property_type_description FROM Ref_Property_Types WHERE property_type_code <> "Apartment"


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

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


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

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


Question: What role codes are both associated with employees whose other details are not "b" or whose employee ID is at least 3 and whose name is "Koby" and whose role code is not "MG", and also associated with roles that are described as "Editor" or have the role code "PR"?

SELECT role_code FROM Employees WHERE other_details <> "b" OR "employee_id" >= 3 AND employee_name = "Koby" AND role_code != "MG" INTERSECT SELECT role_code FROM Roles WHERE role_description = "Editor" OR role_code = "PR"


Question: Can you give me a list of shipping agent codes, including those from documents where the other details aren't "q", the shipping agent code is "FE", the receipt number isn't "79", and the receipt date isn't "2015-04-03 09:36:19", as well as those from the shipping agents reference table where the shipping agent description isn't "q"?

SELECT shipping_agent_code FROM Documents WHERE other_details <> "q" AND shipping_agent_code = "FE" AND receipt_number != "79" AND receipt_date != "2015-04-03 09:36:19" UNION SELECT shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_description != "q"


Question: Which driver IDs are both less than 8 and also equal to 3?

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


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

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


Question: How many books are there if we count books where the book ID is 1 or greater, the publisher isn't Thomson Reuters, the publication ID isn't 4, or the publication date isn't June 2006, and then combine that count with the count of books where the book ID is greater than 5, the publisher isn't Wiley, or the publication date isn't August 2008 and the publication ID is 7?

SELECT COUNT(Book_ID) FROM publication WHERE "Book_ID" >= 1 OR Publisher <> "Thomson Reuters" OR "Publication_ID" != 4 OR Publication_Date != "June 2006" UNION SELECT COUNT(Book_ID) FROM publication WHERE "Book_ID" > 5 OR Publisher != "Wiley" OR Publication_Date <> "August 2008" AND "Publication_ID" = 7


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

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


Question: Can you give me a list of email addresses from our customer database, including those who were born on February 7, 1993, at 5:40 AM, or aren't marked as "Bad Customer," or have an outstanding amount of \$9447 or less and aren't named Mertz, or have a customer ID of 15 and a cell phone number other than 1-401-108-8016x078 and a phone number other than 374-483-2758x85087, as well as those who have a phone number other than (729)396-4354x3576 and an email address other than afranecki@example.com, or a customer address ID greater than 10 and aren't marked as "Bad Customer," or were born on August 30, 1996, at 6:17 AM and didn't become a customer on October 5, 2017, at 2:15 PM, or are named Tromp, or have a first name of Omer and a customer ID other than 11 and a cell phone number other than 1-197-686-2849x8761 and an outstanding amount other than \$7256?

SELECT email_address FROM Customers WHERE date_of_birth = "1993-02-07 05:40:26" OR customer_status_code <> "Bad Customer" OR "amount_outstanding" <= 9447.0 AND last_name <> "Mertz" OR "customer_id" = 15 AND cell_mobile_phone_number <> "1-401-108-8016x078" AND phone_number <> "374-483-2758x85087" UNION ALL SELECT email_address FROM Customers WHERE phone_number <> "(729)396-4354x3576" AND email_address <> "afranecki@example.com" OR "customer_address_id" > 10 AND customer_status_code <> "Bad Customer" OR date_of_birth = "1996-08-30 06:17:50" AND date_became_customer != "2017-10-05 14:15:46" OR last_name = "Tromp" OR first_name = "Omer" AND "customer_id" <> 11 AND cell_mobile_phone_number <> "1-197-686-2849x8761" AND "amount_outstanding" <> 7256.0


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

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


Question: Can you give me a list of Book IDs from the book table where the number of issues is 4, combined with a list of Book IDs from the publication table where the Book ID is not 4, the Publication ID is less than 2, and the Publication Date is not March 2008?

SELECT Book_ID FROM book WHERE "Issues" = 4.0 UNION ALL SELECT Book_ID FROM publication WHERE "Book_ID" <> 4 AND "Publication_ID" < 2 AND Publication_Date <> "March 2008"


Question: Can you list all copy numbers from the circulation history where the employee ID is 2 or greater, or the document ID is less than 20 and the draft number is not 20, combined with all copy numbers from the draft copies where the document ID is 4, or the draft number is not 17 and the copy number is greater than 10?

SELECT copy_number FROM Circulation_History WHERE "employee_id" >= 2 OR "document_id" < 20 AND "draft_number" != 20 UNION ALL SELECT copy_number FROM Draft_Copies WHERE "document_id" = 4 OR "draft_number" != 17 AND "copy_number" > 10


Question: Could you give me the student IDs that are both for students with a grass pollen allergy and whose ID is 1016 or greater, and also for students who either don't have the first name Dinesh, are not 19 years old, or are not male?

SELECT StuID FROM Has_Allergy WHERE Allergy = "Grass Pollen" AND "StuID" >= 1016 INTERSECT SELECT StuID FROM Student WHERE Fname != "Dinesh" AND "Age" != 19 OR Sex <> "M"


Question: Which aircraft IDs are not equal to 3 and are also greater than or equal to 3 when considering aircraft at airports?

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


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

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


Question: Could you give me a list of shop IDs for shops that have 3516 products, as well as shop IDs for shops located in Valkeakoski or not in the Finnair Stadium district?

SELECT Shop_ID FROM shop WHERE "Number_products" = 3516 UNION ALL SELECT Shop_ID FROM shop WHERE Location = "Valkeakoski" OR District != "Finnair Stadium"


Question: Could you please provide the last name, first name, and date of birth for customers who either have a customer address ID of 1 or greater, an amount outstanding that is not 2255.0, a cell phone number that is not 739-333-6966x187, a date of birth that is not 1993-02-07 05:40:26, or a customer status code that is not "Bad Customer", along with the last name, first name, and date of birth for staff members who have a staff ID greater than 14, left staff on a date other than 2018-03-08 04:23:14, and have a middle name of Clarabelle?

SELECT last_name, first_name, date_of_birth FROM Customers WHERE "customer_address_id" >= 1 AND "amount_outstanding" <> 2255.0 OR cell_mobile_phone_number <> "739-333-6966x187" OR date_of_birth != "1993-02-07 05:40:26" OR customer_status_code != "Bad Customer" UNION SELECT last_name, first_name, date_of_birth FROM Staff WHERE "staff_id" > 14 AND date_left_staff != "2018-03-08 04:23:14" AND middle_name = "Clarabelle"


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

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


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

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


Question: Can you give me the IDs from the car makers table where the country code is "3" or the full name isn't "Citroen" and the maker isn't "chrysler", combined with the IDs from the cars data table where the acceleration is greater than 16.8, or the horsepower isn't "90" and the ID isn't 238, or the number of cylinders is greater than 4 and the MPG is "18" and the weight isn't 2795, or the year isn't 1982, or the engine displacement is greater than or equal to 304.0?

SELECT Id FROM car_makers WHERE Country = "3" OR FullName <> "Citroen" AND Maker <> "chrysler" UNION ALL SELECT Id FROM cars_data WHERE "Accelerate" > 16.8 OR Horsepower != "90" AND "Id" != 238 OR "Cylinders" > 4 AND MPG = "18" AND "Weight" != 2795 OR "Year" != 1982 OR "Edispl" >= 304.0


Question: What are the total target user IDs and corresponding source user IDs from the trust table, excluding cases where the trust value is 10, except for those where the target user ID is at least 2, the trust value is less than 3, and the source user ID is less than 7?

SELECT SUM(target_u_id), source_u_id FROM trust WHERE "trust" != 10 EXCEPT SELECT SUM(target_u_id), source_u_id FROM trust WHERE "target_u_id" >= 2 AND "trust" < 3 AND "source_u_id" < 7


Question: Can you give me a list of aircraft IDs, excluding aircraft ID 2, that are not present in the list of aircraft IDs less than or equal to 3 found in the airport aircraft table?

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


Question: Can you give me a list of school IDs, including those from schools that don't have an enrollment of 620, and also those from the endowment table where the endowment ID isn't 7 and the school ID isn't 8, or where the amount is greater than 8.53?

SELECT School_id FROM School WHERE "Enrollment" != 620 UNION SELECT School_id FROM endowment WHERE "endowment_id" != 7 AND "School_id" <> 8 OR "amount" > 8.53


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

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


Question: Can you list all the driver IDs that are less than 5 from the driver table, and combine that with a list of all 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: Can you give me a list of driver IDs that are less than 9, excluding driver ID 7, considering each driver ID only once?

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


Question: Could you list the driver IDs that are both greater than or equal to 1 and less than or equal to 10, considering only the unique driver IDs from both the driver and school bus tables?

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


Question: Which driver IDs are found in both the driver list excluding driver 6 and the school bus list excluding driver 7?

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


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

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


Question: Could you tell me the maximum aircraft ID and corresponding distance for aircraft with a distance greater than 8430 or an ID not equal to 14, combined with the maximum aircraft ID and distance for flights arriving on dates other than December 4th, 2005 at 11:10 AM?

SELECT distance, MAX(aid) FROM aircraft WHERE "distance" > 8430 OR "aid" != 14 UNION ALL SELECT distance, MAX(aid) FROM flight WHERE arrival_date != "04/12/2005 11:10"


Question: Can you list the Publication ID, Price, Book ID, and Publisher for all publications where either the Publication Date is not March 2007 and the Price is at least 2,000,000, or the Book ID is less than 3, combined with the Publication ID, Price, Book ID, and Publisher for publications where the Book ID is 4, the Publisher is not Bertelsmann, the Publication ID is less than 5, and the Price is exactly 2,000,000?

SELECT Publication_ID, Price, Book_ID, Publisher FROM publication WHERE Publication_Date != "March 2007" AND "Price" >= 2000000.0 OR "Book_ID" < 3 UNION SELECT Publication_ID, Price, Book_ID, Publisher FROM publication WHERE "Book_ID" = 4 AND Publisher <> "Bertelsmann" AND "Publication_ID" < 5 AND "Price" = 2000000.0


Question: Can you give me the template ID, the highest document ID, and the count of other details from the documents table, first for documents where the other details are not "None" and either the template ID is 25 or the document name is "Robbin CV" and the document ID is not 80, and then combined with the template ID, highest document ID, and count of other details for documents where the document description is not "n" or the other details are not "None" and the document ID is 80 or the template ID is 14 or greater?

SELECT Template_ID, MAX(Document_ID), COUNT(Other_Details) FROM Documents WHERE Other_Details <> "None" AND "Template_ID" = 25 OR Document_Name = "Robbin CV" AND "Document_ID" <> 80 UNION SELECT Template_ID, MAX(Document_ID), COUNT(Other_Details) FROM Documents WHERE Document_Description != "n" OR Other_Details <> "None" AND "Document_ID" = 80 OR "Template_ID" >= 14


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

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


Question: Can you give me a list of driver IDs, including those from the driver table where the ID is not 9, and those from the school_bus table where the ID is 3 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 >= 3


Question: Can you give me a list of driver IDs, excluding driver ID 11, that are not also driver IDs less than or equal to 9 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 <= 9


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


Question: Can you give me the lowest occupation and residence, player name, highest votes and rank, and player ID for Fiona Shiells, a retired player who is not male, has 4673 votes, and is not player ID 9, excluding those that are female and not ranked 3rd, or have 5502 or fewer votes, or are not sponsored by Kildonan-St. Paul, or don't reside in Birtle, or are not Jim Maloway, or are not player ID 5, or are not a small businessman?

MIN(Occupation) MIN(Residence) Player_name MAX(Votes) Player_ID MAX(Rank)

SELECT MIN(Occupation), MIN(Residence), Player_name, MAX(Votes), Player_ID, MAX(Rank) FROM player WHERE Gender != "M" AND "Votes" = 4673 AND "Player_ID" <> 9 AND Player_name = "Fiona Shiells" AND Occupation = "Retired" EXCEPT SELECT MIN(Occupation), MIN(Residence), Player_name, MAX(Votes), Player_ID, MAX(Rank) FROM player WHERE Gender = "F" AND Rank != "3rd" OR "Votes" <= 5502 OR Sponsor_name != "Kildonan—St. Paul" OR Residence <> "Birtle" OR Player_name != "Jim Maloway" AND "Player_ID" <> 5 OR Occupation != "Small Businessman"


Question: Which driver IDs are not equal to 4 and appear in the driver table, and are also not equal to 7 and appear in 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 maximum People ID, minimum Graduation College, average Nationality, count of Ages, and Names for people who graduated from Northeastern, combined with the same information for people who are not 25 years old or whose name is not Jerry Corcoran and whose nationality is not United States or who did not graduate from Northeastern?

SELECT MAX(People_ID), MIN(Graduation_College), AVG(Nationality), COUNT(Age), Name FROM people WHERE Graduation_College = "Northeastern" UNION SELECT MAX(People_ID), MIN(Graduation_College), AVG(Nationality), COUNT(Age), Name FROM people WHERE "Age" != 25 OR Name != "Jerry Corcoran" AND Nationality <> "United States" OR Graduation_College <> "Northeastern"


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

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


Question: Can you give me a list of driver IDs, combining those from the driver table excluding driver ID 7, and those from the school bus table excluding driver ID 3?

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


Question: Which aircraft IDs are both less than or equal to 5 when considering all aircraft, and also less than 2 when considering aircraft at airports?

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


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

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


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

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


Question: Can you give me a list of member IDs for members with a level less than 6 or a member ID less than 1, combined with a list of member IDs from purchases made in 2017 at branches other than branch 1?

SELECT Member_ID FROM member WHERE "Level" < 6 OR "Member_ID" < 1 UNION SELECT Member_ID FROM purchase WHERE Year = "2017" AND Branch_ID != "1"


Question: Can you give me the average school ID, amount, average endowment ID, and donator name from the endowment table, combining results where either the school ID is greater than 3, or the amount is at least 9.05, the donator name is not "Santo Domingo Este", and the endowment ID is greater than 4, with results where either the endowment ID is less than 2 or the school ID is 6?

SELECT AVG(School_id), amount, AVG(endowment_id), donator_name FROM endowment WHERE "School_id" > 3 OR "amount" >= 9.05 AND donator_name <> "Santo Domingo Este" AND "endowment_id" > 4 UNION SELECT AVG(School_id), amount, AVG(endowment_id), donator_name FROM endowment WHERE "endowment_id" < 2 OR "School_id" = 6


Question: Can you list the ranks from the match results where the rank is 6 or lower, combined with the ranks from the player information where either the votes are less than 4673, or the residence is Birtle and the occupation isn't retired and the sponsor name isn't Elmwood—Transcona, or the rank isn't 2nd and the gender isn't male, or the player ID isn't 14, or the player name is Matt Schaubroeck?

SELECT Rank FROM match_result WHERE "Rank" <= 6 UNION ALL SELECT Rank FROM player WHERE "Votes" < 4673 OR Residence = "Birtle" AND Occupation != "Retired" AND Sponsor_name != "Elmwood—Transcona" OR Rank <> "2nd" AND Gender <> "M" OR "Player_ID" <> 14 OR Player_name = "Matt Schaubroeck"


Question: What is the average continent value, excluding Australia, and the average continent value for the UK?

SELECT AVG(Continent) FROM continents WHERE Continent <> "australia" UNION SELECT AVG(Continent) FROM countries WHERE CountryName = "uk"


Question: Can you give me the ID, name, IATA code, ICAO code, and country for all airports that either aren't named "El Prat Airport", or don't have an IATA code of "BWI" but are in Barcelona, or don't have an ICAO code of "EKBI" and aren't in Norway and have an ID of 4, combined with the ID, name, IATA code, ICAO code, and country for all airports that either don't have an IATA code of "BRU", or aren't named "National Airport", or aren't in Boston and have an ID of 3 or greater, or have an ICAO code of "EBBR", or aren't in Denmark?

3
Ted Stevens Airport
ANC
PANC
United States

4
Baltimore-Washington Airport
BWI
KBWI
United States

8
Logan International Airport
BOS
KBOS
United States

SELECT id, name, IATA, ICAO, Country FROM airport WHERE name != "El Prat Airport" OR IATA != "BWI" AND City = "Barcelona" OR ICAO <> "EKBI" AND Country <> "Norway" AND "id" = 4 UNION SELECT id, name, IATA, ICAO, Country FROM airport WHERE IATA != "BRU" OR name != "National Airport" OR City <> "Boston" AND "id" >= 3 OR ICAO = "EBBR" OR Country != "Denmark"


Question: Can you give me a list of aircraft IDs that are greater than or equal to 4, excluding any aircraft IDs greater than or equal to 3 that are also found in the airport aircraft list?

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


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

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


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

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


Question: Which driver IDs, excluding driver ID 3, are also driver IDs greater than 7 used by school buses?

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


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

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


Question: Can you give me a list of driver IDs that are less than or equal to 4 from the driver table, combined with a list of driver IDs that are less than 10 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 < 10


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


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

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


Question: 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 4, 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 < 4


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

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


Question: Can you give me a list of driver IDs that are less than 5, excluding any driver IDs from the school bus list that aren't 7?

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


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

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


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

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


Question: Can you list all car makers, including BMW, and also include car makers from the model list where the model isn't a Mercedes-Benz or the ModelId isn't 35 and the maker's ID is less than 2?

SELECT Maker FROM car_makers WHERE FullName = "BMW" UNION ALL SELECT Maker FROM model_list WHERE Model != "mercedes-benz" OR "ModelId" != 35 AND "Maker" < 2


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

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


Question: Can you give me a list of driver IDs, excluding driver ID 12, from the driver table, but only those IDs that are not also in the school bus table with driver IDs less than 3?

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


Question: Can you list all the aircraft IDs, combining those from the aircraft table that are not equal to 3 with those from the airport_aircraft table that are greater than or equal to 3?

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


Question: Can you give me the driver ID that appears exactly once, where the driver ID is 2 in the driver table, but is not a driver ID other than 9 in the school bus table?

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


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

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


Question: Could you give me a list of template IDs from documents that have other details besides "None", combined with template IDs from templates where the template ID is 11 or greater?

SELECT Template_ID FROM Documents WHERE Other_Details <> "None" UNION SELECT Template_ID FROM Templates WHERE "Template_ID" >= 11


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

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


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

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: Which driver has an ID of 3 and also drives a school bus with a driver ID that is not 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: Could you show me the effective dates, template ID, template details, and template type code for all templates, including those that aren't of type "PP" and have a version number of 5 or less, as well as those that have template details, a template ID of 22 or greater, an effective date other than "2012-04-05 07:11:42", or aren't of type "AD" or have a version number of 9 or less?

SELECT Date_Effective_From, Date_Effective_To, Template_ID, Template_Details, Template_Type_Code FROM Templates WHERE Template_Type_Code != "PP" AND "Version_Number" <= 5 UNION ALL SELECT Date_Effective_From, Date_Effective_To, Template_ID, Template_Details, Template_Type_Code FROM Templates WHERE Template_Details != "" OR "Template_ID" >= 22 OR Date_Effective_From != "2012-04-05 07:11:42" AND Template_Type_Code <> "AD" OR "Version_Number" <= 9


Question: Can you show me the graduation college, age, nationality, and people ID for everyone, including those who are not 37 years old and not from the United States and didn't graduate from Wisconsin-Stevens Point, or whose name isn't Darryl Kennedy and whose ID isn't 6, combined with those who are younger than 37 or not from the United States?

SELECT Graduation_College, Age, Nationality, People_ID FROM people WHERE "Age" != 37 AND Nationality != "United States" AND Graduation_College <> "Wisconsin–Stevens Point" OR Name <> "Darryl Kennedy" AND "People_ID" <> 6 UNION ALL SELECT Graduation_College, Age, Nationality, People_ID FROM people WHERE "Age" < 37 OR Nationality <> "United States"


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

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


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

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


Question: Can you list the ID, name, and start year of clubs that are not in the USA, or didn't start in 2005, or aren't named Djurgårdens IF, but exclude those that are in the UK and started in 2005, or are named Djurgårdens IF?

SELECT Club_ID, Club_name, Start_year FROM club WHERE Region != "USA" OR "Start_year" != 2005 OR Club_name != "Djurgårdens IF" EXCEPT SELECT Club_ID, Club_name, Start_year FROM club WHERE Region = "UK" AND "Start_year" = 2005 OR Club_name = "Djurgårdens IF"


Question: Can you give me a list of employee IDs from the evaluation table where the award year is not 2018 and the bonus is not 2900, combined with a list of employee IDs from the hiring table where the shop ID is 5 or greater and the start year is not 2009?

SELECT Employee_ID FROM evaluation WHERE Year_awarded <> "2018" AND "Bonus" != 2900.0 UNION SELECT Employee_ID FROM hiring WHERE "Shop_ID" >= 5 AND Start_from <> "2009"


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

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


Question: Can you give me the driver ID that appears exactly once as driver ID 8 in the driver table but is not a driver ID greater than 10 in the school bus table?

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


Question: How many schools are not Columbia University and not in Honolulu, Hawaii, or have a School ID of 6 or greater, or are not private and not 4th grade, plus how many school buses are not full time?

SELECT COUNT(School_ID) FROM school WHERE School <> "Columbia University" AND Location != "Honolulu, Hawaii" OR "School_ID" >= 6 OR Type <> "Private" AND Grade <> "4th grade" UNION ALL SELECT COUNT(School_ID) FROM school_bus WHERE If_full_time <> "T"


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

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


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


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

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


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

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


Question: Can you list the aircraft IDs, including aircraft ID 1 from the aircraft table and aircraft IDs less than 5 from the airport_aircraft table?

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


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

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


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

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


Question: Can you show me the hse_feature_3, the highest property_id, hse_feature_1, vendor_requested_price, shp_feature_2, and the earliest date_on_market from the Properties table, considering properties where shp_feature_3 is not "None", or the date_on_market is not "1991-06-21 23:52:10" and the date_sold is "1979-05-13 16:58:06", or shp_feature_2 is not "None", or apt_feature_3 is "None", or the property_name is "parc coliseum" and the property_id is 14 and other_property_details is not "None", or oth_feature_2 is not "None" and fld_feature_2 is not "None" and hse_feature_1 is "None" and vendor_requested_price is less than 305.0, or fld_feature_3 is not "None" and fld_feature_1 is not "None" and hse_feature_2 is not "None", or apt_feature_1 is "qui", and also include the same information for properties where fld_feature_1 is not "None" and the agreed_selling_price is less than or equal to 0.0, or the buyer_offered_price is not 296733.0?

SELECT hse_feature_3, MAX(property_id), hse_feature_1, vendor_requested_price, shp_feature_2, MIN(date_on_market) FROM Properties WHERE shp_feature_3 != "None" OR date_on_market <> "1991-06-21 23:52:10" AND date_sold = "1979-05-13 16:58:06" OR shp_feature_2 <> "None" OR apt_feature_3 = "None" OR property_name = "parc coliseum" AND "property_id" = 14 AND other_property_details != "None" OR oth_feature_2 != "None" AND fld_feature_2 != "None" AND hse_feature_1 = "None" AND "vendor_requested_price" < 305.0 OR fld_feature_3 <> "None" AND fld_feature_1 <> "None" AND hse_feature_2 <> "None" OR apt_feature_1 = "qui" UNION ALL SELECT hse_feature_3, MAX(property_id), hse_feature_1, vendor_requested_price, shp_feature_2, MIN(date_on_market) FROM Properties WHERE fld_feature_1 <> "None" AND "agreed_selling_price" <= 0.0 OR "buyer_offered_price" != 296733.0


Question: Can you give me the Document ID, Other Details, Paragraph Text, and Paragraph ID for all paragraphs where the Paragraph ID is greater than 1104059 and the Other Details are not "None" and the Paragraph Text is not "Korea", or where the Document ID is 16514113, but exclude any paragraphs where the Other Details are not "None"?

SELECT Document_ID, Other_Details, Paragraph_Text, Paragraph_ID FROM Paragraphs WHERE "Paragraph_ID" > 1104059 AND Other_Details <> "None" AND Paragraph_Text != "Korea" OR "Document_ID" = 16514113 EXCEPT SELECT Document_ID, Other_Details, Paragraph_Text, Paragraph_ID FROM Paragraphs WHERE Other_Details <> "None"


Question: Can you give me the average driver ID, years working, full-time status, and school ID for all full-time drivers, but exclude those entries where the years working are less than 10, the school ID is less than or equal to 4, and the driver ID is greater than 10, and the driver is not full-time?

SELECT Years_Working, AVG(Driver_ID), If_full_time, School_ID FROM school_bus WHERE If_full_time = "T" EXCEPT SELECT Years_Working, AVG(Driver_ID), If_full_time, School_ID FROM school_bus WHERE "Years_Working" < 10 AND "School_ID" <= 4 AND "Driver_ID" > 10 AND If_full_time != "T"


Question: Could you list the zip codes and populations for counties named "Mansfield" where the population isn't 79000, or where the zip code isn't "D02" and the county ID is 5 or less, along with the zip codes and populations for counties where the population is 87200 or more and the zip code is "D08"?

SELECT Zip_code, Population FROM county WHERE County_name = "Mansfield" AND "Population" != 79000.0 OR Zip_code <> "D02" AND "County_Id" <= 5 UNION ALL SELECT Zip_code, Population FROM county WHERE "Population" >= 87200.0 AND Zip_code = "D08"


Question: Can you give me a list of aircraft IDs that appear in the aircraft table, excluding aircraft ID 1, but then remove any aircraft IDs from that list that also appear in the airport_aircraft table and have an ID less than 2?

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


Question: Can you give me the Player IDs from the player table, excluding those also found in the player_coach table, where the players either don't live in Winnipeg, aren't small businessmen, have a Player ID of 4 or greater, aren't sponsored by Churchill, have fewer than 14355 votes, or are male and ranked 3rd, but only if they are not also in the player_coach table with a Player ID greater than 6, a Coach ID of 1, or a starting year of 2012 or earlier?

SELECT Player_ID FROM player WHERE Residence <> "Winnipeg" OR Occupation <> "Small Businessman" AND "Player_ID" >= 4 AND Sponsor_name <> "Churchill" AND "Votes" < 14355 OR Gender = "M" AND Rank = "3rd" EXCEPT SELECT Player_ID FROM player_coach WHERE "Player_ID" > 6 OR "Coach_ID" = 1 OR "Starting_year" <= 2012


Question: What is the average employee ID for employees whose bonus is not $3000, along with their individual employee IDs?

SELECT AVG(T1.Employee_ID), T2.Employee_ID FROM employee as T1 JOIN evaluation as T2 ON T1.Employee_ID = T2.Employee_ID WHERE Bonus <> 3000.0


Question: What are the issue numbers that are not 6, excluding those issue numbers from books other than "Michael Moorcock's Multiverse" that are greater than 4 and have a Book ID greater than 5?

SELECT Issues FROM book WHERE "Issues" != 6.0 EXCEPT SELECT Issues FROM book WHERE Title != "Michael Moorcock's Multiverse" AND "Issues" > 4.0 AND "Book_ID" > 5


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 11 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, combining those from the driver table excluding driver ID 2, and those from the school bus table excluding driver ID 4?

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


Question: Which driver has an ID of 5, excluding any drivers with IDs less than 4 who are also school bus drivers?

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: Can you list the aircraft IDs that are less than or equal to 4 from the aircraft table, and also include aircraft ID 2 from the airport_aircraft table?

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


Question: Can you list the ranks from match results where the bronze score is less than or equal to 8, combined with the ranks of players who either don't live in Brandon or don't have a rank of "1st", but are also employed as "Product Consultant - MLCC"?

SELECT Rank FROM match_result WHERE "Bronze" <= 8 UNION SELECT Rank FROM player WHERE Residence <> "Brandon" OR Rank <> "1st" AND Occupation = "Product Consultant - MLCC"


Question: Can you tell me the age, average home city, minimum party value, and name for all drivers who are 36 years old and named Minnie Gonzalez, combined with the same information for all drivers who are not named Tim Larson?

SELECT Age, AVG(Home_city), MIN(Party), Name FROM driver WHERE "Age" = 36 AND Name = "Minnie Gonzalez" UNION ALL SELECT Age, AVG(Home_city), MIN(Party), Name FROM driver WHERE Name != "Tim Larson"


Question: Could you give me the document type codes that are both in the Documents table where the receipt number isn't "37" or the document status isn't "working" and the document type is "Paper" or other details aren't "x", and also in the Ref_Document_Types table where the document type code isn't "CD" or the document type description is "f"?

SELECT document_type_code FROM Documents WHERE receipt_number != "37" OR document_status_code <> "working" AND document_type_code = "Paper" OR other_details <> "x" INTERSECT SELECT document_type_code FROM Ref_Document_Types WHERE document_type_code <> "CD" OR document_type_description = "f"


Question: Can you give me a list of aircraft IDs that are less than 5 from the aircraft table, combined with a list of aircraft IDs that are not equal to 2 from the airport_aircraft table?

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


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

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


Question: What is the highest ID for the artist named Felix Schmidt, London Symphony Orchestra & Rafael Frühbeck de Burgos, and also the highest ID for employees who either don't report to employee 6, or are not from Canada and were born on May 29, 1970, or don't have the title "IT Staff" and don't have the fax number +1 (403) 263-4289 and don't have the phone number +1 (403) 467-3351, or whose last name is not Adams and first name is not Jane and live in Alberta at 923 7 ST NW and whose ID is not 8 and whose postal code is not T2P 2T3, or who don't live in Lethbridge, or whose email is not laura@chinookcorp.com, or who were not hired on March 4, 2004?

SELECT MAX(id) FROM artists WHERE name = "Felix Schmidt, London Symphony Orchestra & Rafael Frühbeck de Burgos" UNION ALL SELECT MAX(id) FROM employees WHERE "reports_to" <> 6.0 OR country != "Canada" AND birth_date = "1970-05-29 00:00:00" OR title <> "IT Staff" AND fax != "+1 (403) 263-4289" AND phone != "+1 (403) 467-3351" OR last_name <> "Adams" AND first_name <> "Jane" AND state = "AB" AND address = "923 7 ST NW" AND "id" <> 8 AND postal_code != "T2P 2T3" OR city != "Lethbridge" OR email != "laura@chinookcorp.com" OR hire_date <> "2004-03-04 00:00:00"


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

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


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

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


Question: Can you give me a list of driver IDs, including those from the driver table excluding driver ID 11, and those from 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 != 11 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 3


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


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

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


Question: Can you list the Aircraft IDs that are greater than 2 when grouped in the aircraft table, and also include the Aircraft ID which is 5 when grouped in the airport_aircraft table?

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


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

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


Question: Can you give me a list of product IDs for products that either have a DPI different than 600 or are not named "Xerox Travel Scanner 100", combined with a list of product IDs for products with an ID of 1 or greater, dimensions not equal to "298 x 209 x 99", a DPI greater than 600, a max page size that isn't "216mm x 356mm", a product name other than "Fujitsu fi-6130 A4 Series Scanner", and a "USB 2.0" interface?

SELECT product_id FROM product WHERE "dpi" <> 600.0 OR product != "Xerox Travel Scanner 100" UNION SELECT product_id FROM product WHERE "product_id" >= 1 AND dimensions != "298 x 209 x 99" AND "dpi" > 600.0 AND max_page_size <> "216mm x 356mm" AND product <> "Fujitsu fi-6130 A4 Series Scanner" AND interface = "USB 2.0"


Question: Can you give me a list of driver IDs that are not 11, and also appear in the list of school bus driver IDs that are 9 or greater?

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

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, appear in the driver table but not in the school_bus table, also excluding driver ID 9 from the school_bus table?

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


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

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


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

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


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

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: Could you list the draft numbers from the Document_Drafts table where the draft number is 0, the draft details are not "x", or the document ID is not 2, combined with the draft numbers from the Draft_Copies table where the draft number is less than 1, the copy number is greater than or equal to 10, and the document ID is less than or equal to 20?

SELECT draft_number FROM Document_Drafts WHERE "draft_number" = 0 OR draft_details <> "x" OR "document_id" != 2 UNION SELECT draft_number FROM Draft_Copies WHERE "draft_number" < 1 AND "copy_number" >= 10 AND "document_id" <= 20


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

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


Question: Can you give me a list of driver IDs, where each ID is greater than 1, but only include those IDs that are not also in a list of school bus driver IDs that are greater than or equal to 9?

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


Question: What is the total of the property type codes from the Properties table where either the vendor requested price is not 78.7208, or the buyer offered price is more than 15.17, or the other property details are "None", or oth_feature_2 is "None", or shp_feature_1 is "None" and apt_feature_3 is "None", or apt_feature_1 is "aut", or apt_feature_2 is not "et" and fld_feature_3 is "None", or the date on market is "1981-08-23 05:40:38", or shp_feature_3 is not "None", or the property address is not "4745 Emerson Stravenue Suite 829 South Garret, IN 16772-5682", or fld_feature_1 is not "None" and shp_feature_2 is not "None" and hse_feature_1 is "None", or hse_feature_2 is not "None", or the property ID is not 1, or the agreed selling price is less than or equal to 4201.8, or the room count is 7, or hse_feature_3 is "None" and the property name is not "prism", or fld_feature_2 is "None" and the property type code is "Other", combined with the total of the property type codes from the Ref_Property_Types table where the property type description is not "Other, to be determined."?

SELECT SUM(property_type_code) FROM Properties WHERE "vendor_requested_price" <> 78.7208 OR "buyer_offered_price" > 15.17 OR other_property_details = "None" OR oth_feature_2 = "None" OR shp_feature_1 = "None" AND apt_feature_3 = "None" OR apt_feature_1 = "aut" OR apt_feature_2 <> "et" AND fld_feature_3 = "None" OR date_on_market = "1981-08-23 05:40:38" OR shp_feature_3 != "None" OR property_address != "4745 Emerson Stravenue Suite 829 South Garret, IN 16772-5682" OR fld_feature_1 <> "None" AND shp_feature_2 <> "None" AND hse_feature_1 = "None" OR hse_feature_2 != "None" OR "property_id" <> 1 OR "agreed_selling_price" <= 4201.8 OR "room_count" = 7 OR hse_feature_3 = "None" AND property_name != "prism" OR fld_feature_2 = "None" AND property_type_code = "Other" UNION ALL SELECT SUM(property_type_code) FROM Ref_Property_Types WHERE property_type_description <> "Other, to be determined."


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


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


Question: Can you give me a list of aircraft IDs, excluding aircraft ID 2, that are not also in the list of aircraft IDs less than or equal to 5 found in the airport aircraft table?

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


Question: Can you give me a list of driver IDs that are less than 9 from the driver table, combined with a list of driver IDs that are less than 3 from the school bus table, making sure to only list each driver ID once?

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


Question: Can you list the position, club ID, and student ID for all members, combining those who are in clubs other than club 1 and not a Teaching Coordinator with those who are either not CTOs or in clubs other than club 1?

SELECT Position, ClubID, StuID FROM Member_of_club WHERE "ClubID" <> 1 AND Position <> "Teaching Coordinator" UNION SELECT Position, ClubID, StuID FROM Member_of_club WHERE Position <> "CTO" OR "ClubID" <> 1


Question: Can you give me a list of driver IDs, combining those from the driver table excluding driver ID 2, and those from the school bus table excluding driver ID 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: Can you tell me the average name, maximum People ID, age, and nationality of people who graduated from Wisconsin-Stevens Point, combined with the average name, maximum People ID, age, and nationality of people whose People ID is less than 2 or whose nationality is not the United States?

Age AVG(Name) MAX(People_ID) Nationality

SELECT Age, AVG(Name), MAX(People_ID), Nationality FROM people WHERE Graduation_College = "Wisconsin–Stevens Point" UNION SELECT Age, AVG(Name), MAX(People_ID), Nationality FROM people WHERE "People_ID" < 2 OR Nationality != "United States"


Question: Can you give me a list of aircraft IDs that appear in the aircraft table, excluding aircraft ID 5, but then remove any aircraft IDs that also appear in the airport_aircraft table, excluding aircraft ID 3?

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


Question: Which driver IDs are greater than 6 and also not equal to 9?

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


Question: Can you give me a list of driver IDs that are not 5 from the driver table, but only include those IDs that are also in the school bus table and are not 4?

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


Question: Could you give me the document IDs that are either not 10 or have a draft number of 4 with draft details of "k", and are also document IDs less than 15 with a receipt date other than "1983-09-26 09:32:56" and a document status code that is not "overdue", or a shipping agent code that is not "UP", or a receipt number that is not "93" with other details that are not "b"?

SELECT document_id FROM Document_Drafts WHERE "document_id" <> 10 OR "draft_number" = 4 AND draft_details = "k" INTERSECT SELECT document_id FROM Documents WHERE "document_id" < 15 AND receipt_date != "1983-09-26 09:32:56" AND document_status_code != "overdue" OR shipping_agent_code <> "UP" OR receipt_number != "93" AND other_details <> "b"


Question: Can you give me a list of Book IDs from the book table where the title is not "Michael Moorcock's Multiverse", or the Book ID is less than 1 and the writer is not "Garth Ennis", or the number of issues is 5 or more, combined with a list of Book IDs from the publication table where the publisher is "Springer Nature"?

SELECT Book_ID FROM book WHERE Title <> "Michael Moorcock's Multiverse" OR "Book_ID" < 1 AND Writer != "Garth Ennis" OR "Issues" >= 5.0 UNION SELECT Book_ID FROM publication WHERE Publisher = "Springer Nature"


Question: What aircraft IDs, excluding ID 4, are present in the aircraft table but not in the airport_aircraft table, excluding ID 1?

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


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

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


Question: Can you give me the driver ID from the driver table, specifically driver ID 2, excluding any driver IDs less than 7 that are in the school bus table?

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


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

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


Question: Can you give me a list of aircraft IDs, including those that appear in the aircraft table with an ID of 2, and those that appear in the airport_aircraft table with an ID of 5 or less?

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: Could you please list the document IDs that are both from the circulation history where the draft number is 17 or higher, or the copy number is not 10, and also from the documents where the document status is not "working", the document type is not "Paper", the receipt number is "93", and either the document ID is not 1 or the receipt date is not "1974-05-08 00:00:46"?

SELECT document_id FROM Circulation_History WHERE "draft_number" >= 17 OR "copy_number" <> 10 INTERSECT SELECT document_id FROM Documents WHERE document_status_code != "working" AND document_type_code <> "Paper" AND receipt_number = "93" AND "document_id" != 1 OR receipt_date != "1974-05-08 00:00:46"


Question: Can you give me a list of driver IDs, including those that are equal to 8 from the driver table, and those that are less than 9 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 < 9


Question: Which product with ID 1 is available in stores with an ID greater than 3, but is not product with ID 2?

SELECT Product_ID FROM store_product WHERE "Store_ID" > 3 AND "Product_ID" = 1 EXCEPT SELECT Product_ID FROM store_product WHERE "Product_ID" = 2


Question: Could you give me a list of driver IDs, including driver ID 6 from the driver table, and all driver IDs except 3 from the school bus table?

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


Question: What is the sum of document IDs for drafts where the draft number is 14 and the draft details are not "r", or where the document ID is greater than 13, combined with the sum of document IDs for drafts where the draft number is less than or equal to 17, or where the draft details are not "e" and the document ID is greater than 12?

SELECT SUM(document_id) FROM Document_Drafts WHERE "draft_number" = 14 AND draft_details != "r" OR "document_id" > 13 UNION SELECT SUM(document_id) FROM Document_Drafts WHERE "draft_number" <= 17 OR draft_details != "e" AND "document_id" > 12


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

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


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

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


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

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


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

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


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

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


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

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


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

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


Question: Can you list the aircraft IDs, including those from the aircraft table that are greater than or equal to 2, and those from the airport_aircraft table that are less than or equal to 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: Can you give me a list of aircraft IDs that are equal to 1, considering both 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: Can you list the aircraft IDs, excluding aircraft ID 4, from the aircraft table, and combine that with a list of aircraft IDs less than 3 from the airport_aircraft table, removing any duplicates?

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


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

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


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

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

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


Question: Can you give me the IDs of people who are at least 187 cm tall, excluding those who either have a money rank of 166 or lower, have made 19 or fewer final tables, or have earnings that are not exactly $189,233?

SELECT People_ID FROM people WHERE "Height" >= 187.0 EXCEPT SELECT People_ID FROM poker_player WHERE "Money_Rank" <= 166.0 OR "Final_Table_Made" <= 19.0 OR "Earnings" <> 189233.0


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

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


Question: Could you give me the IDs of all artists named João Suplicy, as well as the IDs of all employees who either live in Calgary and weren't born on February 18, 1962, or weren't hired on October 17, 2003, or don't have the phone number +1 (403) 263-4423, or don't have an ID of 2 and aren't named Callahan and don't have the job title IT Staff and don't live in the state AB, or don't have the email steve@chinookcorp.com?

SELECT id FROM artists WHERE name = "João Suplicy" UNION ALL SELECT id FROM employees WHERE city = "Calgary" AND birth_date != "1962-02-18 00:00:00" OR hire_date <> "2003-10-17 00:00:00" OR phone = "+1 (403) 263-4423" OR "id" != 2 AND last_name != "Callahan" AND title = "IT Staff" AND state != "AB" OR email <> "steve@chinookcorp.com"


Question: Can you give me a list of driver IDs, including those from the driver table that are greater than 2, and those from the school bus table that are 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: Can you give me a list of aircraft IDs that are less than 5, excluding any aircraft IDs from the airport aircraft list that are not equal to 3?

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


Question: Which company IDs are for companies headquartered in China, excluding those company IDs that are less than 13 in the employment table?

SELECT Company_ID FROM company WHERE Headquarters = "China" EXCEPT SELECT Company_ID FROM employment WHERE "Company_ID" < 13


Question: Can you give me the color pages per minute, max page size, product name, product ID, and DPI for all products with dimensions not equal to "300 x 50 x 45", excluding those products that either have dimensions not equal to "303 x 94 x 60" and a product ID greater than 2 and a max page size not equal to "216mm x 355mm", or have an interface that is not "USB 2.0"?

SELECT pages_per_minute_color, max_page_size, product, product_id, dpi FROM product WHERE dimensions <> "300 x 50 x 45" EXCEPT SELECT pages_per_minute_color, max_page_size, product, product_id, dpi FROM product WHERE dimensions <> "303 x 94 x 60" AND "product_id" > 2 AND max_page_size != "216mm x 355mm" OR interface != "USB 2.0"


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

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


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

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


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

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


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

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 that are less than 12 and also appear as driver IDs in the school bus list, excluding driver ID 10?

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


Question: Can you give me a list of aircraft IDs that are both less than or equal to 5 and also not equal to 2, considering 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 != 2


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

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


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

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


Question: Can you give me the Player ID, Coach ID, and Starting Year from the player_coach table, including entries where the Player ID is not 14, or the Coach ID is 3 and the Starting Year is 2010, combined with entries where the Player ID is less than 6 and the Coach ID is less than or equal to 3, or the Starting Year is 2012?

SELECT Player_ID, Coach_ID, Starting_year FROM player_coach WHERE "Player_ID" != 14 OR "Coach_ID" = 3 AND "Starting_year" = 2010 UNION SELECT Player_ID, Coach_ID, Starting_year FROM player_coach WHERE "Player_ID" < 6 AND "Coach_ID" <= 3 OR "Starting_year" = 2012