Question: Can you give me the School IDs and endowment IDs for endowments that either don't have an endowment ID of 6 or have a donator named "Com. Dom. En Estados Unidos", but exclude any School IDs and endowment IDs where the donator name is not "Com. Dom. En Estados Unidos"?

SELECT School_id, endowment_id FROM endowment WHERE "endowment_id" <> 6 OR donator_name = "Com. Dom. En Estados Unidos" EXCEPT SELECT School_id, endowment_id FROM endowment WHERE donator_name <> "Com. Dom. En Estados Unidos"


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

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


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

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


Question: Can you give me the Comptroller, Governor, Year, US Senator, Lieutenant Governor, Party, and Attorney General from the partyparty table where the Comptroller isn't Alan Hevesi, the Lieutenant Governor is Dennis Mehiel, the US Senator isn't Hillary Rodham Clinton, and the Attorney General isn't Eliot Spitzer, or where the Party ID is less than 5 and the Year is before 2006 and the Governor isn't Betsy McCaughey Ross, but only if they also meet the criteria of not having David Paterson as Lieutenant Governor, or not having Alan Hevesi as Comptroller and not having Andrew Cuomo as Attorney General, or not having the year as 2006 and not having Hillary Rodham Clinton as US Senator, or having a Party ID of 2 or less and not being part of the Liberal party?

Alan Hevesi
Carl McCall
2002
(no election)
Dennis Mehiel
Democratic
Eliot Spitzer

Carl McCall
Peter Vallone
1998
Charles Schumer
Sandra Frankel
Democratic
Eliot Spitzer

John Faso
Tom Golisano
2002
(no election)
Mary Donohue
Independence
Eliot Spitzer

SELECT Comptroller, Governor, Year, US_Senate, Lieutenant_Governor, Party, Attorney_General FROM party WHERE Comptroller <> "Alan Hevesi" AND Lieutenant_Governor = "Dennis Mehiel" AND US_Senate <> "Hillary Rodham Clinton" AND Attorney_General != "Eliot Spitzer" OR "Party_ID" < 5 AND "Year" < 2006.0 AND Governor != "Betsy McCaughey Ross" INTERSECT SELECT Comptroller, Governor, Year, US_Senate, Lieutenant_Governor, Party, Attorney_General FROM party WHERE Lieutenant_Governor <> "David Paterson" OR Comptroller <> "Alan Hevesi" AND Attorney_General <> "Andrew Cuomo" OR "Year" != 2006.0 AND US_Senate <> "Hillary Rodham Clinton" OR "Party_ID" <= 2 AND Party <> "Liberal"


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


Question: Can you give me a list of driver IDs that are not equal to 2 from the driver table, but are also less than or equal to 7 from the school bus table?

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


Question: What is the average student ID for students with allergies other than nuts, combined with the average student ID for students whose advisor number is less than or equal to 8722, student ID is greater than 1011, first name is not Stacy, and last name is Kumar?

SELECT AVG(StuID) FROM Has_Allergy WHERE Allergy != "Nuts" UNION ALL SELECT AVG(StuID) FROM Student WHERE "Advisor" <= 8722 AND "StuID" > 1011 AND Fname <> "Stacy" AND LName = "Kumar"


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

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


Question: Can you list all the driver IDs that are less than 3, combining the unique IDs from both the driver and school bus lists?

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


Question: Can you give me a list of driver IDs, including those from the driver table where the ID is not 7, and those from the school_bus table where the ID is 3 or greater?

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


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

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


Question: Can you list the driver IDs that are less than or equal to 10 from the driver table, and also list the driver IDs that are less than or equal to 7 from the school bus table, combining the two lists into one?

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


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

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: Can you list all the aircraft IDs, first from the aircraft table excluding ID 2, and then from the airport_aircraft table including only those with IDs up to 5, combining the two lists?

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


Question: Can you give me a list of aircraft IDs that are less than 3, excluding those aircraft IDs that are less than or equal to 1 and are also associated with an airport?

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


Question: Can you give me the document IDs from the Documents table, excluding those in the Draft_Copies table, where the Documents meet at least one of these conditions: the receipt date isn't April 3rd, 2015 at 9:36 AM, the document ID is greater than 12, or the document type isn't "Hard Drive" and the document status isn't "overdue"; and excluding the document IDs from Draft_Copies where the draft number is greater than 20 and the document ID isn't 12?

SELECT document_id FROM Documents WHERE receipt_date != "2015-04-03 09:36:19" OR "document_id" > 12 OR document_type_code <> "Hard Drive" AND document_status_code <> "overdue" EXCEPT SELECT document_id FROM Draft_Copies WHERE "draft_number" > 20 AND "document_id" != 12


Question: Could you list the name, distance, and aid for all aircraft that either have a distance of 6475, are named "Lockheed L1011", or have an aid of 13, and also include the name, distance, and aid for all aircraft named "Boeing 777-300"?

SELECT name, distance, aid FROM aircraft WHERE "distance" = 6475 OR name = "Lockheed L1011" OR "aid" = 13 UNION ALL SELECT name, distance, aid FROM aircraft WHERE name = "Boeing 777-300"


Question: Which aircraft IDs are present in the aircraft table, excluding aircraft ID 3, and also have an aircraft ID of 2 or greater in the airport_aircraft table?

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


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

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


Question: Can you give me a list of driver IDs, combining those from the driver table excluding driver ID 5 with those from the school bus table excluding driver ID 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: Which driver IDs are both equal to 9 in the driver table and less than 10 in the school_bus table?

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


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

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


Question: Can you list all driver IDs that are less than 3, including those from the driver table and the school bus table, but only showing each ID once?

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


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

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


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

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


Question: Can you give me the role codes that are common between employees who aren't named Erling or don't have "f" in other details, or whose role code isn't MG and whose employee ID is less than 7, and roles where the description is "Proof Manager" or the role code isn't ED?

SELECT role_code FROM Employees WHERE employee_name != "Erling" AND other_details != "f" OR role_code != "MG" AND "employee_id" < 7 INTERSECT SELECT role_code FROM Roles WHERE role_description = "Proof Manager" OR role_code != "ED"


Question: What are the highest product ID and the number of stores, considering only stores that aren't store 2 or products with an ID greater than 6, and also considering only stores that aren't store 1 or products with an ID less than 3?

SELECT MAX(Product_ID), COUNT(Store_ID) FROM store_product WHERE "Store_ID" != 2 OR "Product_ID" > 6 UNION ALL SELECT MAX(Product_ID), COUNT(Store_ID) FROM store_product WHERE "Store_ID" <> 1 OR "Product_ID" < 3


Question: Can you give me a list of driver IDs, where each ID is greater than 4, but not including any driver IDs that are also in the school bus list and are greater than 10?

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


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

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


Question: Can you list whether the bus drivers are full-time if their ID is 10 or less, and also list whether the bus drivers are full-time if they are not marked as "T"?

SELECT If_full_time FROM school_bus WHERE "Driver_ID" <= 10 UNION SELECT If_full_time FROM school_bus WHERE If_full_time != "T"


Question: Can you list the department IDs and temporary acting status for all entries in the management table where the department ID is not 15, and also include the department IDs and temporary acting status for all entries where the department ID is greater than 7?

SELECT department_ID, temporary_acting FROM management WHERE "department_ID" != 15 UNION ALL SELECT department_ID, temporary_acting FROM management WHERE "department_ID" > 7


Question: What is the highest model name from the car names table where the MakeId is less than or equal to 26, combined with the highest model name from the model list table where the ModelId is less than or equal to 20 or the model name is not "volvo"?

SELECT MAX(Model) FROM car_names WHERE "MakeId" <= 26 UNION SELECT MAX(Model) FROM model_list WHERE "ModelId" <= 20 OR Model <> "volvo"


Question: Which driver IDs, that are at least 6, are not also school bus driver IDs that are at least 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: Can you give me a list of driver IDs that are less than 4 from the driver table, combined with a list of driver IDs that are exactly 10 from the school bus table?

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


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

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


Question: Can you list the student ID, major, city code, and first name for all students, excluding those with a student ID greater than 1034, but including any student who either has a major of 600 or higher, or a first name other than Jun and a student ID of 1015 or higher, or an age of 20 or younger and an advisor number of 2311 or lower, or a last name other than Simms, or is male and not from PIT?

SELECT StuID, Major, city_code, Fname FROM Student WHERE "Major" >= 600 OR Fname != "Jun" AND "StuID" >= 1015 OR "Age" <= 20 AND "Advisor" <= 2311 OR LName != "Simms" OR Sex = "M" AND city_code != "PIT" EXCEPT SELECT StuID, Major, city_code, Fname FROM Student WHERE "StuID" > 1034


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

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: Can you give me a list of driver IDs, including driver ID 6 from the driver table and all driver IDs less than 10 from the school_bus table?

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


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

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


Question: Can you give me a list of aircraft IDs, excluding aircraft ID 2, that are in the aircraft table but not in the airport_aircraft table, where only aircraft IDs greater than 2 are considered in the airport_aircraft table?

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


Question: Could you list the property IDs that either have feature ID 3 or are not of the 'Other' property type, have a property ID greater than 10, have a value other than "None" for oth_feature_3, and have a value other than "None" for fld_feature_1?

SELECT property_id FROM Other_Property_Features WHERE "feature_id" = 3 UNION ALL SELECT property_id FROM Properties WHERE property_type_code != "Other" OR "property_id" > 10 AND oth_feature_3 != "None" AND fld_feature_1 <> "None"


Question: Can you give me a list of driver IDs, excluding those equal to 4, that are greater than 8 and appear in the driver 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: Can you give me a list of driver IDs that are greater than 3, excluding those driver IDs that are also less than or equal to 10 and associated with a school bus?

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: Can you list all aircraft IDs, including aircraft ID 1 from the aircraft table and all aircraft IDs except 2 from the airport_aircraft table?

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


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

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

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


Question: What is the highest album ID, excluding the album titled "House of Pain", and what is the highest genre ID when the ID is 16?

SELECT MAX(id) FROM albums WHERE title <> "House of Pain" UNION ALL SELECT MAX(id) FROM genres WHERE "id" = 16


Question: Can you show me the market value in billions and years working for companies, grouped by profits in billions, but only for groups where sales in billions are at least 433.5, or the years working are at least 1 and profits in billions are greater than 21.5, or the people ID is less than 4?

SELECT T1.Market_Value_in_Billion, T2.Year_working FROM company as T1 JOIN employment as T2 ON T1.Company_ID == T2.Company_ID GROUP BY Profits_in_Billion HAVING Sales_in_Billion >= 433.5 OR Year_working >= 1 AND Profits_in_Billion > 21.5 OR People_ID < 4


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

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


Question: Can you show me the maximum disk loading and aircraft name for all aircraft where either the maximum gross weight is not 123,500 lb (56,000 kg) or the total disk area is 497 ft² (46.2 m²) and the description is not "Heavy-lift helicopter", combined with the maximum disk loading and aircraft name for all aircraft where the total disk area is 872 ft² (81.1 m²) or the aircraft ID is greater than 5 or the maximum disk loading is not 2.6 lb/ft² (14 kg/m²) or the description is "Light utility helicopter" and the aircraft name is not "Mil Mi-26"?

3.7 lb/ft² (18 kg/m²)
Bell 206B3 JetRanger

15 lb/ft² (72 kg/m²)
CH-53E Super Stallion

3.7 lb/ft² (18 kg/m²)
Bell 206B3 JetRanger

15 lb/ft² (72 kg/m²)
CH-53E Super Stallion

SELECT Max_disk_Loading, Aircraft FROM aircraft WHERE Max_Gross_Weight <> "123,500 lb (56,000 kg)" OR Total_disk_area = "497 ft² (46.2 m²)" AND Description <> "Heavy-lift helicopter" UNION ALL SELECT Max_disk_Loading, Aircraft FROM aircraft WHERE Total_disk_area = "872 ft² (81.1 m²)" OR "Aircraft_ID" > 5 OR Max_disk_Loading <> "2.6 lb/ft² (14 kg/m²)" OR Description = "Light utility helicopter" AND Aircraft != "Mil Mi-26"


Question: Which item titles are not "cup" and also have an i_id that is not 1 or are not named "blue hoodie"?

SELECT title FROM item WHERE title != "cup" INTERSECT SELECT title FROM item WHERE "i_id" <> 1 OR title != "blue hoodie"


Question: Which driver IDs, other than 9, are present in both the driver and school bus records?

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


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

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


Question: Which driver IDs are both not equal to 5 and also less than or equal to 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: Can you list the aircraft IDs from the aircraft table that are greater than or equal to 4, and combine that with a list of aircraft IDs from the airport_aircraft table that are not equal to 3?

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


Question: Can you give me a list of aircraft IDs that appear in the aircraft table, excluding aircraft ID 4, but then remove any aircraft IDs from that list that also appear in the airport_aircraft table with an ID of 3 or less?

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


Question: Can you give me a list of store IDs that are either located in a city mall or sell products other than product ID 6?

SELECT Store_ID FROM store WHERE Type = "City Mall" UNION SELECT Store_ID FROM store_product WHERE "Product_ID" != 6


Question: Can you give me a list of driver IDs, excluding driver ID 1 from the driver table, combined with a list of driver IDs, excluding driver ID 10 from the school bus table?

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


Question: Can you show me the sales in billions, industry, largest company name, number of companies, smallest company ID, number of profitable companies, and largest headquarters for all companies, first excluding those in the banking industry, and then including only those with profits of 21.5 billion or less?

SELECT Sales_in_Billion, Industry, MAX(Name), COUNT(Assets_in_Billion), MIN(Company_ID), COUNT(Profits_in_Billion), MAX(Headquarters) FROM company WHERE Industry != "Banking" UNION ALL SELECT Sales_in_Billion, Industry, MAX(Name), COUNT(Assets_in_Billion), MIN(Company_ID), COUNT(Profits_in_Billion), MAX(Headquarters) FROM company WHERE "Profits_in_Billion" <= 21.5


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

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


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

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


Question: Could you please list the draft numbers and document IDs that appear both in the Document_Drafts table where the draft details are not "a" and the draft number is greater than 10, and in the Draft_Copies table where the draft number is greater than or equal to 9 and the document ID is 10?

SELECT draft_number, document_id FROM Document_Drafts WHERE draft_details != "a" AND "draft_number" > 10 INTERSECT SELECT draft_number, document_id FROM Draft_Copies WHERE "draft_number" >= 9 AND "document_id" = 10


Question: Can you give me the property type codes that appear in both the list of properties with certain feature combinations, price ranges, and address details, and the list of property types excluding "Other, to be determined" and "Apartment"?

SELECT property_type_code FROM Properties WHERE apt_feature_2 != "est" OR shp_feature_1 <> "None" AND fld_feature_1 = "None" AND hse_feature_2 <> "None" OR apt_feature_1 <> "et" OR date_on_market <> "1986-12-31 10:05:32" AND oth_feature_2 = "None" OR "buyer_offered_price" < 0.0 AND property_type_code <> "Apartment" OR hse_feature_3 <> "None" OR oth_feature_1 <> "None" AND "property_id" <> 3 AND other_property_details = "None" AND date_sold != "1997-01-07 19:52:45" AND property_address <> "986 Hagenes Drives Draketon, UT 83411-3393" AND fld_feature_2 != "None" AND shp_feature_3 <> "None" OR hse_feature_1 <> "None" AND "vendor_requested_price" <> 6713620.9 AND property_name != "parc coliseum" INTERSECT SELECT property_type_code FROM Ref_Property_Types WHERE property_type_description <> "Other, to be determined." OR property_type_code != "Apartment"


Question: Which aircraft IDs, excluding aircraft ID 2, are also aircraft IDs that are greater than or equal to 2 in the airport aircraft list?

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


Question: Can you give me a list of properties, including their apt_feature_1, the minimum oth_feature_1, property_id, the maximum property_type_code, the minimum apt_feature_2, fld_feature_2, date_sold, the average shp_feature_2, apt_feature_3, shp_feature_1, fld_feature_3, the count of room_count, hse_feature_1, agreed_selling_price, other_property_details, property_address, fld_feature_1, the maximum oth_feature_3, the minimum vendor_requested_price, the sum of property_name, the count of hse_feature_3, the maximum shp_feature_3, and buyer_offered_price, considering properties where the property_id is less than or equal to 7, or where certain feature fields and details don't have specific values like "None", "Field", or specific numbers and dates, and can you combine this with a similar list of properties where different feature fields, details, and dates don't match certain values or fall within specific criteria?

986 Hagenes Drives
Draketon, UT 83411-3393

SELECT apt_feature_1, MIN(oth_feature_1), property_id, MAX(property_type_code), MIN(apt_feature_2), fld_feature_2, date_sold, AVG(shp_feature_2), apt_feature_3, shp_feature_1, fld_feature_3, COUNT(room_count), hse_feature_1, agreed_selling_price, other_property_details, property_address, fld_feature_1, MAX(oth_feature_3), MIN(vendor_requested_price), SUM(property_name), COUNT(hse_feature_3), MAX(shp_feature_3), buyer_offered_price FROM Properties WHERE "property_id" <= 7 OR property_type_code != "Field" AND oth_feature_1 != "None" AND fld_feature_3 != "None" AND shp_feature_2 <> "None" OR oth_feature_3 != "None" OR fld_feature_2 != "None" AND "room_count" != 2 OR shp_feature_1 = "None" AND date_sold = "2012-08-19 07:36:57" AND apt_feature_1 <> "aut" AND other_property_details <> "None" AND property_name <> "longacre" OR apt_feature_3 != "None" OR "vendor_requested_price" <> 983.8596 OR "agreed_selling_price" >= 44132.4621 AND property_address != "4745 Emerson Stravenue Suite 829 South Garret, IN 16772-5682" OR shp_feature_3 <> "None" AND fld_feature_1 <> "None" OR oth_feature_2 = "None" AND "buyer_offered_price" <> 2.0 AND hse_feature_2 = "None" OR apt_feature_2 != "est" AND hse_feature_3 = "None" AND date_on_market = "1978-05-15 10:53:37" UNION SELECT apt_feature_1, MIN(oth_feature_1), property_id, MAX(property_type_code), MIN(apt_feature_2), fld_feature_2, date_sold, AVG(shp_feature_2), apt_feature_3, shp_feature_1, fld_feature_3, COUNT(room_count), hse_feature_1, agreed_selling_price, other_property_details, property_address, fld_feature_1, MAX(oth_feature_3), MIN(vendor_requested_price), SUM(property_name), COUNT(hse_feature_3), MAX(shp_feature_3), buyer_offered_price FROM Properties WHERE date_sold != "1971-04-14 03:23:49" OR shp_feature_3 != "None" AND apt_feature_1 = "et" OR hse_feature_2 = "None" AND fld_feature_2 != "None" OR "buyer_offered_price" >= 2.0 OR oth_feature_2 != "None" AND property_type_code = "Other" AND property_address != "6837 Darien Views Apt. 475 South Maraview, KS 77770" AND oth_feature_3 = "None" OR shp_feature_1 = "None" AND "vendor_requested_price" = 661536468.4429 AND hse_feature_3 = "None" OR "room_count" > 2 OR apt_feature_3 <> "None" AND property_name <> "parc coliseum" AND hse_feature_1 != "None" AND "property_id" = 12 OR "agreed_selling_price" <> 4514.807 AND shp_feature_2 <> "None" AND oth_feature_1 = "None" OR date_on_market = "1994-02-14 02:27:13" AND fld_feature_1 <> "None" OR apt_feature_2 != "iusto" AND fld_feature_3 = "None" OR other_property_details != "None"


Question: Can you give me a list of aircraft IDs that are greater than 4, and also not equal to 2, based on the aircraft and airport aircraft information?

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


Question: Can you list the aircraft IDs from the aircraft table where the aircraft ID is 2, combined with the aircraft IDs from the airport_aircraft table where the aircraft ID is less than 5?

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


Question: Which driver IDs, that are 6 or greater, are not also driver IDs in the school bus table, excluding driver ID 10 from the school bus table?

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


Question: Could you give me a list of driver IDs, including those with ID 11 from the driver table, and those with IDs less than 3 from the school_bus table?

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


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

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


Question: Can you give me a list of driver IDs, combining those from the driver table excluding ID 3 with those from the school bus table excluding ID 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 is the highest employee ID for employees who aren't named Phil Vickery and are 29 or younger, and also, what is the highest employee ID for evaluations where the bonus is less than 4000 or the employee ID isn't 7?

SELECT MAX(Employee_ID) FROM employee WHERE Name <> "Phil Vickery" AND "Age" <= 29 UNION ALL SELECT MAX(Employee_ID) FROM evaluation WHERE "Bonus" < 4000.0 OR Employee_ID != "7"


Question: Can you list the home city and party affiliation for all drivers who either aren't named Dan Carter and aren't 46 years old and are Democrats, or live in Hartford, or have a driver ID of 6 or higher, along with the home city and party affiliation for all drivers older than 46?

SELECT Home_city, Party FROM driver WHERE Name != "Dan Carter" AND "Age" <> 46 AND Party = "Dem" OR Home_city = "Hartford" OR "Driver_ID" >= 6 UNION ALL SELECT Home_city, Party FROM driver WHERE "Age" > 46


Question: Which vehicle IDs are associated with lessons on "2018-03-05 18:05:31" or for customer ID 5, and are also associated with vehicles that are not vans and have a vehicle ID of 2?

SELECT vehicle_id FROM Lessons WHERE lesson_date = "2018-03-05 18:05:31" OR "customer_id" = 5 INTERSECT SELECT vehicle_id FROM Vehicles WHERE vehicle_details != "Van" AND "vehicle_id" = 2


Question: Can you give me a list of driver IDs, including those from the driver table excluding driver ID 12, and those from the school_bus table excluding driver ID 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: Can you give me a list of airport and flight IDs, including airport IDs that are not 1, or don't have an IATA code of AMS, or are not in the United States and Boston, along with flight IDs where the altitude is less than or equal to 3650 on August 30, 1965, or the vehicle flight number is not M2-F1 #1, or the velocity is greater than 240 and the ID is greater than or equal to 6 and the company ID is not 7, or the pilot is Thompson?

SELECT id FROM airport WHERE "id" != 1 OR IATA <> "AMS" OR Country <> "United States" AND City != "Boston" UNION ALL SELECT id FROM flight WHERE "Altitude" <= 3650.0 AND Date = "August 30, 1965" OR Vehicle_Flight_number <> "M2-F1 #1" OR "Velocity" > 240.0 AND "id" >= 6 AND "company_id" != 7 OR Pilot = "Thompson"


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

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


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

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


Question: Can you give me a list of writers that includes Michael Moorcock and also any writers where the number of issues is less than 4, combined with a list of all writers except for Christopher Hinz?

SELECT Writer FROM book WHERE Writer = "Michael Moorcock" OR "Issues" < 4.0 UNION SELECT Writer FROM book WHERE Writer <> "Christopher Hinz"


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

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


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

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


Question: What are the Aircraft IDs and corresponding Airport IDs from the aircraft and airport_aircraft tables?

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


Question: Which driver IDs, excluding driver ID 9, are present in the driver table but not in the school_bus table for driver IDs less than or equal to 7?

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


Question: Which driver IDs, excluding driver ID 4, are also driver IDs that are greater than or equal to 10 and appear in the school bus table?

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


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

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


Question: Can you give me the average ranking and creation year for "Labor" departments with no more than 71436 employees and a Department ID of 12, excluding those created in 1789, or those with a ranking of at least 10, or a budget that isn't 62.8 billion, only including creation years where the average ranking is at least 10, but then remove any creation years and average rankings where the Department ID is no more than 4 or the department name isn't "Agriculture" and the average ranking is at least 14?

SELECT Creation, AVG(Ranking) FROM department WHERE Creation != "1789" AND Name = "Labor" AND "Num_Employees" <= 71436.0 AND "Department_ID" = 12 OR "Ranking" >= 10 OR "Budget_in_Billions" != 62.8 GROUP BY Creation HAVING AVG(Ranking) >= 10.0 EXCEPT SELECT Creation, AVG(Ranking) FROM department WHERE "Department_ID" <= 4 OR Name != "Agriculture" GROUP BY Creation HAVING AVG(Ranking) >= 14.0


Question: Could you give me a list of Company IDs, including those for companies named Walmart and also those from the employment table where the People ID is greater than 7 and the Company ID is less than or equal to 17?

SELECT Company_ID FROM company WHERE Name = "Walmart" UNION ALL SELECT Company_ID FROM employment WHERE "People_ID" > 7 AND "Company_ID" <= 17


Question: Can you give me the zip code, population, county name, and county ID for all counties with a population of 13,300 or less, combined with the zip code, population, county name, and county ID for counties where the county ID is 4 and the county name isn't Howard, or the zip code is D11, or the population isn't 21,000?

SELECT Zip_code, Population, County_name, County_Id FROM county WHERE "Population" <= 13300.0 UNION SELECT Zip_code, Population, County_name, County_Id FROM county WHERE "County_Id" = 4 AND County_name <> "Howard" OR Zip_code = "D11" OR "Population" != 21000.0


Question: Can you give me a list of driver IDs that are at least 10, where each ID appears at least once in the driver table, but the same driver ID is not greater than 10 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, excluding driver ID 2, are also driver ID 3 in the school bus table?

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


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

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


Question: Can you give me the item IDs from the item table where the title is not "comb" and the item ID is less than or equal to 6, but exclude any item IDs that also appear in the review table where the item ID is not 3?

SELECT i_id FROM item WHERE title != "comb" AND "i_id" <= 6 EXCEPT SELECT i_id FROM review WHERE "i_id" <> 3


Question: Can you list all the aircraft IDs, first from the aircraft table excluding ID 2, and then from the airport_aircraft table including only those less than 5, removing any duplicates?

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


Question: Which driver IDs are present in the driver table, excluding driver ID 9, but are not present in the school_bus table for driver IDs greater than or equal to 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: Could you please list the lesson ID, date, and time for all lessons where either the vehicle ID is greater than 1, or the price isn't 495, the time is 2, the status isn't completed, and the staff ID is 5, or the customer ID isn't 2 and the lesson ID is greater than 11, along with all lessons where the price isn't 231, the staff ID is 8 or greater, the date isn't March 7th, 2018 at 4:12:36 PM, or the status isn't cancelled?

SELECT lesson_id, lesson_date, lesson_time FROM Lessons WHERE "vehicle_id" > 1 OR "price" != 495.0 AND lesson_time = "2" AND lesson_status_code != "Completed" AND "staff_id" = 5 OR "customer_id" != 2 AND "lesson_id" > 11 UNION ALL SELECT lesson_id, lesson_date, lesson_time FROM Lessons WHERE "price" != 231.0 OR "staff_id" >= 8 OR lesson_date != "2018-03-07 16:12:36" OR lesson_status_code != "Cancelled"


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

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


Question: Can you give me a list of driver IDs that are 5 or less, and also not equal to 4, from both the driver and school bus records?

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


Question: Which driver IDs are both greater than 3 and also 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: Can you give me the address ID, birth date, start date, nickname, staff ID, last name, and first name of staff members who either live at address ID 3 and weren't born on May 17, 1994, or whose middle name isn't Amara and didn't start on December 22, 2017, combined with those whose last name isn't Hermann, or whose first name is Simeon and nickname isn't lsenger, or who live at address ID 7, have Sherwood as their middle name, and have a staff ID less than 12?

SELECT staff_address_id, date_of_birth, date_joined_staff, nickname, staff_id, last_name, first_name FROM Staff WHERE "staff_address_id" = 3 AND date_of_birth != "1994-05-17 05:32:11" OR middle_name <> "Amara" AND date_joined_staff <> "2017-12-22 03:06:32" UNION SELECT staff_address_id, date_of_birth, date_joined_staff, nickname, staff_id, last_name, first_name FROM Staff WHERE last_name != "Hermann" OR first_name = "Simeon" AND nickname != "lsenger" OR "staff_address_id" = 7 AND middle_name = "Sherwood" AND "staff_id" < 12


Question: Which driver IDs appear exactly once as driver IDs in the driver table, specifically driver ID 8, but not as driver ID 9 in the school bus table?

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


Question: Can you tell me the latest opening year and name of branches that either opened in 2009, are not in Oxford, or have a Branch ID of 6 or higher, along with the latest opening year and name of branches that are not on Oaks Crescent?

SELECT MAX(Open_year), Name FROM branch WHERE Open_year = "2009" OR City != "Oxford" OR "Branch_ID" >= 6 UNION SELECT MAX(Open_year), Name FROM branch WHERE Address_road != "Oaks Crescent"


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

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


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

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


Question: Which driver IDs are both less than or equal to 4 and present in the driver table, and also less than 9 and present 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: Can you list the driver IDs that are greater than or equal to 2 from the driver table, and combine that with a list of driver IDs that are less than 4 from the school bus table?

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


Question: Can you give me a list of aircraft IDs that are less than 5, where each ID appears only once, excluding any aircraft IDs that also appear in the airport aircraft list, except for the aircraft ID 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: Which aircraft, excluding aircraft with ID 3, are also aircraft with ID 1 found at the airport?

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


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

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


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

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


Question: Can you give me the IDs of drivers that appear more than twice in the driver table, excluding those driver IDs that appear more than four times in the school_bus table?

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


Question: Can you give me a list of employee IDs from the circulation history where either the draft number is 17 and the employee ID is not 2, or the copy number is 15, combined with a list of employee IDs from the employees table where the role code is not "ED" and the other details are not "b"?

SELECT employee_id FROM Circulation_History WHERE "draft_number" = 17 AND "employee_id" != 2 OR "copy_number" = 15 UNION ALL SELECT employee_id FROM Employees WHERE role_code <> "ED" AND other_details != "b"


Question: Can you give me a list of driver IDs, excluding driver ID 3, that are not also driver IDs in the school bus table, excluding driver ID 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: Can you list all the aircraft IDs, combining those from the aircraft table that are not equal to 3 with those from the airport_aircraft table that are not equal to 2?

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 is the highest document ID from the drafts table where the draft number is 12 or greater, and also the highest document ID from the mailed documents table where the mailed-to address ID is 8 or greater?

SELECT MAX(document_id) FROM Document_Drafts WHERE "draft_number" >= 12 UNION ALL SELECT MAX(document_id) FROM Documents_Mailed WHERE "mailed_to_address_id" >= 8


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

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


Question: Can you list all aircraft IDs, including those from the aircraft table that are greater than or equal to 5, and those from the airport_aircraft table that are not equal to 1?

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


Question: Can you give me the Aircraft IDs that are equal to 1 in the aircraft table, excluding the Aircraft IDs from the airport_aircraft table where the Driver ID is less than 9?

SELECT Aircraft_ID FROM aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID = 1 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUUP BY Driver_ID HAVING Driver_ID < 9


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

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


Question: Could you give me a list of document IDs from the Documents table, excluding those received on "2017-07-02 17:39:09" with a receipt number of "19" and document type code of "CD", but only for documents shipped by "UP", and then remove any document IDs that are also in the Documents_Mailed table where the mailing date isn't "1992-11-07 15:03:41" and the document ID is less than or equal to 2?

SELECT document_id FROM Documents WHERE receipt_date != "2017-07-02 17:39:09" AND receipt_number <> "19" AND shipping_agent_code = "UP" AND document_type_code != "CD" EXCEPT SELECT document_id FROM Documents_Mailed WHERE mailing_date != "1992-11-07 15:03:41" AND "document_id" <= 2


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

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


Question: Could you give me the IDs of documents that either have an ID less than 2394, have details other than "None", or have a template ID of 20 or greater, but excluding any document IDs that are also in the list of paragraphs with document IDs greater than 2394 and details not equal to "None"?

SELECT Document_ID FROM Documents WHERE "Document_ID" < 2394 OR Other_Details <> "None" OR "Template_ID" >= 20 EXCEPT SELECT Document_ID FROM Paragraphs WHERE "Document_ID" > 2394 AND Other_Details != "None"


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

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


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

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


Question: What are the driver IDs, excluding 10 from the drivers, and including 7 from the school bus drivers?

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


Question: What are the Driver IDs that are not 6 from the driver table, and also the Driver IDs less than 7 from the school_bus table?

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


Question: What is the highest branch ID and the membership level for branches on Glebe Street that were not opened in 2009?

SELECT MAX(T1.Branch_ID), T2.Level FROM branch as T1 JOIN member as T2 ON T1.Name = T2.Name WHERE Open_year <> "2009" AND Address_road = "Glebe Street"


Question: For schools that satisfy both of the following criteria, what are their location, school name, and IHSAA class? First, they are either not in Bremen, or not class A, or have an enrollment of 316, or are in '20 Elkhart' county and not school ID 8, or have an IHSAA Football Class of AAA. Second, they are also either not in IHSAA Class AAA, or have an enrollment of 605 or less and are not named LaVille.

SELECT Location, School_name, IHSAA_Class FROM School WHERE Location != "Bremen" OR IHSAA_Class <> "A" OR "Enrollment" = 316 OR County = "20 Elkhart" AND School_id != "8" OR IHSAA_Football_Class = "AAA" INTERSECT SELECT Location, School_name, IHSAA_Class FROM School WHERE IHSAA_Class <> "AAA" OR "Enrollment" <= 605 AND School_name != "LaVille"


Question: What are the driver IDs that are greater than 8 or are exactly 10?

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


Question: What are the driver IDs that are not 8 in the driver table, or are 9 or greater 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 >= 9


Question: What are the price, publication date, publisher, book ID, and publication ID of all publications that are either not from June 2006, cost exactly 6 million, have a book ID of 4 or less, and are not from Springer Nature, or cost more than 3 million, have a book ID of 7 or less, are not from April 2007, or are not from Bertelsmann?

SELECT Price, Publication_Date, Publisher, Book_ID, Publication_ID FROM publication WHERE Publication_Date <> "June 2006" AND "Price" = 6000000.0 AND "Book_ID" <= 4 AND Publisher <> "Springer Nature" UNION ALL SELECT Price, Publication_Date, Publisher, Book_ID, Publication_ID FROM publication WHERE "Price" > 3000000.0 OR "Book_ID" <= 7 OR Publication_Date != "April 2007" OR Publisher != "Bertelsmann"


Question: What driver IDs are either greater than 2 in the driver records or not equal to 7 in the 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 != 7


Question: What aircraft IDs are both aircraft ID 1 and also less than aircraft ID 5?

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


Question: What are the average People ID, Company ID, and count of working years for employment records where either the person's ID is greater than 4 or it's not their second year of work, but only show me those results that are unique compared to employment records excluding company 13?

SELECT AVG(People_ID), Company_ID, COUNT(Year_working) FROM employment WHERE "People_ID" > 4 OR "Year_working" != 2 EXCEPT SELECT AVG(People_ID), Company_ID, COUNT(Year_working) FROM employment WHERE "Company_ID" <> 13


Question: Which aircraft IDs, of 2 or greater, are in the aircraft table but not in the airport aircraft table?

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


Question: Could you list the IDs of car makers that are not named 'Subaru', or are maker 'subaru' with ID 5, or are not from country '5', along with the IDs of cars that have horsepower other than '110', weight up to 2910, and engine displacement not equal to 151.0?

SELECT Id FROM car_makers WHERE FullName <> "Subaru" OR "Id" = 5 AND Maker = "subaru" OR Country <> "5" UNION ALL SELECT Id FROM cars_data WHERE Horsepower <> "110" AND "Weight" <= 2910 AND "Edispl" <> 151.0


Question: What are the document IDs for document 24, or for documents mailed to addresses with IDs less than 5, excluding those mailed on February 21, 1973 at 10:17 AM?

SELECT document_id FROM Documents WHERE "document_id" = 24 UNION SELECT document_id FROM Documents_Mailed WHERE "mailed_to_address_id" < 5 AND mailing_date != "1973-02-21 10:17:01"


Question: What are the driver IDs, excluding ID 3, that are drivers but not school bus drivers?

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


Question: Which driver IDs are less than 8, excluding 7, and are listed as both a driver and a school bus driver?

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


Question: What Driver IDs are greater than 4 or are equal to 9?

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


Question: For 'Djurgårdens IF' clubs founded in the USA since 1998, which ones do not have any female coaches?

SELECT Club_ID FROM club WHERE Club_name = "Djurgårdens IF" AND "Start_year" >= 1998 AND Region = "USA" EXCEPT SELECT Club_ID FROM coach WHERE Gender != "M"


Question: What driver IDs are 10 or greater, but not among the driver IDs that are 3 or less in the school bus records?

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 aircraft IDs are number 5 in the aircraft table, or number 3 or higher 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: Which driver IDs less than 2 are in the driver list but not in the school bus list of driver IDs less than 3?

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


Question: Which driver IDs are listed in both the driver and school bus records and are also less than 6?

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


Question: Which driver IDs are at least 2, or are specifically ID 3 in the school buses?

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


Question: Tell me the driver IDs that are either 7 or less from the drivers, or not 3 from the 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: Can you list the first name, count of mobile phone numbers, amount outstanding, customer ID, customer since date, address ID, average last name, and sum of birth dates for customers who fulfill at least one of two very specific sets of conditions based on various customer details? Please combine the results from both sets of conditions into one list.

SELECT first_name, COUNT(cell_mobile_phone_number), amount_outstanding, customer_id, date_became_customer, customer_address_id, AVG(last_name), SUM(date_of_birth) FROM Customers WHERE "amount_outstanding" > 9332.0 OR phone_number = "1-875-045-0806" AND email_address != "myrl.lind@example.net" OR first_name = "Jordy" AND last_name <> "Goodwin" OR date_of_birth != "1998-09-18 04:45:01" AND customer_status_code != "Bad Customer" OR date_became_customer = "2015-06-24 03:50:04" AND "customer_id" <= 13 AND cell_mobile_phone_number <> "1-387-258-1016x96963" OR "customer_address_id" <= 1 UNION ALL SELECT first_name, COUNT(cell_mobile_phone_number), amount_outstanding, customer_id, date_became_customer, customer_address_id, AVG(last_name), SUM(date_of_birth) FROM Customers WHERE date_became_customer = "2016-03-18 06:14:18" AND last_name != "Leuschke" AND phone_number = "1-618-535-9750" AND "customer_address_id" != 10 AND cell_mobile_phone_number != "1-401-108-8016x078" AND email_address != "karina.carroll@example.net" AND first_name <> "Marina" OR customer_status_code <> "Good Customer"


Question: What driver IDs are number 9 in the driver and school bus records?

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 Driver IDs are greater than 3 for drivers or not equal to 4 for school buses?

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


Question: What driver IDs are on both the driver and school bus lists and are 3 or less?

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


Question: Which driver IDs are either less than 10 in the driver list or not equal to 3 in the school bus list?

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


Question: List driver ID 4 from the drivers and all driver IDs other than 7 from the school buses.

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


Question: What driver IDs are not 5 from the driver records, or are greater than 4 from the school bus records?

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 property feature descriptions and property IDs are there that meet these two requirements: first, the feature ID is not 4, or the description is 'corrupti', or the property ID is greater than 15; and second, the property ID is not 11?

SELECT property_feature_description, property_id FROM Other_Property_Features WHERE "feature_id" != 4 OR property_feature_description = "corrupti" OR "property_id" > 15 INTERSECT SELECT property_feature_description, property_id FROM Other_Property_Features WHERE "property_id" <> 11


Question: What driver IDs, other than 9, are drivers but not school bus drivers with IDs up to 9?

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


Question: What types of schools are either named 'State Elementary School Menteng 01', located in 'Los Angeles, California', not 'Private', or have a School ID of 1?

SELECT Type FROM school WHERE School = "State Elementary School Menteng 01" OR Location = "Los Angeles, California" UNION ALL SELECT Type FROM school WHERE Type <> "Private" OR "School_ID" = 1


Question: What driver IDs are in both the driver table (for drivers with IDs up to 11) and the school bus table (for drivers with ID 3)?

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


Question: List the ID, name, and distance of aircraft that either have an ID greater than 6, or have a distance of 1530 or more, or are a 'Boeing 757-300', except for the 'Boeing 757-300' with ID 6.

SELECT aid, name, distance FROM aircraft WHERE "aid" > 6 UNION ALL SELECT aid, name, distance FROM aircraft WHERE "distance" >= 1530 OR name = "Boeing 757-300" AND "aid" != 6


Question: Which driver IDs of 3 or greater are drivers but not school bus drivers?

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


Question: What driver IDs are either 11 or greater for drivers, or are different from 10 for school buses?

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


Question: Which aircraft IDs are 1 or less, but not 5?

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


Question: What are the vehicle IDs from lessons with vehicle ID 2 or not customer 6, combined with all vehicle IDs from vehicles that are not vehicle 2?

SELECT vehicle_id FROM Lessons WHERE "vehicle_id" = 2 OR "customer_id" <> 6 UNION ALL SELECT vehicle_id FROM Vehicles WHERE "vehicle_id" <> 2


Question: What are the Driver IDs that are 3 or greater from the drivers, or 10 or less from the school buses?

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 two highest document status descriptions, based on two different sets of conditions?

SELECT MAX(document_status_description) FROM Ref_Document_Status WHERE document_status_code != "overdue" OR document_status_description <> "currently working on" UNION ALL SELECT MAX(document_status_description) FROM Ref_Document_Status WHERE document_status_description = "currently working on" OR document_status_code != "working"


Question: What are the IDs of people who are either Russian, or named Teodor Salparov and born on August 16, 1982? Also, include the IDs of poker players who have either made more than 26 final tables and have a money rank of 68 or better, and are not player ID 6 or poker player ID 2, or have earnings of 476090 or less.

SELECT People_ID FROM people WHERE Nationality = "Russia" OR Birth_Date = "August 16, 1982" AND Name = "Teodor Salparov" UNION SELECT People_ID FROM poker_player WHERE "Final_Table_Made" > 26.0 AND "Money_Rank" >= 68.0 AND "People_ID" <> 6 AND "Poker_Player_ID" <> 2 OR "Earnings" <= 476090.0


Question: What Aircraft IDs are 5 or greater in the aircraft table, but not less than 3 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 that are less than 9 in the driver list, but not also driver IDs of 3 or more in the school bus list?

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


Question: What are the People IDs for people who either are in employment and are not ID 2 or have worked for 4 or more years, or are named 'Brad Lohaus' and did not graduate from Oklahoma, or have an ID of 4 or greater?

SELECT People_ID FROM employment WHERE "People_ID" != 2 OR "Year_working" >= 4 UNION ALL SELECT People_ID FROM people WHERE Name = "Brad Lohaus" AND Graduation_College != "Oklahoma" OR "People_ID" >= 4


Question: What are the driver IDs that are 3 or less from the driver list, combined with driver ID 7 from the school bus list?

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


Question: What driver IDs are not 2 from the drivers, or are 4 or greater from the school buses?

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


Question: Tell me the number of beds and decors, the average room name, and the total maximum occupancy, as well as the base price, bed type, and room ID, for rooms that are either for 4 or more people, or that meet some other specific requirements.

COUNT(beds) basePrice bedType RoomId COUNT(decor) AVG(roomName) SUM(maxOccupancy)

SELECT COUNT(beds), basePrice, bedType, RoomId, COUNT(decor), AVG(roomName), SUM(maxOccupancy) FROM Rooms WHERE "maxOccupancy" >= 4 UNION ALL SELECT COUNT(beds), basePrice, bedType, RoomId, COUNT(decor), AVG(roomName), SUM(maxOccupancy) FROM Rooms WHERE roomName <> "Convoke and sanguine" OR decor = "rustic" AND "maxOccupancy" <> 4 OR "basePrice" = 150 AND bedType <> "Double" AND RoomId != "AOB"


Question: Tell me the total of all airport IDs and the company ID for each flight, but only if the minimum flight velocity is 240 or more.

SELECT SUM(T1.id), T2.company_id FROM airport as T1 JOIN flight as T2 ON T1.id = T2.id WHERE MIN(Velocity) >= 240.0


Question: What driver IDs are either exactly 12 from the driver table, or 10 or greater 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 driver IDs are greater than 8 in the driver table, but not driver IDs of 9 or less in the school bus table?

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


Question: What are the aircraft IDs that are not 5 in the aircraft table, or are 3 or less 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 that are either 10 or greater from the driver table, or not 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: What driver IDs are drivers, excluding ID 5, but not school bus drivers, excluding ID 7?

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


Question: What Driver IDs are not 11 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 <> 11 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 9


Question: Could you list the Branch IDs for branches that are not named 'Taverner' and don't have a membership amount of '1418', or are not on 'Glebe Street', or are not in 'Oxford' with a Branch ID greater than 6, or didn't open in '2001'? Also, include Branch IDs from membership registrations that are not from 2016 and have a Member ID of 6 or less.

SELECT Branch_ID FROM branch WHERE Name != "Taverner" AND membership_amount <> "1418" OR Address_road <> "Glebe Street" OR City <> "Oxford" AND "Branch_ID" > 6 OR Open_year <> "2001" UNION SELECT Branch_ID FROM membership_register_branch WHERE Register_Year <> "2016" AND "Member_ID" <= 6


Question: Which driver IDs are 12 or less from the driver list, and are not also in the school bus list (excluding driver ID 10 from the school bus list)?

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


Question: What are the head IDs and temporary acting statuses for people who are temporarily acting or whose head ID is not 10?

SELECT head_ID, temporary_acting FROM management WHERE temporary_acting != "No" UNION SELECT head_ID, temporary_acting FROM management WHERE "head_ID" != 10


Question: What Aircraft IDs are either 2 or less in the aircraft table, or greater than 5 in the airport_aircraft table?

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


Question: Which driver IDs, other than 4, are drivers but not school bus drivers with IDs greater than 10?

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


Question: What are the driver IDs that are 8 or less from the driver list, or 10 or less from the school bus list?

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


Question: Which driver IDs are 12 or greater in the driver list, but are not also driver IDs less than 4 in the school bus list?

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


Question: What are the aircraft IDs that are greater than 2 from the aircraft list, or less than or equal to 1 from the airport aircraft list?

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


Question: Which driver IDs are either not 11 in the driver table or greater than 4 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 > 4


Question: What are the IDs of airports not in the United States and not BRU, and also the IDs of flights with ID up to 4?

SELECT id FROM airport WHERE Country != "United States" AND IATA != "BRU" UNION ALL SELECT id FROM flight WHERE "id" <= 4


Question: What driver IDs are for drivers, excluding 7, but not for school bus drivers with IDs less than 10?

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 are greater than 10 in the driver table, or less than or equal to 9 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 <= 9


Question: What is aircraft ID 1 if it is in the aircraft or airport aircraft tables?

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


Question: What Aircraft IDs are in both the aircraft and airport_aircraft tables, and are also greater than 1 and not equal to 5?

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


Question: What driver IDs, other than 11, are assigned to drivers but not to school bus drivers with IDs less than 9?

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


Question: What are the highest review IDs, both for reviews by user 2, and for reviews with rank less than 3, user ID 2 or higher, rating not equal to 6, and a_id 1 or higher?

SELECT MAX(i_id) FROM review WHERE "u_id" = 2 UNION SELECT MAX(i_id) FROM review WHERE "rank" < 3 AND "u_id" >= 2 AND "rating" <> 6 AND "a_id" >= 1


Question: What driver IDs are less than or equal to 1 in the driver table, or less than or equal to 4 in the school bus table?

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


Question: Which driver IDs are 8 or less, except for driver ID 3 if it is also a school bus driver?

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: What driver IDs are for both drivers with IDs 9 or higher and school bus drivers, excluding school bus driver 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 aircraft IDs that are number 4 in the aircraft table, or greater than 2 in the airport aircraft table?

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


Question: What are the aircraft IDs, other than 1, that are in the aircraft table but not among the aircraft IDs less than 3 in the airport_aircraft table?

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


Question: What are the IDs of drivers, other than 10, who are not also school bus drivers with an ID of 3 or greater?

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


Question: What are the Aircraft IDs from the aircraft table that are 3 or less, excluding those that are also Aircraft ID 1 in the airport_aircraft table?

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


Question: What driver IDs are either greater than 6, or are school bus driver IDs less than 9?

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


Question: What Aircraft IDs are in both the aircraft list (excluding ID 2) and the airport aircraft list (including IDs up to 2)?

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


Question: What are the driver IDs that are both in the driver list (excluding driver 4) and the school bus driver list (excluding driver 9)?

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 is the average Club ID and a student ID for the 'Bootup Baltimore' club in AKW?

SELECT AVG(T1.ClubID), T2.StuID FROM Club as T1 JOIN Member_of_club as T2 ON T1.ClubID = T2.ClubID WHERE ClubName = "Bootup Baltimore" GROUP BY ClubLocation HAVING ClubLocation = "AKW"


Question: Which driver IDs, that are 4 or less, are both in the driver list and the school bus list?

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


Question: What driver IDs are both greater than 2 and equal to 3 across driver and school bus records?

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


Question: What Driver IDs are greater than 4 from the driver table or Driver IDs greater than or equal to 3 from the school_bus table?

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


Question: What are all the driver IDs, except for 4 and 10, from both the drivers and school buses?

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


Question: What are the driver IDs, other than 9, from the driver table?

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


Question: What Driver IDs are greater than 8 for drivers or not equal to 9 for school buses?

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 Driver IDs are below 12 in the driver list or are exactly 3 in the school bus list?

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 driver IDs are used by both drivers with IDs greater than 9 and school bus drivers with IDs up to 10?

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


Question: What driver IDs are 2 or less from the driver table, but are not driver IDs greater than 3 from the school bus table?

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


Question: Which Driver IDs are 11 or higher in the driver table, or lower than 7 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 < 7


Question: What driver IDs are there, other than 4 and 10, considering both regular drivers and school bus drivers?

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


Question: What driver IDs are less than 4 in the driver list or not equal to 10 in the school bus list?

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


Question: What are the shipping agent codes and names for shipping agents named 'Ship' and described as 't', as well as those with the code 'FE'?

SELECT shipping_agent_code, shipping_agent_name FROM Ref_Shipping_Agents WHERE shipping_agent_name = "Ship" AND shipping_agent_description = "t" UNION ALL SELECT shipping_agent_code, shipping_agent_name FROM Ref_Shipping_Agents WHERE shipping_agent_code = "FE"


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

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, considering drivers with IDs other than 12, and school bus drivers with IDs greater than 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 all the driver IDs, excluding driver ID 7 and driver ID 10 from drivers and school buses respectively, and make sure to show each ID only once?

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


Question: What are the driver IDs that are less than 5, excluding any driver ID that is 9 from the school bus records?

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 Driver IDs are both in the group of drivers with IDs up to 7 and in the group of school bus drivers with ID 7?

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


Question: What Aircraft IDs are either 3 or less in the aircraft table, or not 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: Which driver IDs greater than 5 are drivers but not school bus drivers, excluding school bus driver ID 3?

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


Question: What are the aircraft IDs greater than 2 that are in the aircraft or airport aircraft tables?

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


Question: Which Aircraft IDs are listed in both the aircraft table, excluding ID 1, and the airport aircraft table, excluding ID 5?

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


Question: What Driver IDs are greater than 12, or not equal to 9?

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


Question: What are the total Template Type Description and total Template Type Code for template types described as 'Presentation', and also for template types with the code 'AD'?

SELECT SUM(Template_Type_Description), SUM(Template_Type_Code) FROM Ref_Template_Types WHERE Template_Type_Description = "Presentation" UNION SELECT SUM(Template_Type_Description), SUM(Template_Type_Code) FROM Ref_Template_Types WHERE Template_Type_Code = "AD"


Question: What driver IDs are both greater than 5 and not 9, and are used for both drivers and school buses?

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


Question: What contestant numbers are there for the contestant named 'Loraine NygrenTania Mattioli', but not for contestant number 8, together with the contestant numbers from votes for contestant number 3 or less, or votes created on March 9, 2018 at 7:03 PM from states other than NY?

SELECT contestant_number FROM CONTESTANTS WHERE "contestant_number" != 8 AND contestant_name = "Loraine NygrenTania Mattioli" UNION SELECT contestant_number FROM VOTES WHERE "contestant_number" <= 3 OR created = "2018-03-09 19:03:21" AND state <> "NY"


Question: What are the Driver IDs that are greater than 8 in the driver table or equal to 9 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 = 9


Question: What aircraft IDs are in the aircraft table, are less than 2, and are not in the airport_aircraft table as IDs of 5 or more?

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


Question: For pets with a Pet ID of 2002 or higher, what are the ages and weights of dogs that are either 3 years old or weigh more than 12 kilograms?

SELECT pet_age, weight FROM Pets WHERE "PetID" >= 2002 EXCEPT SELECT pet_age, weight FROM Pets WHERE PetType <> "dog" OR "pet_age" != 3 AND "weight" <= 12.0 OR "PetID" < 2002


Question: What are the unique Aircraft IDs that are less than 4 from the aircraft table, or not equal to 3 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 != 3


Question: What driver IDs are greater than 9 and are also listed in the school bus records?

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


Question: What driver IDs, 3 or lower, are drivers but not school bus drivers with IDs below 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 driver IDs are 1 or less in the driver table, and are not among the driver IDs less than 4 in the school bus table?

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


Question: What driver IDs are either less than 4 or greater than 10?

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


Question: What driver IDs, other than 5, are also greater than 4 and are used in both driver and school bus records?

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


Question: List all unique Aircraft IDs that are at least 5 in the aircraft table, or are not 2 in the airport_aircraft table.

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


Question: What driver IDs are both not 2 and less than 4, and are drivers of school buses?

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


Question: Please provide the last names, dates of birth, and dates of leaving for staff members who meet any of the following conditions: they were not hired on 2016-06-05 22:22:23 and have a staff ID less than 4, or their middle name is Liam, or their last name is not Sawayn, or their nickname is not nicholaus92 and their staff address ID is 12, or their date of birth is not 2015-08-10 11:37:39 and their date of leaving staff is not 2018-03-06 23:17:41, or their staff ID is not 1.

SELECT last_name, date_of_birth, date_left_staff FROM Staff WHERE date_joined_staff != "2016-06-05 22:22:23" AND "staff_id" < 4 OR middle_name = "Liam" OR last_name <> "Sawayn" OR nickname <> "nicholaus92" AND "staff_address_id" = 12 OR date_of_birth != "2015-08-10 11:37:39" AND date_left_staff != "2018-03-06 23:17:41" UNION SELECT last_name, date_of_birth, date_left_staff FROM Staff WHERE "staff_id" != 1


Question: Are there any drivers with ID 8 who are not also listed as school bus drivers with an ID of 4 or more?

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


Question: What are the driver IDs that are both not driver 6 and also driver 3 or less?

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 not 8 from the driver table, or are 3 or less 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 ID 3 and ID 7 from the driver and school bus lists respectively?

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: List the feature IDs and descriptions for features that are either not security features, or are not 'AirCon' and not feature number 3, except for those features that are not feature number 4, or are not 'Burglar Alarm', or are not 'Pool' amenities.

SELECT feature_id, feature_description FROM Other_Available_Features WHERE feature_type_code != "Security" OR feature_name <> "AirCon" AND "feature_id" != 3 EXCEPT SELECT feature_id, feature_description FROM Other_Available_Features WHERE "feature_id" <> 4 OR feature_description != "Burglar Alarm" OR feature_name <> "Pool" AND feature_type_code = "Amenity"


Question: Can you give me the average of company names for companies that either have profits greater than 25.7 billion and are not headquartered in China, or have a Company ID greater than 5, or are not named Gazprom, are not in the Oil and gas industry, have a market value greater than 407.4 billion, and have sales of at least 102.6 billion, and also the average of people names for people who did not graduate from Wisconsin–Stevens Point?

SELECT AVG(Name) FROM company WHERE "Profits_in_Billion" > 25.7 AND Headquarters <> "China" OR "Company_ID" > 5.0 OR Name <> "Gazprom" AND Industry != "Oil and gas" AND "Market_Value_in_Billion" > 407.4 AND "Sales_in_Billion" >= 102.6 UNION SELECT AVG(Name) FROM people WHERE Graduation_College != "Wisconsin–Stevens Point"


Question: Which Aircraft IDs are at least 1 from the aircraft table, or not equal to 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: What aircraft IDs, other than 3, are in the aircraft table but not in the airport aircraft table?

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


Question: What are the names of employees who are either under 30, have an ID of 3 or less, or are not 'Lee Mears' and not from 'Wasps', and also the names of shops that are either not in 'Espoo', are named 'FC Inter', or are in 'Wiklöf Holding Arena' with an ID greater than 2 and not 6000 products?

SELECT Name FROM employee WHERE "Employee_ID" <= 3 OR Name != "Lee Mears" AND City != "Wasps" OR "Age" < 30 UNION SELECT Name FROM shop WHERE Location <> "Espoo" OR Name = "FC Inter" OR "Shop_ID" > 2 AND "Number_products" <> 6000 AND District = "Wiklöf Holding Arena"


Question: Which driver IDs are both not 8 and also 9 or greater?

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 driver IDs are either less than 11 from the drivers or 7 or greater from the school buses?

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


Question: What driver IDs, under 6, are drivers but not school bus drivers with IDs 7 or higher?

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


Question: What certificate IDs are there that are either not for employee 269734834 or not 1, excluding those that are flight IDs less than 5 or from Chicago?

SELECT aid FROM certificate WHERE "eid" != 269734834 OR "aid" <> 1 EXCEPT SELECT aid FROM flight WHERE "aid" < 5 OR origin = "Chicago"


Question: List the start date, shop ID, full-time status, and employee ID for hiring records that are for shops with ID 2 or greater, and also meet at least one of these conditions: employee ID is less than 7, are not full-time, or have a start date other than 2012.

SELECT Start_from, Shop_ID, Is_full_time, Employee_ID FROM hiring WHERE "Shop_ID" >= 2 INTERSECT SELECT Start_from, Shop_ID, Is_full_time, Employee_ID FROM hiring WHERE "Employee_ID" < 7 OR Is_full_time != "T" OR Start_from != "2012"


Question: What are the document IDs for documents with receipt number 69 or document ID 3 or higher, or for draft copies with document ID greater than 2 and copy number not equal to 6, or draft number less than 20?

SELECT document_id FROM Documents WHERE receipt_number = "69" OR "document_id" >= 3 UNION SELECT document_id FROM Draft_Copies WHERE "document_id" > 2 AND "copy_number" != 6 OR "draft_number" < 20


Question: What are the driver IDs, including those of drivers who are not driver 5, and school bus drivers with IDs greater than 9?

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


Question: What are the driver IDs that are drivers, excluding driver 2, but not school bus drivers, excluding driver 3?

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


Question: Give me the driver IDs that are greater than 11 from the driver table and those that are 10 or less 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 driver IDs are both number 9 and also listed as school bus drivers, excluding driver ID 4 from the school bus driver list?

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


Question: What driver IDs are greater than 10, and also driver ID 10 if it's in the school_bus table?

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


Question: What are the count of color page speeds, the average DPI, the minimum product name, and the product IDs for products that are either USB 2.0, have a product ID less than 4, or are not 'Xerox Travel Scanner 100', but not if they are also not A4 size or have a product ID other than 4?

SELECT COUNT(pages_per_minute_color), AVG(dpi), MIN(product), product_id FROM product WHERE interface = "USB 2.0" OR "product_id" < 4 OR product <> "Xerox Travel Scanner 100" EXCEPT SELECT COUNT(pages_per_minute_color), AVG(dpi), MIN(product), product_id FROM product WHERE max_page_size != "A4" OR "product_id" <> 4


Question: What are the driver IDs that are 10 from the driver list, or less than 10 from the school bus list?

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


Question: What property type codes are there for properties that either have apartment feature 3 specified and are not property ID 13, or have a vendor requested price of 2219.68 or more and another feature 1 specified, as well as all property type codes from the property type reference table, excluding 'Shop'?

SELECT property_type_code FROM Properties WHERE apt_feature_3 <> "None" AND "property_id" != 13 OR "vendor_requested_price" >= 2219.6778 AND oth_feature_1 != "None" UNION ALL SELECT property_type_code FROM Ref_Property_Types WHERE property_type_code <> "Shop"


Question: Could you list all Member IDs that are less than 5 from the member table, and also all Member IDs from the membership register branch table that are either less than 8 or not registered in 2016?

SELECT Member_ID FROM member WHERE "Member_ID" < 5 UNION ALL SELECT Member_ID FROM membership_register_branch WHERE "Member_ID" < 8 OR Register_Year <> "2016"


Question: What staff IDs are found in both lessons with specific exceptions and staff members with specific attributes?

SELECT staff_id FROM Lessons WHERE "customer_id" != 9 AND lesson_date = "2018-03-21 06:48:45" OR lesson_status_code <> "Completed" OR "price" != 492.0 INTERSECT SELECT staff_id FROM Staff WHERE "staff_address_id" >= 14 OR middle_name <> "Caesar" OR date_left_staff != "2018-03-01 17:10:03" OR nickname = "bkunze" AND date_of_birth != "2007-06-11 20:03:28" AND "staff_id" = 7