Question: What are the student IDs of students who have a pet with ID 2001 or less, or students who live outside of PEK, or have an advisor other than 8918, or are male and have student ID 1002?

SELECT StuID FROM Has_Pet WHERE "PetID" <= 2001 UNION SELECT StuID FROM Student WHERE city_code != "PEK" OR "Advisor" != 8918 OR Sex = "M" AND "StuID" = 1002


Question: What is the minimum age of a head, and the head ID, where the maximum department ID is 15?

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


Question: Which driver IDs, excluding driver ID 7, are greater than 11, considering only those present in the 'driver' table?

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


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

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


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

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


Question: What are the driver IDs that appear in both the driver and school bus tables, where the driver ID is less than or equal to 9 in the driver table and less than or equal to 3 in the school bus table?

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


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

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


Question: How many schools meet the budget criteria where the invested amount is less than 8335 or the budgeted amount is not 4979 and the year is not 2006 and the total budget percentage invested is at least 2.2, and how many schools meet the endowment criteria where the school ID is not 1 or the endowment ID is greater than 8 or the amount is not 9.51?

SELECT COUNT(School_id) FROM budget WHERE "Invested" < 8335 OR "Budgeted" != 4979 AND "Year" <> 2006 AND "total_budget_percent_invested" >= 2.2 UNION SELECT COUNT(School_id) FROM endowment WHERE "School_id" != 1 OR "endowment_id" > 8 OR "amount" <> 9.51


Question: What is the average aircraft ID, and what are the corresponding airport IDs, based on the aircraft and airport aircraft information?

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


Question: What are the aircraft IDs, excluding ID 1, that are in the aircraft table, combined with the aircraft IDs less than 1 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 < 1


Question: Which driver IDs are not equal to 8 and are not found in the school bus table with driver IDs greater than or equal to 10?

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


Question: Which coach IDs meet these criteria: they are male and named Joe Fabbri, or their ID is less than 2, or their rank is greater than 3, or their club ID is 1 or higher; but exclude any coach IDs that are not 1, or whose starting year is 2010 or earlier and player ID is not 1?

SELECT Coach_ID FROM coach WHERE Gender = "M" AND Coach_name = "Joe Fabbri" OR "Coach_ID" < 2 OR "Rank" > 3 OR "Club_ID" >= 1 EXCEPT SELECT Coach_ID FROM player_coach WHERE "Coach_ID" != 1 OR "Starting_year" <= 2010 AND "Player_ID" != 1


Question: Which driver IDs are not 8, but are present in the driver table, and also which driver ID is 4 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 = 4


Question: What are the descriptions of roles that are not "Photo" or have the code "PT", and also have a role code that is not "MG"?

SELECT role_description FROM Roles WHERE role_description != "Photo" OR role_code = "PT" INTERSECT SELECT role_description FROM Roles WHERE role_code != "MG"


Question: What are the player IDs of players who are not male, or have a player ID less than or equal to 5, or are named Sean Robert, or whose occupation is not Parliamentarian and whose sponsor is not Charleswood—St. James—Assiniboia, and also have votes less than or equal to 4947, or have a rank of 1st, or are not male?

SELECT Player_ID FROM player WHERE Gender != "M" OR "Player_ID" <= 5 OR Player_name = "Sean Robert" OR Occupation != "Parliamentarian" AND Sponsor_name <> "Charleswood—St. James—Assiniboia" INTERSECT SELECT Player_ID FROM player WHERE "Votes" <= 4947 OR Rank = "1st" OR Gender != "M"


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

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


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

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


Question: What are the driver IDs that are 4 or greater, but not 7 or greater, from the driver and school bus tables respectively?

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: What are the aircraft IDs, excluding ID 2, that are present in both the aircraft and airport_aircraft tables, excluding ID 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: What are the names of all clubs, excluding the Tennis Club, or located in HHH, combined with the names of clubs where the ClubID is not 1, or located in AKW, or not named Tennis Club?

SELECT ClubName FROM Club WHERE ClubName <> "Tennis Club" OR ClubLocation = "HHH" UNION ALL SELECT ClubName FROM Club WHERE "ClubID" != 1 OR ClubLocation = "AKW" OR ClubName != "Tennis Club"


Question: Which driver IDs are greater than 7 and also appear in the school bus table with IDs greater than 4?

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


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

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


Question: Which driver IDs are greater than or equal to 6 and also appear in the school bus table, excluding driver ID 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: Which driver IDs are greater than 4 but not found in the school bus table with IDs less than or equal to 3?

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


Question: What are the minimum student ID and average pet ID for students with a pet ID of 2002 or higher, or a student ID of 1002 or higher, but not for students who don't have a pet ID of 2002 and have a student ID of 1002 or lower?

SELECT MIN(StuID), AVG(PetID) FROM Has_Pet WHERE "PetID" >= 2002 OR "StuID" >= 1002 EXCEPT SELECT MIN(StuID), AVG(PetID) FROM Has_Pet WHERE "PetID" != 2002 AND "StuID" <= 1002


Question: What are the models that are not Volvo and not model ID 22, and also either have a model ID of 20 or have a maker ID greater than or equal to 23 and are not Jeep?

SELECT Model FROM model_list WHERE Model <> "volvo" AND "ModelId" <> 22 INTERSECT SELECT Model FROM model_list WHERE "ModelId" = 20 OR Model != "jeep" AND "Maker" >= 23


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

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


Question: What are the document IDs that have other details not equal to "n" and a receipt date not equal to "1996-05-31 06:51:58", but are not document IDs from the Documents_Mailed table where the mailing date is not "1973-02-21 10:17:01", or the document ID is 7, or the mailed to address ID is not 2?

SELECT document_id FROM Documents WHERE other_details <> "n" AND receipt_date != "1996-05-31 06:51:58" EXCEPT SELECT document_id FROM Documents_Mailed WHERE mailing_date != "1973-02-21 10:17:01" OR "document_id" = 7 OR "mailed_to_address_id" <> 2


Question: What are the document IDs that are either less than or equal to 2 in the circulation history, or have other details equal to "z" and a receipt date not equal to "1976-09-15 19:24:17", or a shipping agent code of "AL", or a document ID of 14, or a receipt number not equal to "114" in the documents table?

SELECT document_id FROM Circulation_History WHERE "document_id" <= 2 UNION ALL SELECT document_id FROM Documents WHERE other_details = "z" AND receipt_date <> "1976-09-15 19:24:17" OR shipping_agent_code = "AL" OR "document_id" = 14 OR receipt_number != "114"


Question: Which driver IDs are less than 7 but not greater than or equal to 10, considering driver and school bus information?

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


Question: Which driver IDs, excluding driver ID 9, are present in the driver table, and which driver IDs greater than 9 are present in 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 > 9


Question: What are the locations, school IDs, and counties of schools that meet both of the following criteria: either the school ID is "6" or the football class isn't "AAA", the mascot is "Lions", and the school name isn't "Triton"; and also either the county isn't "50 Marshall" or the school ID isn't "3", or the enrollment is at least 379, or the mascot isn't "Cavaliers", the football class is "A", the location isn't "Bourbon", and the IHSAA class isn't "AA"?

SELECT Location, School_id, County FROM School WHERE School_id = "6" OR IHSAA_Football_Class <> "AAA" AND Mascot = "Lions" AND School_name != "Triton" INTERSECT SELECT Location, School_id, County FROM School WHERE County <> "50 Marshall" AND School_id != "3" OR "Enrollment" >= 379 OR Mascot <> "Cavaliers" AND IHSAA_Football_Class = "A" AND Location != "Bourbon" AND IHSAA_Class != "AA"


Question: Which driver IDs are not 7, and also which driver ID is 3, considering both drivers and school buses?

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: What is the minimum title and ID from the albums table where the title is "Santana Live" and the ID is 199, combined with the minimum title and ID from the employees table where any of the following conditions are met: the phone number is "+1 (403) 456-9986", the address is not "11120 Jasper Ave NW" and reports_to is not 1.0 and the state is not "AB", the ID is greater than 5 and the postal code is not "T1K 5N8", the birth date is not "1973-08-29 00:00:00", the first name is not "Andrew", the country is not "Canada", the city is not "Calgary", the title is not "Sales Support Agent" and the email is not "nancy@chinookcorp.com" and the last name is not "Johnson", or the hire date is "2002-08-14 00:00:00"?

SELECT MIN(title), id FROM albums WHERE title = "Santana Live" AND "id" = 199 UNION SELECT MIN(title), id FROM employees WHERE phone = "+1 (403) 456-9986" OR address != "11120 Jasper Ave NW" AND "reports_to" <> 1.0 AND state != "AB" OR "id" > 5 AND postal_code <> "T1K 5N8" OR birth_date != "1973-08-29 00:00:00" OR first_name != "Andrew" OR country <> "Canada" OR city <> "Calgary" OR title <> "Sales Support Agent" AND email <> "nancy@chinookcorp.com" AND last_name <> "Johnson" OR hire_date = "2002-08-14 00:00:00"


Question: Which driver IDs are equal to 1 but not equal to 4, considering driver IDs from the driver and school bus tables?

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


Question: What are the driver IDs, excluding ID 12, from the driver table, combined with driver IDs greater than or equal to 10 from the school bus table?

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


Question: What are the driver IDs that are not equal to 5, excluding those driver IDs that are less than or equal to 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: What are the document IDs that are not draft number 17 and also meet at least one of the following conditions: document type is not "Hard Drive", receipt number is not "114", document ID is greater than 23, document status is "overdue", or other details are not "y"?

SELECT document_id FROM Circulation_History WHERE "draft_number" <> 17 INTERSECT SELECT document_id FROM Documents WHERE document_type_code != "Hard Drive" OR receipt_number != "114" OR "document_id" > 23 OR document_status_code = "overdue" OR other_details != "y"


Question: What are the driver IDs less than 12 that are not in the school bus records, excluding driver ID 9?

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


Question: What are the aircraft IDs that are less than 4 and also appear in the airport aircraft table, excluding aircraft ID 2?

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


Question: What are the contestant numbers for Nita Coster, and also for any votes not from New York, or where the contestant number is 3, or where the vote was not created at a specific time, or where the phone number is less than or equal to 6209222712?

SELECT contestant_number FROM CONTESTANTS WHERE contestant_name = "Nita Coster" UNION ALL SELECT contestant_number FROM VOTES WHERE state <> "NY" OR "contestant_number" = 3 OR created <> "2018-03-09 19:03:40" OR "phone_number" <= 6209222712


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

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


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

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


Question: What is the sum of ClubIDs and the ClubID, grouped by position, for members where the club location is not HHH or the club name is Tennis Club, and the position is not Teaching Coordinator, and the student ID is 1007?

SELECT SUM(T1.ClubID), T2.ClubID FROM Club as T1 JOIN Member_of_club as T2 ON T1.ClubID = T2.ClubID WHERE ClubLocation <> "HHH" OR ClubName = "Tennis Club" AND Position <> "Teaching Coordinator" GROUP BY Position HAVING StuID = 1007


Question: What is the maximum value of 'Other_Details' from the 'Documents' table where 'Other_Details' is not "None", 'Template_ID' is 6 or greater, the document name isn't "Learning French", and the description is "w", combined with the maximum 'Other_Details' from the 'Paragraphs' table where 'Paragraph_ID' is greater than 3708?

SELECT MAX(Other_Details) FROM Documents WHERE Other_Details <> "None" AND "Template_ID" >= 6 AND Document_Name <> "Learning French" AND Document_Description = "w" UNION SELECT MAX(Other_Details) FROM Paragraphs WHERE "Paragraph_ID" > 3708


Question: Which driver IDs are less than 6 but not present in the school bus table with IDs greater 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: What are the aircraft IDs that are less than or equal to 5, excluding those aircraft IDs that are less than 3 and present 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: What are the driver IDs, excluding ID 12, that are present in both the driver and school bus tables, excluding ID 3?

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


Question: What are the property IDs that have a feature ID of 4 or greater, excluding those properties where specific feature conditions are met, such as certain feature values, address, and dates?

SELECT property_id FROM Other_Property_Features WHERE "feature_id" >= 4 EXCEPT SELECT property_id FROM Properties WHERE fld_feature_2 = "None" AND apt_feature_1 <> "ut" AND shp_feature_3 = "None" AND property_address = "2088 Bashirian Fork Suite 337 Faustinoport, MT 16771-9320" OR hse_feature_3 != "None" OR oth_feature_1 <> "None" OR date_sold = "1981-06-26 21:28:28" AND apt_feature_3 != "None" OR shp_feature_2 = "None" AND oth_feature_3 <> "None" OR fld_feature_3 = "None" AND "buyer_offered_price" <= 296733.0 OR "room_count" < 3 OR date_on_market = "1986-11-26 04:12:18" AND "agreed_selling_price" != 4201.8 AND oth_feature_2 <> "None" OR apt_feature_2 <> "adipisci" AND property_type_code = "Field" AND property_name != "longacre" AND "vendor_requested_price" > 2573.0 AND shp_feature_1 <> "None" AND other_property_details <> "None" OR hse_feature_1 <> "None" OR hse_feature_2 = "None" AND fld_feature_1 = "None"


Question: What are the driver IDs that are greater than or equal to 4, excluding any driver IDs that are less than or equal to 3?

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


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

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


Question: What are the driver IDs greater than 4 in the driver table, combined with the 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 > 4 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 3


Question: What are the aircraft IDs greater than 3 or less than 1, considering data from both the aircraft and airport_aircraft tables?

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


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

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


Question: What are the names of employees who either don't earn 23980 or aren't named Mark Young, and also the names of employees with an employee ID less than or equal to 248965255?

SELECT name FROM employee WHERE "salary" != 23980 OR name != "Mark Young" UNION SELECT name FROM employee WHERE "eid" <= 248965255


Question: What are the aircraft IDs, excluding ID 1, that are either listed in the aircraft table or in the airport_aircraft table?

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


Question: For documents, what are the document status codes, receipt dates, the count of shipping agents, average document IDs, document type codes, and average receipt numbers? Include documents where the shipping agent code is not "SH" or the receipt number is not "114", and also those where the document type code is not "Hard Drive", or the document status code is not "overdue", or the receipt date is not "2008-04-21 20:42:25" and the document ID is greater than 17. Also include documents where the document status code is "working" and the shipping agent code is not "UP", or where other details are "y" and the receipt date is not "2015-04-03 09:36:19" and the document type code is "Paper".

SELECT document_status_code, receipt_date, COUNT(shipping_agent_code), AVG(document_id), document_type_code, AVG(receipt_number) FROM Documents WHERE shipping_agent_code <> "SH" OR receipt_number <> "114" AND document_type_code <> "Hard Drive" OR document_status_code != "overdue" OR receipt_date != "2008-04-21 20:42:25" AND "document_id" > 17 UNION SELECT document_status_code, receipt_date, COUNT(shipping_agent_code), AVG(document_id), document_type_code, AVG(receipt_number) FROM Documents WHERE document_status_code = "working" AND shipping_agent_code <> "UP" OR other_details = "y" AND receipt_date <> "2015-04-03 09:36:19" AND document_type_code = "Paper"


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

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


Question: Which driver IDs are greater than 9, and which driver ID is 7, considering both drivers and school buses?

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


Question: What are the age, city code, sex, major, and first name of students who are not named Steven, are not female, and are not 22 years old, or live in a city other than WAS, or have student ID 1035, a major greater than 550, and advisor 1148, and also have a city code of WAS, or are younger than 19 and have a major of at least 550, or have a last name of Tai, or a first name other than Dinesh?

SELECT Age, city_code, Sex, Major, Fname FROM Student WHERE Fname <> "Steven" AND Sex != "F" AND "Age" != 22 OR city_code != "WAS" OR "StuID" = 1035 AND "Major" > 550 AND "Advisor" = 1148 INTERSECT SELECT Age, city_code, Sex, Major, Fname FROM Student WHERE city_code = "WAS" OR "Age" < 19 AND "Major" >= 550 OR LName = "Tai" OR Fname != "Dinesh"


Question: What are the driver IDs that are greater than or equal to 5, excluding those driver IDs that are not equal to 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: What are the aircraft IDs that are greater than or equal to 4, but not aircraft IDs that are less than 5, considering aircraft and airport aircraft information?

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


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

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


Question: What are the driver IDs that are less than 3 in the driver table, combined with the driver IDs that are not equal to 9 in the school bus table?

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


Question: What are the aircraft IDs that appear in the aircraft table with an ID of 3 or greater, or in the airport_aircraft table with an ID of 2 or greater?

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


Question: Which driver IDs are less than 6 but not equal to 10, considering only the driver IDs present in the driver table and excluding those in the school bus table?

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


Question: What are the driver IDs, excluding driver ID 1, that are present in both the driver and school bus tables, with the school bus driver IDs being 7 or less?

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: What are the driver IDs, excluding driver 6, that are present in both the driver and school bus tables, excluding driver 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: What is the maximum continent for Russia, and what is the maximum continent for countries that are not Nigeria and have a country ID greater than 12 or a continent value greater than 2?

SELECT MAX(Continent) FROM countries WHERE CountryName = "russia" UNION SELECT MAX(Continent) FROM countries WHERE CountryName <> "nigeria" AND "CountryId" > 12 OR "Continent" > 2


Question: What are the aircraft IDs that are greater than or equal to 4 in the aircraft table, but not in the airport_aircraft table where the aircraft ID is greater than or equal to 2?

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


Question: What are the aircraft IDs that are less than 5, and also the aircraft IDs from the airport table that are not 5?

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


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

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


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

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


Question: What are the driver IDs that are less than 5 and also appear in the school bus table with IDs no greater than 7?

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


Question: What are the aircraft IDs, excluding aircraft ID 1, that are present in both the aircraft and airport_aircraft tables, but also excluding aircraft ID 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: What are the airport IDs, flight IDs, and dates for flights where the flight ID is less than or equal to 11 and the flight number is not M2-F1 #21 and the pilot is not Thompson, or the altitude is at least 3650, combined with flights where the flight number is not M2-F1 #1 or the pilot is not Thompson and the date is not March 1, 1963 and the company ID is greater than 7, or the flight ID is not 9, or the altitude is 3650, or the velocity is not 135, or the airport ID is less than or equal to 5?

SELECT airport_id, id, Date FROM flight WHERE "id" <= 11 AND Vehicle_Flight_number != "M2-F1 #21" AND Pilot <> "Thompson" OR "Altitude" >= 3650.0 UNION ALL SELECT airport_id, id, Date FROM flight WHERE Vehicle_Flight_number <> "M2-F1 #1" OR Pilot <> "Thompson" AND Date <> "March 1, 1963" AND "company_id" > 7 OR "id" <> 9 OR "Altitude" = 3650.0 OR "Velocity" <> 135.0 OR "airport_id" <= 5


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

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


Question: What are the aircraft IDs that are either aircraft ID 4 or any aircraft ID that is not 3, considering both the aircraft and airport_aircraft tables?

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


Question: What are the draft numbers and document IDs that appear in both the Circulation History where the copy number is greater than 10 or the employee ID is not 8, and in the Document Drafts where the draft number is not 14, the document ID is less than or equal to 12, and the draft details are not "m"?

SELECT draft_number, document_id FROM Circulation_History WHERE "copy_number" > 10 OR "employee_id" <> 8 INTERSECT SELECT draft_number, document_id FROM Document_Drafts WHERE "draft_number" <> 14 AND "document_id" <= 12 AND draft_details <> "m"


Question: What are the origin, arrival date, and flight number for all flights, including those that arrived on 04/12/2005 05:03, and also those that arrived on any other date?

SELECT origin, arrival_date, flno FROM flight WHERE arrival_date <> "04/12/2005 05:03" UNION ALL SELECT origin, arrival_date, flno FROM flight WHERE arrival_date = "04/12/2005 05:03"


Question: What are the driver IDs that are less than 2, and also the driver IDs from school buses that are not 9?

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


Question: What are the aircraft IDs greater than 3, considering both the aircraft and airport_aircraft tables, and combining the results?

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


Question: What are the IDs of drivers who are either not driver ID 4 in the driver table or not driver ID 4 in 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 != 4


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

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


Question: Which driver IDs are in the driver table, excluding driver ID 2, or are in the school bus table with driver ID 9?

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


Question: What are the names of counties that do not have a zip code of D09, excluding those counties where the County ID is less than 1 and the zip code is not D02 and the population is less than or equal to 21000, or the county name is not Manning?

SELECT County_name FROM county WHERE Zip_code <> "D09" EXCEPT SELECT County_name FROM county WHERE "County_Id" < 1 AND Zip_code != "D02" AND "Population" <= 21000.0 OR County_name <> "Manning"


Question: What are the aircraft IDs that are greater than 4 and also appear in the airport aircraft table, excluding aircraft ID 1?

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


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

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


Question: What are the aircraft IDs that are either 5 or greater, or less than 2?

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


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

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


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

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


Question: What are the maximum other details and receipt dates for documents, excluding those with "working" status or receipt number "79", or not received on "2005-09-30 00:10:02"? Also, what are the maximum other details and receipt dates for documents that don't have receipt number "189", or where the document status isn't "done" and the document ID is less than 23, the other details aren't "w", and the document type isn't "Hard Drive"?

SELECT MAX(other_details), receipt_date FROM Documents WHERE document_status_code <> "working" AND receipt_number <> "79" OR receipt_date <> "2005-09-30 00:10:02" UNION ALL SELECT MAX(other_details), receipt_date FROM Documents WHERE receipt_number <> "189" OR document_status_code != "done" AND "document_id" < 23 AND other_details != "w" AND document_type_code != "Hard Drive"


Question: Which driver IDs are not equal to 5, but are not found in the school bus table with driver IDs not equal to 9?

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


Question: Which driver IDs are greater than 2 but not less than 9, considering driver IDs from the driver and school bus tables?

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: What are the driver IDs that are either less than or equal to 6 or not equal to 10, considering driver IDs from both the driver and school bus tables?

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: Which driver IDs, excluding driver ID 4, are associated with drivers and have a driver ID greater than 1?

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


Question: Which driver IDs are not equal to 6 and are not present in the school bus table with driver ID 3?

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


Question: What are the Lieutenant Governor and Attorney General for parties that are not Democratic or where the US Senate is not Hillary Rodham Clinton, combined with the Lieutenant Governor and Attorney General for parties that are not Democratic or where the year is not 2002?

SELECT Lieutenant_Governor, Attorney_General FROM party WHERE Party != "Democratic" OR US_Senate <> "Hillary Rodham Clinton" UNION SELECT Lieutenant_Governor, Attorney_General FROM party WHERE Party != "Democratic" OR "Year" <> 2002.0


Question: How many school bus drivers have worked for more than 8 years or have a Driver ID of 4 or less, excluding those who are not full-time, and show whether they are full-time or not?

SELECT COUNT(Years_Working), If_full_time FROM school_bus WHERE "Years_Working" > 8 OR "Driver_ID" <= 4 EXCEPT SELECT COUNT(Years_Working), If_full_time FROM school_bus WHERE If_full_time != "T"


Question: What are the sales, headquarters, and profits for companies that aren't in the Conglomerate industry and don't have sales of 470.2 billion, or are named Petrobras and not headquartered in Germany, or have a company ID other than 5, or have profits greater than or equal to 16.2 billion and a market value other than 107.5 billion? Also, what are the sales, headquarters, and profits for companies headquartered in the USA or in the Banking industry, or named Royal Dutch Shell and have sales not equal to 221.9 billion, and a company ID less than or equal to 4, or have profits less than or equal to 20.5 billion?

SELECT Sales_in_Billion, Headquarters, Profits_in_Billion FROM company WHERE "Sales_in_Billion" != 470.2 AND Industry != "Conglomerate" OR Headquarters != "Germany" AND Name = "Petrobras" OR "Company_ID" <> 5.0 OR "Market_Value_in_Billion" <> 107.5 AND "Profits_in_Billion" >= 16.2 UNION SELECT Sales_in_Billion, Headquarters, Profits_in_Billion FROM company WHERE Headquarters = "USA" OR Industry = "Banking" OR Name = "Royal Dutch Shell" AND "Sales_in_Billion" <> 221.9 AND "Company_ID" <= 4.0 OR "Profits_in_Billion" <= 20.5


Question: What are the aircraft IDs that are less than 3 in the aircraft table, combined with the aircraft IDs that are less than 2 in the airport_aircraft table?

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


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

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


Question: Which driver IDs are not equal to 6 and are not found in the school bus table with driver IDs greater than or equal to 10?

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


Question: What is the average city code, age, last name, major, count of first names, sum of advisor, and sex for students where the age is greater than 18, or the first name is Ian and the student ID is greater than 1035, or the advisor is less than or equal to 1148, excluding those students who are 17 years old, named Michael, and not male, or whose major is 550 and last name is not Andreou?

AVG(city_code) Age LName Major COUNT(Fname) SUM(Advisor) Sex

SELECT AVG(city_code), Age, LName, Major, COUNT(Fname), SUM(Advisor), Sex FROM Student WHERE "Age" > 18 OR Fname = "Ian" AND "StuID" > 1035 OR "Advisor" <= 1148 EXCEPT SELECT AVG(city_code), Age, LName, Major, COUNT(Fname), SUM(Advisor), Sex FROM Student WHERE "Age" = 17 AND Fname = "Michael" AND Sex != "M" OR "Major" = 550 AND LName != "Andreou"


Question: What are the driver IDs, excluding driver ID 8, that are present in both the driver and school bus tables, where the driver ID is also less than or equal to 9 in the school bus table?

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


Question: What are the aircraft IDs that are not 3 and are present in the aircraft table but not in the airport_aircraft table with an ID less than 2?

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


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

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


Question: What are the airport IDs for airports in Norway that are not in Brussels, have an ID less than or equal to 6, and don't have the ICAO code EHAM, combined with the flight IDs for flights that did not occur on January 29, 1964?

SELECT id FROM airport WHERE City != "Brussels" AND "id" <= 6 AND ICAO != "EHAM" AND Country = "Norway" UNION ALL SELECT id FROM flight WHERE Date <> "January 29, 1964"


Question: What are the driver IDs that are both equal to 4 in the driver table and not equal to 3 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 <> 3


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

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


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

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


Question: What are the driver IDs that are less than 5 from the driver table, combined with the driver IDs that are less than 7 from the school bus table?

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


Question: What are the district IDs where the district is headquartered in Bhakkar City and the district ID is greater than 9, or the city population is not 464742, and also the district IDs where the store ID is not 3 or the district ID is less than 3?

SELECT District_ID FROM district WHERE Headquartered_City = "Bhakkar City" AND "District_ID" > 9 OR "City_Population" <> 464742.0 UNION SELECT District_ID FROM store_district WHERE "Store_ID" <> 3 OR "District_ID" < 3


Question: What are the driver IDs greater than 9, and also the driver IDs less than 4, considering both drivers and school buses?

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 are the driver IDs that are greater than or equal to 2, excluding those driver IDs that are not equal to 9, considering only the driver IDs from the driver table and 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: Which driver IDs are not equal to 6, but are not found in the school bus table with IDs greater than or equal to 10?

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


Question: What are the driver IDs that are not 3 and also appear in the school bus table with IDs greater than or equal to 7?

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


Question: What are the driver IDs greater than 5, and also what are the driver IDs less than or equal to 4?

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


Question: What are the driver IDs that are less than or equal to 5, excluding those with IDs greater than or equal to 10?

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: What are the aircraft IDs that are either less than or equal to 5, or greater 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: Which driver IDs are less than 12 but not equal to 4, considering only the driver IDs present in the driver table and excluding those in the school bus table?

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


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

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


Question: What are the country, building number, and zip code for addresses that are not "37698 Hahn Curve Apt. 572" and not in zip code "14445", and also for addresses that are not in "New Bernieceburgh" or not in "Georgia" with a zip code other than "75074", a building number other than "535 Ariel Brook", and a country other than "USA", where the address ID is 5 or greater?

USA
43235 Jazmin Mountain Suite 251
75074

SELECT country, line_1_number_building, zip_postcode FROM Addresses WHERE line_1_number_building != "37698 Hahn Curve Apt. 572" AND zip_postcode != "14445" INTERSECT SELECT country, line_1_number_building, zip_postcode FROM Addresses WHERE city <> "New Bernieceburgh" OR state_province_county != "Georgia" AND zip_postcode <> "75074" AND line_1_number_building <> "535 Ariel Brook" AND country != "USA" AND "address_id" >= 5


Question: Which driver IDs are present in both the driver and school bus tables, excluding driver ID 4 from the driver table and including only driver IDs greater than 9 from 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 > 9


Question: Which driver IDs are equal to 9, and also which driver IDs are not equal to 9, considering both driver and school bus information?

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


Question: Which driver IDs are less than or equal to 4, excluding driver ID 9?

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


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

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


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

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


Question: What are the aircraft IDs that are greater than or equal to 1, combined with the aircraft IDs that are less than or equal to 5?

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


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

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


Question: Which driver IDs are greater than 6 but not present in the school bus table with IDs greater 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: What are the IDs of people who either have not worked for at least 2 years or have a company ID of 11 or greater or don't have an ID of 4, combined with the IDs of people who are not from the United Kingdom and are named Tom Sheehey or are 27 years old or older or did not graduate from California?

SELECT People_ID FROM employment WHERE "Year_working" <> 2 OR "Company_ID" >= 11 OR "People_ID" != 4 UNION ALL SELECT People_ID FROM people WHERE Nationality <> "United Kindom" AND Name = "Tom Sheehey" OR "Age" >= 27 OR Graduation_College <> "California"


Question: What are the driver IDs greater than 9, excluding driver ID 3?

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


Question: Which driver IDs are not equal to 7, but are not also driver IDs from school buses with IDs less than or equal to 4?

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


Question: What are the names and IDs of the airports listed in the airport and airport_aircraft tables?

SELECT T1.Airport_Name, T2.Airport_ID FROM airport as T1 JOIN airport_aircraft as T2 ON T1.Airport_ID = T2.Airport_ID


Question: What are the minimum headquarters and market value in billions for companies that are not in the oil and gas industry or are headquartered in Brazil and have sales not equal to 110.8 billion, combined with the minimum headquarters and market value in billions for companies with sales of 110.8 billion and headquartered in China, or named Royal Dutch Shell, or with profits of 16.2 billion?

SELECT MIN(Headquarters), Market_Value_in_Billion FROM company WHERE Industry != "Oil and gas" OR Headquarters = "Brazil" AND "Sales_in_Billion" <> 110.8 UNION SELECT MIN(Headquarters), Market_Value_in_Billion FROM company WHERE "Sales_in_Billion" = 110.8 AND Headquarters = "China" OR Name = "Royal Dutch Shell" OR "Profits_in_Billion" = 16.2


Question: What are the driver IDs that are less than or equal to 7, excluding those with IDs less than 3, considering driver information from the 'driver' and 'school_bus' tables?

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


Question: What is the minimum city population in Gujrat City with a city area of 10.0, excluding the minimum city population where the city area is not 12.0, or the district name is not Bahawalnagar District and the district ID is not 1, or the city population is less than or equal to 219254.0?

SELECT MIN(City_Population) FROM district WHERE Headquartered_City = "Gujrat City" AND "City_Area" = 10.0 EXCEPT SELECT MIN(City_Population) FROM district WHERE "City_Area" <> 12.0 OR District_name != "Bahawalnagar District" AND "District_ID" != 1 OR "City_Population" <= 219254.0


Question: What are the IDs of people where the People ID is 7, combined with the IDs of poker players who have a money rank of 58 or less, or earnings over 189233, or a People ID of 7, or a best finish of 2 or less, or a poker player ID greater than 3?

SELECT People_ID FROM people WHERE "People_ID" = 7 UNION ALL SELECT People_ID FROM poker_player WHERE "Money_Rank" <= 58.0 OR "Earnings" > 189233.0 AND "People_ID" = 7 OR "Best_Finish" <= 2.0 OR "Poker_Player_ID" > 3


Question: Which customer IDs made payments that weren't on February 27, 2018 at 20:08:53, or had a customer ID other than 3, or paid less than 6970.98, but did not have a lesson date other than March 4, 2018 at 06:55:46, or a lesson status of "Cancelled", or a vehicle ID of 2?

SELECT customer_id FROM Customer_Payments WHERE datetime_payment != "2018-02-27 20:08:53" OR "customer_id" != 3 OR "amount_payment" < 6970.98 EXCEPT SELECT customer_id FROM Lessons WHERE lesson_date <> "2018-03-04 06:55:46" OR lesson_status_code = "Cancelled" OR "vehicle_id" = 2


Question: What are the driver IDs that are either less than or equal to 12 from the driver table, or less than 3 from the school bus table?

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


Question: What are the driver IDs that are greater than or equal to 1, excluding those driver IDs that are not equal to 3, from the driver and school bus tables?

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: Which driver IDs are greater than or equal to 10, but not equal to 4, considering only the driver IDs present in the driver table and excluding those in the school bus table?

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


Question: What are the first elected year, district, delegate, party, and counties represented for elections where the election ID is at least 1 and the committee is not "Environmental Matters (Vice-Chair)", or the party is less than 1? Also, what are the first elected year, district, delegate, party, and counties represented for elections in district 3 where the committee is not "Economic Matters", or the counties represented is "13" and the delegate is "Turner, Frank S. Frank S. Turner", or the party is 3?

Malone, James E. Jr. James E. Malone, Jr.

DeBoy, Steven J. Sr. Steven J. DeBoy, Sr.

SELECT First_Elected, District, Delegate, Party, Counties_Represented FROM election WHERE "Election_ID" >= 1 AND Committee != "Environmental Matters (Vice-Chair)" OR "Party" < 1 UNION SELECT First_Elected, District, Delegate, Party, Counties_Represented FROM election WHERE "District" = 3 AND Committee != "Economic Matters" OR Counties_Represented = "13" AND Delegate = "Turner, Frank S. Frank S. Turner" OR "Party" = 3


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

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


Question: What are the aircraft IDs that are not 2 and also have an ID of 5 or greater, considering both the aircraft and airport aircraft information?

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


Question: Which contestant numbers appear in the CONTESTANTS table, excluding Tabatha Gehling, or are less than 11, and also appear in the VOTES table with a contestant number of 3 or more, a creation date other than March 9, 2018 at 7:03 PM, or a phone number less than 6209222712, or a state other than CA?

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


Question: What are the driver IDs, excluding driver ID 9, and also any driver IDs less than 7, considering both drivers and school buses?

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


Question: Which school IDs are not in Los Angeles, California and not equal to 6, or have been working for at least 3 years or have a school ID greater than 7?

SELECT School_ID FROM school WHERE Location <> "Los Angeles, California" AND "School_ID" <> 6 UNION ALL SELECT School_ID FROM school_bus WHERE "Years_Working" >= 3 OR "School_ID" > 7


Question: Which driver IDs are less than 3, excluding those with ID 10, considering only driver IDs from the 'driver' and 'school_bus' tables?

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


Question: What are the driver IDs that are greater than or equal to 3, excluding those driver IDs that are not equal to 4?

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


Question: What are the driver IDs that are both less than or equal to 5 and also present in the school bus table with IDs less than 7?

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


Question: What are the aircraft IDs greater than 1 that are in the aircraft table but not in the airport_aircraft table, also considering only IDs greater than 1?

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


Question: What are the driver IDs, excluding driver ID 1, and also the driver IDs that are 3 or greater, from the driver and school bus tables?

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


Question: What are the driver IDs that are greater than or equal to 4, excluding those driver IDs greater than 3 that are also in the school bus table?

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


Question: What are the document status descriptions and codes, excluding those described as "mailed" or with the code "overdue", and also those that are "done" but not "currently working on"?

SELECT document_status_description, document_status_code FROM Ref_Document_Status WHERE document_status_description != "mailed" OR document_status_code <> "overdue" UNION ALL SELECT document_status_description, document_status_code FROM Ref_Document_Status WHERE document_status_description != "currently working on" AND document_status_code = "done"


Question: What are the driver IDs that are either greater than or equal to 10 in the driver table or not equal to 3 in the school bus table?

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


Question: What are the driver IDs that are present in both the driver table (with IDs greater than or equal to 1) and the school_bus table (with IDs less than or equal to 4)?

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


Question: What are the role codes and descriptions for roles that are not "MG" or not "Manager", combined with the role codes and descriptions for roles that are not "Manager" or not "ED"?

SELECT role_code, role_description FROM Roles WHERE role_code <> "MG" OR role_description != "Manager" UNION SELECT role_code, role_description FROM Roles WHERE role_description != "Manager" OR role_code != "ED"


Question: What are the years working and school ID for full-time school bus drivers, excluding those who are not full-time and have a driver ID other than 3 or have worked for 8 or more years?

SELECT Years_Working, School_ID FROM school_bus WHERE If_full_time = "T" EXCEPT SELECT Years_Working, School_ID FROM school_bus WHERE If_full_time != "T" AND "Driver_ID" != 3 OR "Years_Working" >= 8


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

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


Question: How many clubs from Russia have only one club ID, along with their names and the maximum start year, excluding those clubs not from Russia named "Helsingborgs IF" that started after 2011 and don't have exactly one club ID?

SELECT COUNT(Club_ID), Club_name, COUNT(Region), MAX(Start_year) FROM club WHERE Region = "Russia" GROUP BY Club_name HAVING COUNT(Club_ID) = 1 EXCEPT SELECT COUNT(Club_ID), Club_name, COUNT(Region), MAX(Start_year) FROM club WHERE Region != "Russia" AND Club_name = "Helsingborgs IF" GROUP BY Club_name HAVING MAX(Start_year) > 2011 AND COUNT(Club_ID) != 1


Question: What are the aircraft IDs that satisfy either the conditions where the total disk area is not "497 ft² (46.2 m²)" or the maximum disk loading is not "2.6 lb/ft² (14 kg/m²)", or where the aircraft ID is greater than or equal to 5, the aircraft is not "Mil Mi-26", the description is "Tandem rotor helicopter", and the maximum gross weight is "1,370 lb (635 kg)", and also appear in the airport_aircraft table with an ID other than 1?

SELECT Aircraft_ID FROM aircraft WHERE Total_disk_area <> "497 ft² (46.2 m²)" OR Max_disk_Loading <> "2.6 lb/ft² (14 kg/m²)" OR "Aircraft_ID" >= 5 AND Aircraft != "Mil Mi-26" AND Description = "Tandem rotor helicopter" AND Max_Gross_Weight = "1,370 lb (635 kg)" INTERSECT SELECT Aircraft_ID FROM airport_aircraft WHERE "ID" <> 1


Question: Which driver IDs are not 6, and which driver ID is 4, considering both drivers and school buses?

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


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

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: What are the driver IDs, excluding driver ID 2, and also the driver IDs that are 4 or greater, from the driver and school bus tables?

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 IDs are less than or equal to 5 but not equal to 9, considering only driver IDs present in the driver table and excluding those in the school bus table?

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


Question: What is the average district and the comptroller for each party, considering only parties where the Lieutenant Governor is not Jonathan Reiter or the number of election years is less than or equal to 2006?

SELECT AVG(T1.District), T2.Comptroller FROM election as T1 JOIN party as T2 ON T1.Party = T2.Party WHERE Lieutenant_Governor <> "Jonathan Reiter" OR COUNT(Year) <= 2006.0


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

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


Question: Which driver IDs are equal to 8 but not equal to 3, considering driver and school bus information?

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


Question: Which driver IDs are not equal to 11 and are not present in the school bus table with IDs less than 7?

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


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

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


Question: What are the driver IDs that are greater than 9 and also appear in the school bus table with IDs greater than or equal to 7?

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


Question: What are the driver IDs that are both greater than or equal to 7 in the driver table and equal to 10 in the school bus table?

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


Question: Which driver IDs are less than 8 but not equal to 4, considering driver IDs from the driver table and 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 = 4


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

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


Question: What are the driver IDs that are both greater than or equal to 10 in the driver table and greater than or equal to 3 in the school bus table?

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


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

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


Question: What are the driver IDs greater than 4, and also what are the driver IDs less than 4, considering both driver and school bus records?

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


Question: Can you show me the contestant number, phone number, creation date, state, and vote ID for votes in New York, or with a vote ID less than or equal to 2, or not created on March 9, 2018 at 7:03:39 PM, along with votes with a phone number greater than or equal to 7148407040?

SELECT contestant_number, phone_number, created, state, vote_id FROM VOTES WHERE state = "NY" OR "vote_id" <= 2 OR created <> "2018-03-09 19:03:39" UNION ALL SELECT contestant_number, phone_number, created, state, vote_id FROM VOTES WHERE "phone_number" >= 7148407040


Question: Which driver IDs are greater than or equal to 2, but not equal to 7, and are present in the driver table but not 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: What are the IDs of schools that are not named "Glenn" or that received donations from "Monte Plata"?

SELECT School_id FROM School WHERE School_name != "Glenn" UNION SELECT School_id FROM endowment WHERE donator_name = "Monte Plata"


Question: What are the driver IDs that are either greater than or equal to 12, or not equal to 10, considering driver and school bus information?

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


Question: Which driver IDs are either 8 or greater than 9?

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: What are the driver IDs that are either less than or equal to 5 from the driver table, or less than 9 from the school bus table?

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


Question: What are the aircraft IDs that are not 4 and also have an ID of 3 or greater in the airport aircraft table?

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


Question: What are the driver IDs that are less than 3, and also the driver IDs from school buses that are not 10?

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


Question: What are the driver IDs that are either greater than or equal to 7 in the driver table or not equal to 3 in 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: Which driver IDs, excluding ID 4, are present in both the driver and school bus records, excluding ID 10?

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


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

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


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

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


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

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


Question: What are the aircraft IDs that are equal to 4 in the aircraft table, but not aircraft IDs less than 2 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 < 2


Question: Can you list the age, name, nationality, graduation college, and people ID for people who are not from the United States or did not graduate from Oklahoma, along with those whose ID is 5, are under 30 and from the United States, or whose name is Darryl Kennedy?

SELECT Age, Name, Nationality, Graduation_College, People_ID FROM people WHERE Nationality != "United States" OR Graduation_College != "Oklahoma" UNION SELECT Age, Name, Nationality, Graduation_College, People_ID FROM people WHERE "People_ID" = 5 OR "Age" < 30 AND Nationality = "United States" OR Name = "Darryl Kennedy"


Question: What are the names of branches that are either named "Popert", opened in a year other than 2009, or not located in "London", but are not also the names of members who have a member ID of 8 or greater, a level of 6 or less, a hometown other than "LaGrange, Georgia", and are named "Myron Pryor" with card number "SLB51"?

SELECT Name FROM branch WHERE Name = "Popert" OR Open_year != "2009" OR City <> "London" EXCEPT SELECT Name FROM member WHERE "Member_ID" >= 8 OR "Level" <= 6 OR Hometown <> "LaGrange, Georgia" AND Name = "Myron Pryor" AND Card_Number = "SLB51"


Question: What are the aircraft IDs that are not 5, but are not aircraft IDs less than 5 in the airport aircraft table?

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


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

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


Question: Which driver IDs are less than or equal to 9 but not equal to 4, considering only those IDs present in the driver table but not in the school bus table?

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


Question: What is the maximum driver ID and the number of years worked for each driver, considering drivers who don't live in Manchester, have a school ID of 1, are older than 46 and have worked more than 8 years, are Democrats named Douglas McCrory, or work full-time? Then, exclude results where the home city is Bethel and the years worked are not more than 6, or the age is not 36, or the driver is not a Democrat, not full-time, and not Tim Larson, and has a school ID of at least 1?

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


Question: What are the contestant numbers and the maximum contestant names, excluding Jessie Eichman, and also what are the contestant numbers and maximum contestant names excluding contestant number 8?

SELECT contestant_number, MAX(contestant_name) FROM CONTESTANTS WHERE contestant_name != "Jessie Eichman" UNION SELECT contestant_number, MAX(contestant_name) FROM CONTESTANTS WHERE "contestant_number" <> 8


Question: What are the city codes and student IDs for students who are not from NYC or have a major of 600, and also for students who are at least 18 years old and have an advisor number less than 2311, or whose student ID is not 1006?

SELECT city_code, StuID FROM Student WHERE city_code != "NYC" OR "Major" = 600 UNION SELECT city_code, StuID FROM Student WHERE "Age" >= 18 AND "Advisor" < 2311 OR "StuID" != 1006


Question: Which school IDs are in the budget table for years up to 2001 with invested amounts no more than 95542 and a budget invested percentage not equal to 228.8 and a budgeted amount not equal to 119527, but are not in the endowment table where the endowment ID is 5 or greater and the school ID is not 4?

SELECT School_id FROM budget WHERE "Year" <= 2001 AND "Invested" <= 95542 AND Budget_invested_percent <> "228.8" AND "Budgeted" <> 119527 EXCEPT SELECT School_id FROM endowment WHERE "endowment_id" >= 5 AND "School_id" <> 4


Question: Which driver IDs are either 2 or 4 or greater?

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

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

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


Question: What are the driver IDs that appear in either the driver table with an ID of 10 or greater, or in the school bus table with an ID greater than 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: What are the aircraft IDs that are not equal to 5 and are not present in the airport aircraft table with IDs less than 2?

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


Question: What are the driver IDs greater than 6 that are also present in the school bus table with driver IDs of 3 or more?

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: What are the driver IDs that are less than 8 from the driver table, combined with the driver IDs that are less than or equal to 3 from the school bus table?

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


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

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: What are the aircraft IDs greater than 3 that are not present in the airport aircraft table, excluding aircraft ID 1?

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


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

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


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

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


Question: What are the aircraft IDs of aircraft that have a distance of at least 520, and also the aircraft IDs of certificates where the employee ID is at least 269734834 or the aircraft ID is less than or equal to 3?

SELECT aid FROM aircraft WHERE "distance" >= 520 UNION ALL SELECT aid FROM certificate WHERE "eid" >= 269734834 OR "aid" <= 3


Question: What are the driver IDs greater than 5 that are in the driver table but not in the school bus table where the driver IDs are less than 10?

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: What are the names of employees who are not Jason Hobson or are not 30 years old, excluding the names of shops that are FC Inter or have a Shop_ID of 2 or more, or have Mika Lehkosuo as manager but are not in the Tehtaan kenttä district?

SELECT Name FROM employee WHERE Name != "Jason Hobson" OR "Age" != 30 EXCEPT SELECT Name FROM shop WHERE Name = "FC Inter" OR "Shop_ID" >= 2 OR Manager_name = "Mika Lehkosuo" AND District <> "Tehtaan kenttä"


Question: What are the names of companies that have profits less than 10.3 billion, or are named Chevron, or have assets less than or equal to 213 billion and sales less than 447 billion and a market value less than or equal to 294.7 billion, or are not headquartered in the USA? Also, what are the names of people who have a people ID greater than 2, are older than 37, did not graduate from Northeastern, are not of United Kingdom nationality, or are not named David Butler?

SELECT Name FROM company WHERE "Profits_in_Billion" < 10.3 OR Name = "Chevron" OR "Assets_in_Billion" <= 213.0 AND "Sales_in_Billion" < 447.0 AND "Market_Value_in_Billion" <= 294.7 OR Headquarters != "USA" UNION SELECT Name FROM people WHERE "People_ID" > 2 AND "Age" > 37 AND Graduation_College <> "Northeastern" AND Nationality <> "United Kindom" OR Name != "David Butler"


Question: Which driver IDs are either 2 or greater than 9?

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


Question: Which driver IDs are less than 10 and are in the driver table but not 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: Which driver IDs are not equal to 5 and are not found in the school bus table with driver IDs greater than or equal to 9?

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


Question: What are the driver IDs greater than 7, and also the driver ID that is 4, considering both drivers and school buses?

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


Question: What are the IDs of drivers who are not driver 9, or the IDs of school buses that are not bus 10?

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


Question: What are the document IDs that meet either of these conditions: the employee ID is at least 2, or the copy number is less than 4 and the draft number is greater than 20, or the document ID is not 10; and also meet either of these conditions: the copy number is greater than 4, or the draft number is less than 2 and the document ID is at least 2?

SELECT document_id FROM Circulation_History WHERE "employee_id" >= 2 OR "copy_number" < 4 AND "draft_number" > 20 OR "document_id" <> 10 INTERSECT SELECT document_id FROM Draft_Copies WHERE "copy_number" > 4 OR "draft_number" < 2 AND "document_id" >= 2


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

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


Question: What is the count and average address ID for addresses where the address ID is less than or equal to 0, combined with the count and average address ID for addresses where the address ID is less than 1?

SELECT COUNT(address_details), AVG(address_id) FROM Addresses WHERE "address_id" <= 0 UNION SELECT COUNT(address_details), AVG(address_id) FROM Addresses WHERE "address_id" < 1


Question: What are the driver IDs less than 7 from the driver table and the driver IDs less than 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: What driver IDs are present in both the driver table (excluding driver ID 11) and the school bus table (specifically driver ID 7)?

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


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

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


Question: Which school IDs are in the School table but not in the endowment table, considering schools that don't have an enrollment of 379, or are not in IHSAA football class AA, or don't have the mascot "Redskins", or are not in St. Joseph County, and also excluding schools with a school ID greater than or equal to 3 or an endowment ID greater than or equal to 11?

SELECT School_id FROM School WHERE "Enrollment" != 379 OR IHSAA_Football_Class != "AA" OR Mascot != "Redskins" OR County <> "71 St. Joseph" EXCEPT SELECT School_id FROM endowment WHERE "School_id" >= 3 OR "endowment_id" >= 11


Question: What are the airport IDs that are not in Denmark, but are not also flight IDs where the flight ID is not 10, the pilot is Thompson, the altitude is over 3650, and the vehicle flight number is not M2-F1 #13?

SELECT id FROM airport WHERE Country != "Denmark" EXCEPT SELECT id FROM flight WHERE "id" <> 10 AND Pilot = "Thompson" AND "Altitude" > 3650.0 AND Vehicle_Flight_number <> "M2-F1 #13"


Question: How many staff IDs are there in Lessons where the staff ID is less than or equal to 1 and the price isn't 277, or the customer ID is less than 6, or the lesson status is Cancelled and the lesson date is February 26, 2018, or the vehicle ID isn't 1 and the lesson time isn't 9? Also, how many staff IDs are there in Staff where the middle name isn't Caesar, or the last name is Weissnat, or the first name is Ernestina, or the staff address ID isn't 12, or the date of birth isn't June 13, 2000, or the nickname isn't ynader and the date joined staff isn't June 4, 2017, or the staff ID is less than 13?

SELECT COUNT(staff_id) FROM Lessons WHERE "staff_id" <= 1 AND "price" <> 277.0 OR "customer_id" < 6 OR lesson_status_code = "Cancelled" AND lesson_date = "2018-02-26 02:36:35" OR "vehicle_id" != 1 AND lesson_time != "9" UNION ALL SELECT COUNT(staff_id) FROM Staff WHERE middle_name <> "Caesar" OR last_name = "Weissnat" OR first_name = "Ernestina" OR "staff_address_id" != 12 OR date_of_birth != "2000-06-13 18:09:11" OR nickname != "ynader" AND date_joined_staff != "2017-06-04 14:30:41" OR "staff_id" < 13


Question: What is the highest People ID from the employment table where the year worked is not 4, excluding the highest People ID from the people table where the graduation college is Wisconsin–Stevens Point or the name is not Tim Naegeli and the People ID is 5 or greater?

SELECT MAX(People_ID) FROM employment WHERE "Year_working" <> 4 EXCEPT SELECT MAX(People_ID) FROM people WHERE Graduation_College = "Wisconsin–Stevens Point" OR Name != "Tim Naegeli" AND "People_ID" >= 5


Question: What is the highest club ID from clubs that are not in the UK or have a club ID less than or equal to 1 and are not named Djurgårdens IF, combined with the highest club ID from match results where the club ID is greater than or equal to 2 or the rank is not 6 and the small silver value is not 6?

SELECT MAX(Club_ID) FROM club WHERE Region != "UK" OR "Club_ID" <= 1 AND Club_name != "Djurgårdens IF" UNION SELECT MAX(Club_ID) FROM match_result WHERE "Club_ID" >= 2 OR "Rank" != 6 AND "Small_Silver" <> 6


Question: What are the aircraft IDs that are both greater than or equal to 2 and less than or equal to 5?

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


Question: What are the names, levels, and hometowns of members from Jacksonville, Florida or Columbia, South Carolina?

Ventrell Jenkins
6
Columbia, South Carolina

SELECT Name, Level, Hometown FROM member WHERE Hometown = "Jacksonville, Florida" UNION SELECT Name, Level, Hometown FROM member WHERE Hometown = "Columbia, South Carolina"


Question: For addresses, show the building number, the earliest state/province/county, the latest city, the sum of the country, the zip code, and the address ID. Include addresses where the building number isn't "053 Quigley Island", or the city is "Buckridgehaven", or the state/province/county isn't "Louisiana" and the address ID is less than or equal to 5 and the zip code isn't "00005". Also include addresses where the state/province/county isn't "Georgia" and the city is "Ericamouth", or the country isn't "USA", or the zip code isn't "99903" and the building number isn't "484 O'Hara Drive", or the address ID isn't 13.

SELECT line_1_number_building, MIN(state_province_county), MAX(city), SUM(country), zip_postcode, address_id FROM Addresses WHERE line_1_number_building != "053 Quigley Island" OR city = "Buckridgehaven" OR state_province_county != "Louisiana" AND "address_id" <= 5 AND zip_postcode <> "00005" UNION ALL SELECT line_1_number_building, MIN(state_province_county), MAX(city), SUM(country), zip_postcode, address_id FROM Addresses WHERE state_province_county <> "Georgia" AND city = "Ericamouth" OR country <> "USA" OR zip_postcode != "99903" AND line_1_number_building != "484 O'Hara Drive" OR "address_id" != 13


Question: Which driver IDs are greater than 6, and also the driver ID 7, from the driver and school bus tables?

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


Question: What are the driver IDs that are less than 3 in the driver table, combined with the driver IDs that are less than 4 in the school bus table?

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


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

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


Question: Which driver IDs are greater than or equal to 10 in the driver table but not present in the school bus table with driver IDs less than or 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: What are the driver IDs that are either less than or equal to 5 or greater than 4, considering both driver and school bus information?

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


Question: What are the driver IDs that are less than 9 and also appear in the school bus table, excluding driver ID 9?

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


Question: What are the names of companies that are not headquartered in China and have assets not equal to 292.5 billion, or sales greater than or equal to 117.6 billion, or are in the banking industry, or have profits of 26.9 billion, or are named General Electric, or have a company ID of 5, or have a market value not equal to 294.7 billion? Also, what are the names of people who are from the United States, are not named Brad Lohaus, and are 31 years old or younger?

SELECT Name FROM company WHERE Headquarters != "China" AND "Assets_in_Billion" != 292.5 OR "Sales_in_Billion" >= 117.6 OR Industry = "Banking" OR "Profits_in_Billion" = 26.9 OR Name = "General Electric" OR "Company_ID" = 5.0 OR "Market_Value_in_Billion" <> 294.7 UNION SELECT Name FROM people WHERE Nationality = "United States" AND Name <> "Brad Lohaus" AND "Age" <= 31


Question: Which driver IDs, excluding driver ID 11, are found in the driver table, and which driver IDs greater than 3 are found in the school bus table?

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


Question: What are the driver IDs greater than 2, and also the driver IDs less than or equal to 3, considering both driver and school bus records?

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


Question: What are the aircraft IDs that are not 4, excluding those aircraft IDs less than 2, considering the aircraft and airport-aircraft tables?

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


Question: Which driver IDs are less than 3, and also driver ID 7, considering both driver and school bus information?

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


Question: Which driver IDs are equal to 5, or greater than 10?

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


Question: What are the driver IDs, excluding driver ID 1, and also the driver IDs up to 9, that are associated with either drivers or school buses?

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


Question: What is the maximum maker name from the car makers table where the maker is Nissan and the ID is less than 15, excluding the maximum maker name from the model list table where the maker is less than 5 and the model is not Mercedes-Benz or the model ID is less than or equal to 36?

SELECT MAX(Maker) FROM car_makers WHERE Maker = "nissan" AND "Id" < 15 EXCEPT SELECT MAX(Maker) FROM model_list WHERE "Maker" < 5 AND Model != "mercedes-benz" OR "ModelId" <= 36


Question: What are the feature type codes that are either not feature ID 4 and not "BurglarAlarm", or have a description of "Air Conditioning.", or are "Security", and also have a feature type code of "Security" but a feature type name that is not "Amenity, eg Pool."?

SELECT feature_type_code FROM Other_Available_Features WHERE "feature_id" <> 4 AND feature_name != "BurglarAlarm" OR feature_description = "Air Conditioning." OR feature_type_code = "Security" INTERSECT SELECT feature_type_code FROM Ref_Feature_Types WHERE feature_type_code = "Security" AND feature_type_name != "Amenity, eg Pool."


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

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


Question: Which driver IDs are greater than 5 and also appear in the school bus table, excluding driver ID 3?

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


Question: Which driver IDs are equal to 6 but not greater than or equal to 9, considering driver IDs from the driver and school bus tables?

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


Question: Which driver IDs are less than 11 but not greater than 9, considering only the driver IDs present in the driver table and excluding those in the school bus table?

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


Question: What are the district IDs, and for which districts, is the headquartered city not "Bahawalnagar City", the store ID is at least 1, and the city population is greater than 314617, grouped by headquartered city?

SELECT T1.District_ID, T2.District_ID FROM district as T1 JOIN store_district as T2 ON T1.District_ID == T2.District_ID GROUP BY Headquartered_City HAVING Headquartered_City <> "Bahawalnagar City" AND Store_ID >= 1 AND City_Population > 314617.0


Question: What are the driver IDs that are not 7 and are also present in the school bus table with a driver ID of 4?

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


Question: What are the aircraft IDs that are not 4 and are not in the airport_aircraft table with IDs greater than 2?

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


Question: What are the driver IDs, excluding driver ID 7, and also the driver IDs that are 7 or less, from the driver and school bus tables?

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


Question: What is the highest aircraft ID for aircraft with a distance less than 1502 and not named "Airbus A320" and not ID 6, and also the highest aircraft ID from the certificate table where the ID is not 8?

SELECT MAX(aid) FROM aircraft WHERE "distance" < 1502 AND name <> "Airbus A320" AND "aid" <> 6 UNION ALL SELECT MAX(aid) FROM certificate WHERE "aid" != 8


Question: What are the player IDs of players who meet at least one of the following conditions: they are ranked 2nd, their sponsor is not Winnipeg South and they are male, they have more than 14355 votes, their player ID is less than or equal to 14, or their player name is not Matt Schaubroeck, and also have a coach ID of 5 or greater?

SELECT Player_ID FROM player WHERE Rank = "2nd" OR Sponsor_name <> "Winnipeg South" AND Gender = "M" OR "Votes" > 14355 OR "Player_ID" <= 14 OR Player_name <> "Matt Schaubroeck" INTERSECT SELECT Player_ID FROM player_coach WHERE "Coach_ID" >= 5


Question: Which driver IDs are less than or equal to 8, but not found in the school bus table with driver IDs less than or equal to 4?

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


Question: What are the aircraft IDs, excluding ID 2, from the aircraft table, combined with the aircraft IDs, excluding ID 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: What are the aircraft IDs greater than 3 that are not present in the airport aircraft table, excluding those with an ID of 1?

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


Question: Which driver IDs are not equal to 8 but are not present in school buses with driver IDs greater than 9?

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