Question: Which driver IDs, excluding driver 8, are also driver IDs less than or equal to 4 in the school bus list?

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


Question: Can you give me the total grade points, school name, earliest type, and location for all schools, combining those not in New York City with those in Honolulu, Hawaii that either aren't colleges or have a school ID other than 3?

6
Punahou School
Private
Honolulu, Hawaii

10
Punahou School
Private
Honolulu, Hawaii

SELECT SUM(Grade), School, MIN(Type), Location FROM school WHERE Location <> "New York City" UNION SELECT SUM(Grade), School, MIN(Type), Location FROM school WHERE Location = "Honolulu, Hawaii" AND Grade != "College" OR "School_ID" <> 3


Question: What aircraft IDs are greater than or equal to 4, excluding those aircraft IDs that are not equal to 3 and are found in the airport aircraft list?

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


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

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: Can you give me a list of driver IDs, excluding those equal to 7, that are greater than 7 and appear in the driver table but not in the school bus table?

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


Question: Could you give me the coach IDs for male coaches with a rank of 3 or better, as well as the coach IDs from the player_coach table where the starting year is 2013 or later, or the coach ID is less than 1?

SELECT Coach_ID FROM coach WHERE "Rank" <= 3 AND Gender = "M" UNION SELECT Coach_ID FROM player_coach WHERE "Starting_year" >= 2013 OR "Coach_ID" < 1


Question: What template type codes are not associated with advertisement template types and also not associated with template ID 22?

SELECT Template_Type_Code FROM Ref_Template_Types WHERE Template_Type_Description <> "Advertisement" INTERSECT SELECT Template_Type_Code FROM Templates WHERE "Template_ID" != 22


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: What aircraft IDs are not equal to 3 and are also not equal to 2 in the airport aircraft list?

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


Question: Can you give me a list of driver IDs, including those from the driver table that are 6 or higher, and those from the school bus table that are 4 or lower?

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


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

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


Question: What are the interfaces, dimensions, and DPIs of products with a USB 2.0 interface, excluding those that have any other type of interface?

SELECT interface, dimensions, dpi FROM product WHERE interface = "USB 2.0" EXCEPT SELECT interface, dimensions, dpi FROM product WHERE interface != "USB 2.0"


Question: Can you list the payment amount, payment method, payment date and time, and customer ID for all payments where either the customer ID is less than 11 and the payment amount is no more than 3073.98, or the payment method is Direct Debit, but exclude any payments where the payment amount is exactly 9886.62?

SELECT amount_payment, payment_method_code, datetime_payment, customer_id FROM Customer_Payments WHERE "customer_id" < 11 AND "amount_payment" <= 3073.98 OR payment_method_code = "Direct Debit" EXCEPT SELECT amount_payment, payment_method_code, datetime_payment, customer_id FROM Customer_Payments WHERE "amount_payment" = 9886.62


Question: Can you give me the minimum vehicle ID, customer ID, maximum lesson status code, lesson date, staff ID, and total lesson time for lessons on March 5, 2018 at 8:05 PM, or where the lesson time is not 2, the vehicle ID is at least 1, the price is at least 446, the lesson status is cancelled, the staff ID is less than 1, and the customer ID is at most 10, or the lesson ID is not 1, excluding the same information for lessons where the lesson status is not cancelled, the staff ID is at most 11, and the price is at most 199, or where the lesson time is not 9, the lesson ID is less than 12, and the vehicle ID is 1?

SELECT MIN(vehicle_id), customer_id, MAX(lesson_status_code), lesson_date, staff_id, SUM(lesson_time) FROM Lessons WHERE lesson_date = "2018-03-05 20:05:33" OR lesson_time <> "2" AND "vehicle_id" >= 1 AND "price" >= 446.0 AND lesson_status_code = "Cancelled" AND "staff_id" < 1 AND "customer_id" <= 10 OR "lesson_id" <> 1 EXCEPT SELECT MIN(vehicle_id), customer_id, MAX(lesson_status_code), lesson_date, staff_id, SUM(lesson_time) FROM Lessons WHERE lesson_status_code != "Cancelled" AND "staff_id" <= 11 AND "price" <= 199.0 OR lesson_time != "9" AND "lesson_id" < 12 AND "vehicle_id" = 1


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

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


Question: Can you give me a list of driver IDs less than 5 that are present in both the driver table and the school_bus table, considering only driver IDs less than 4 in the school_bus table?

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


Question: Can you give me the maximum first name, average major, city code, sum of advisor values, age, sex, and maximum student ID for students named Eric who don't live in NYC, or are not male, or whose major is not 520, or whose last name is Pang and student ID is less than 1019, excluding those who don't live in Atlanta, are not female, whose last name is not Lee, and whose student ID is greater than 1022 and advisor is 7792, or are 17 or younger, or whose major is 600 or greater?

MAX(Fname) AVG(Major) city_code SUM(Advisor) Age Sex MAX(StuID)

SELECT MAX(Fname), AVG(Major), city_code, SUM(Advisor), Age, Sex, MAX(StuID) FROM Student WHERE Fname = "Eric" AND city_code != "NYC" OR Sex != "M" AND "Major" != 520 OR LName = "Pang" AND "StuID" < 1019 EXCEPT SELECT MAX(Fname), AVG(Major), city_code, SUM(Advisor), Age, Sex, MAX(StuID) FROM Student WHERE city_code <> "ATL" AND Sex != "F" AND LName != "Lee" AND "StuID" > 1022 AND "Advisor" = 7792 OR "Age" <= 17 OR "Major" >= 600


Question: Can you give me a list of driver IDs, where each ID is 11 or greater, but excluding any driver IDs that are not equal to 7 in the school bus table?

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


Question: Which aircraft IDs appear in the aircraft table, excluding aircraft ID 1, and also appear in the airport_aircraft table with aircraft IDs of 2 or greater?

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 list the names and codes of all shipping agents, including those whose code is not "FE", combined with those whose name is not "UPS" or whose description is "t"?

SELECT shipping_agent_name, shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_code <> "FE" UNION ALL SELECT shipping_agent_name, shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_name <> "UPS" OR shipping_agent_description = "t"


Question: What is the lowest contestant number for Nita Coster with a number less than or equal to 6, combined with the lowest contestant number from all votes that were not created at "2018-03-09 19:03:39", or are not for contestant number 5, or do not have a vote ID of 2?

SELECT MIN(contestant_number) FROM CONTESTANTS WHERE "contestant_number" <= 6 AND contestant_name = "Nita Coster" UNION SELECT MIN(contestant_number) FROM VOTES WHERE created <> "2018-03-09 19:03:39" OR "contestant_number" != 5 OR "vote_id" <> 2


Question: Can you give me a list of driver IDs that are 6 or higher from the driver table, combined with a list of driver IDs that are 4 or higher 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 >= 4


Question: Could you give me a list of driver IDs that are not equal to 1, and are also greater than 7, based on the driver and school bus information?

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 give me a list of driver IDs that are both greater than or equal to 1 and not equal to 3, considering only the unique driver IDs from the driver and school bus tables?

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


Question: Could you give me a list of document IDs, including those from documents with other details not equal to "h" or with a shipping agent code of "US", as well as those from mailed documents with a mailing date not equal to "1982-01-14 05:50:54"?

SELECT document_id FROM Documents WHERE other_details != "h" OR shipping_agent_code = "US" UNION SELECT document_id FROM Documents_Mailed WHERE mailing_date != "1982-01-14 05:50:54"


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

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


Question: Can you give me a list of driver IDs less than or equal to 11, excluding those driver IDs that are also less than 3 and are associated with school buses?

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


Question: What is the sum of Template Type Codes that are "AD", excluding those with a Template Type Description of "CV", combined with the sum of Template Type Codes that are "CV"?

SELECT SUM(Template_Type_Code) FROM Ref_Template_Types WHERE Template_Type_Code = "AD" AND Template_Type_Description != "CV" UNION SELECT SUM(Template_Type_Code) FROM Ref_Template_Types WHERE Template_Type_Code = "CV"


Question: What is the highest number of issues for each publisher, excluding Pearson, but only showing results where the publisher is not Bertelsmann or the price is less than or equal to 2,000,000?

SELECT MAX(T1.Issues), T2.Publisher FROM book as T1 JOIN publication as T2 ON T1.Book_ID = T2.Book_ID WHERE Publisher <> "Pearson" GROUP BY Issues HAVING Publisher <> "Bertelsmann" OR Price <= 2000000.0


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

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


Question: Which driver IDs are greater than or equal to 7, excluding those driver IDs that are also greater than or equal to 10 in the school bus table?

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


Question: Can you give me a list of driver IDs that are greater than or equal to 2, excluding any driver IDs that are not equal to 10 and are 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 <> 10


Question: Which driver IDs are equal to 8, but not less than or equal to 9 in the school bus list?

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 give me a list of driver IDs that are less than 6 from the driver table, combined with a list of driver IDs that are not equal to 4 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 != 4


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

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


Question: Can you list the driver IDs from the driver table that are less than 3, and combine that with a list of driver IDs from the school_bus table that are 3 or greater?

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


Question: Can you give me the IDs of car makers that are either from country code 3 or are not named Fiat, excluding the IDs of cars that have 4 cylinders and were made after 1976, or have an engine displacement of 85.0?

SELECT Id FROM car_makers WHERE Country = "3" OR FullName <> "Fiat" EXCEPT SELECT Id FROM cars_data WHERE "Cylinders" = 4 AND "Year" > 1976 OR "Edispl" = 85.0


Question: Can you list all the driver IDs from the driver table where the ID is 8 or higher, combined with all the driver IDs from the school bus table that are not equal to 3?

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


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

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


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

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


Question: Can you give me a list of aircraft IDs for Lockheed L1011 planes that have a distance of 4010 or less, combined with a list of aircraft IDs from certificates where the eid is less than 356187925?

SELECT aid FROM aircraft WHERE name = "Lockheed L1011" AND "distance" <= 4010 UNION ALL SELECT aid FROM certificate WHERE "eid" < 356187925


Question: Which driver has an ID of 10 and also drives a school bus, but not school bus number 7?

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


Question: Which driver IDs, greater than 7, appear in the driver table but not in the school_bus table where driver IDs are greater than 4?

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


Question: Can you give me a list of driver IDs less than 3 that appear in the driver table but not in the school bus table?

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


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

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


Question: Can you list the continent, country name, and country ID for all countries where the continent is less than or equal to 2, and also list the continent, country name, and country ID for all countries where the country ID is not 9?

SELECT Continent, CountryName, CountryId FROM countries WHERE "Continent" <= 2 UNION ALL SELECT Continent, CountryName, CountryId FROM countries WHERE "CountryId" <> 9


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

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


Question: Can you give me the address ID and the shortest address detail for addresses with IDs less than 5 and details that aren't "MX", but only for those that also have address IDs greater than 1?

SELECT address_id, MIN(address_details) FROM Addresses WHERE address_details != "MX" AND "address_id" < 5 INTERSECT SELECT address_id, MIN(address_details) FROM Addresses WHERE "address_id" > 1


Question: Can you give me a list of driver IDs, up to and including 6, that are in the driver table but not in the school bus table, excluding driver ID 4 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 != 4


Question: Can you list the aircraft IDs that are less than 4 from the aircraft table, combined with the aircraft IDs that are less than 2 from the airport_aircraft table, removing any duplicates?

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


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

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


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

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


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

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


Question: What are the ranks and the earliest gender of coaches, excluding those from club 3 or with coach ID 2, that are not also the ranks and earliest gender of players who are ranked "1st" and have a player ID greater than 4?

SELECT Rank, MIN(Gender) FROM coach WHERE "Club_ID" <> 3 OR "Coach_ID" != 2 EXCEPT SELECT Rank, MIN(Gender) FROM player WHERE Rank = "1st" AND "Player_ID" > 4


Question: Which aircraft IDs are greater than or equal to 6, excluding those that also appear as aircraft IDs in the certificate table where the aircraft ID is 14?

SELECT aid FROM aircraft WHERE "aid" >= 6 EXCEPT SELECT aid FROM certificate WHERE "aid" = 14


Question: What is the minimum number of years worked by school bus employees at schools with an ID of 7 or less, and also the minimum number of years worked by full-time school bus employees who have not worked for exactly 3 years?

SELECT MIN(Years_Working) FROM school_bus WHERE "School_ID" <= 7 UNION ALL SELECT MIN(Years_Working) FROM school_bus WHERE If_full_time = "T" AND "Years_Working" <> 3


Question: Can you give me a list of driver IDs, where each ID is less than 8, excluding any driver IDs that are also less than or equal to 3 in the school bus list?

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


Question: Can you give me a list of driver IDs, including those from the driver table that are greater than or equal to 12, and also those from the school_bus table that are not equal to 4?

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


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

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


Question: Which names are both "Terry" and also belong to users with a u_id of 3, excluding "Emily"?

SELECT name FROM useracct WHERE "u_id" = 3 AND name != "Emily" INTERSECT SELECT name FROM useracct WHERE name = "Terry"


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

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


Question: Can you give me a list of head IDs that either belong to someone born in Alabama, named Jeff Maggert, or have a head ID greater than 3, along with head IDs from the management table where the temporary acting status is not "No", the head ID is 6, and the department ID is 2 or greater?

SELECT head_ID FROM head WHERE born_state = "Alabama" OR name = "Jeff Maggert" OR "head_ID" > 3 UNION ALL SELECT head_ID FROM management WHERE temporary_acting != "No" AND "head_ID" = 6 AND "department_ID" >= 2


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

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


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

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


Question: Can you give me a list of aircraft IDs that are both greater than or equal to 2 in the aircraft table and less than 3 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 < 3


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

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


Question: Could you list the document IDs from the circulation history where either the document ID is not 2 and the draft number is 2 or greater, or the employee ID is 8 or greater and the copy number is 10, combined with document IDs from the documents mailed table where the mailed-to address ID is 0 or less, the document ID is not 20, and the mailing date is not January 1st, 2007 at 10:32 PM?

SELECT document_id FROM Circulation_History WHERE "document_id" <> 2 AND "draft_number" >= 2 OR "employee_id" >= 8 AND "copy_number" = 10 UNION ALL SELECT document_id FROM Documents_Mailed WHERE "mailed_to_address_id" <= 0 AND "document_id" != 20 AND mailing_date <> "2007-01-01 22:32:11"


Question: What are the aircraft IDs that are not equal to 1 and are also not equal to 3 in the airport aircraft?

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


Question: What is the difference between the number of items and the average article ID for reviews with a rating less than 7 or an item ID less than 7 or an article ID not equal to 3, and the number of items and average article ID for reviews with a rating not equal to 5 and a user ID less than 2?

SELECT COUNT(i_id), AVG(a_id) FROM review WHERE "rating" < 7 AND "i_id" < 7 OR "a_id" <> 3 EXCEPT SELECT COUNT(i_id), AVG(a_id) FROM review WHERE "rating" != 5 AND "u_id" < 2


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

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


Question: What is the smallest employee ID from the Circulation History table where the copy number is 15 or less and the employee ID is less than 1, combined with the smallest employee ID from the Employees table where the employee name is not Koby, the other details are not 'b', and either the role code is not 'ED' or the employee ID is not 3?

SELECT MIN(employee_id) FROM Circulation_History WHERE "copy_number" <= 15 AND "employee_id" < 1 UNION SELECT MIN(employee_id) FROM Employees WHERE employee_name != "Koby" AND other_details != "b" AND role_code <> "ED" OR "employee_id" <> 3


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

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


Question: What is the largest album ID that is less than or equal to 139 and has an artist ID less than 10, and what is the largest media type ID that is greater than or equal to 5?

SELECT MAX(id) FROM albums WHERE "id" <= 139 AND "artist_id" < 10 UNION SELECT MAX(id) FROM media_types WHERE "id" >= 5


Question: What continents, excluding Africa and those with a ContId of 1 or less, are not also continents associated with countries other than the UK and with a continent value of 5 or greater?

SELECT Continent FROM continents WHERE Continent <> "africa" AND "ContId" > 1 EXCEPT SELECT Continent FROM countries WHERE CountryName != "uk" AND "Continent" >= 5


Question: Can you give me the Comptroller, average US Senate result, Party ID, minimum Lieutenant Governor, and Attorney General from the party table, first where the US Senate result is "(no election)", or the Lieutenant Governor is "Dennis Mehiel", or the Attorney General is not "Eliot Spitzer", or the Party is not "Independence" and the Year is not 1998 and the Comptroller is not "Alan Hevesi", and also where the Year is greater than 2006?

SELECT Comptroller, AVG(US_Senate), Party_ID, MIN(Lieutenant_Governor), Attorney_General FROM party WHERE US_Senate = "(no election)" OR Lieutenant_Governor = "Dennis Mehiel" OR Attorney_General <> "Eliot Spitzer" OR Party != "Independence" AND "Year" <> 1998.0 AND Comptroller != "Alan Hevesi" UNION SELECT Comptroller, AVG(US_Senate), Party_ID, MIN(Lieutenant_Governor), Attorney_General FROM party WHERE "Year" > 2006.0


Question: What are the number of employees in departments that either have a ranking of 13 or more than 30266 employees, excluding the number of employees in departments named "Interior" with a budget of 62.8 billion or less and a creation date not equal to 1789?

SELECT Num_Employees FROM department WHERE "Ranking" = 13 OR "Num_Employees" > 30266.0 EXCEPT SELECT Num_Employees FROM department WHERE Name = "Interior" AND "Budget_in_Billions" <= 62.8 AND Creation != "1789"


Question: Can you give me a list of aircraft IDs, including those from the aircraft table that are not equal to 5, and those from the airport_aircraft table that are equal to 3?

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


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

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


Question: Can you list all driver IDs that are less than 5 from the driver table, and combine that with a list of all driver IDs that are less than 10 from the school bus table, removing any duplicates?

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


Question: Can you list the driver IDs that are less than 7 from the driver table, and combine that with a list of driver IDs that are greater than 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: Can you list the maker and ID for all car makers that are either "subaru" or from country "5", but not named "Opel" and have an ID less than or equal to 23, combined with a list of the maker and ID for all car makers not from country "4"?

SELECT Maker, Id FROM car_makers WHERE Maker = "subaru" OR Country = "5" AND FullName <> "Opel" AND "Id" <= 23 UNION SELECT Maker, Id FROM car_makers WHERE Country <> "4"


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 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, where each ID is greater than 5 and appears more than once in the driver table, excluding those driver IDs that are not equal to 9 and appear more than once in the school bus table?

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


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

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


Question: Can you give me a list of ranks and their corresponding total club IDs, combining results from two separate searches: one where the coach ID is 1 or greater, and another where the rank is 2 or greater, or the gold is greater than 13, or the club ID is 6 and the bronze is less than or equal to 7?

SELECT Rank, SUM(Club_ID) FROM coach WHERE "Coach_ID" >= 1 UNION SELECT Rank, SUM(Club_ID) FROM match_result WHERE "Rank" >= 2 OR "Gold" > 13 OR "Club_ID" = 6 AND "Bronze" <= 7


Question: Can you list the driver IDs from the driver table that are less than or equal to 6, and combine that with a list of driver IDs from the school_bus table that are greater than or equal to 9?

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


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

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


Question: Could you list the document IDs for all documents that were circulated by employees other than employee number 2, combined with the document IDs of all documents that are not CDs and either were not received on September 30, 2005 at 12:10:02 AM or do not have receipt number 79?

SELECT document_id FROM Circulation_History WHERE "employee_id" != 2 UNION SELECT document_id FROM Documents WHERE document_type_code <> "CD" AND receipt_date != "2005-09-30 00:10:02" OR receipt_number <> "79"


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

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


Question: Can you give me a list of heights of people, excluding those who are no taller than 182 cm, where the people are either not named Semen Poltavskiy, or are not 205 cm tall and were born on May 26, 1986, or are not Russian?

SELECT Height FROM people WHERE Name != "Semen Poltavskiy" OR "Height" <> 205.0 AND Birth_Date = "May 26, 1986" OR Nationality <> "Russia" EXCEPT SELECT Height FROM people WHERE "Height" <= 182.0


Question: Which aircraft IDs are not equal to 1 in the aircraft table and also not equal to 2 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: Can you list the aircraft IDs, first from the aircraft table excluding aircraft ID 1, and then from the airport_aircraft table including only aircraft ID 5?

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


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

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


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

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


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

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


Question: Could you give me the name, continent, and ID of countries that are not Australia or have a continent value greater than 1 and an ID not equal to 6, but only if they are also not the USA or have an ID less than 1 or a continent not equal to 3?

SELECT CountryName, Continent, CountryId FROM countries WHERE CountryName <> "australia" OR "Continent" > 1 AND "CountryId" <> 6 INTERSECT SELECT CountryName, Continent, CountryId FROM countries WHERE CountryName <> "usa" OR "CountryId" < 1 OR "Continent" <> 3


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

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


Question: Can you give me a list of company IDs, including those where people worked for 4 years, as well as those where the company ID is not 7 and the person's ID is greater than 3?

SELECT Company_ID FROM employment WHERE "Year_working" = 4 UNION ALL SELECT Company_ID FROM employment WHERE "Company_ID" <> 7 AND "People_ID" > 3


Question: Can you list all driver IDs, including those from the driver table that are 11 or greater, and those from the school bus table that are less than 7?

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


Question: Which aircraft IDs are both equal to 3 in the aircraft table and greater than or equal to 2 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 the Paragraph ID, Other Details, Document ID, and Paragraph Text for all paragraphs that either have a Document ID of 2394 and contain the text "Korea", or have a Document ID less than or equal to 3540024, Other Details listed as "None", and a Paragraph ID less than 7?

SELECT Paragraph_ID, Other_Details, Document_ID, Paragraph_Text FROM Paragraphs WHERE "Document_ID" = 2394 AND Paragraph_Text = "Korea" UNION SELECT Paragraph_ID, Other_Details, Document_ID, Paragraph_Text FROM Paragraphs WHERE "Document_ID" <= 3540024 AND Other_Details = "None" AND "Paragraph_ID" < 7


Question: Can you give me the School ID, School name, and Type for all schools that are either Columbia University and not Kindergarten, or are Private, or have a School ID of 4, or are not located in Jakarta, Indonesia, combined with all schools that have a School ID greater than 3?

SELECT School_ID, School, Type FROM school WHERE School = "Columbia University" AND Grade != "Kindergarten" OR Type = "Private" OR "School_ID" = 4 OR Location <> "Jakarta, Indonesia" UNION SELECT School_ID, School, Type FROM school WHERE "School_ID" > 3


Question: Can you list the aircraft IDs that appear more than once in the aircraft table and are greater than 1, combined with the aircraft IDs that appear more than once in the airport_aircraft table and are greater than or equal to 3?

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


Question: Can you give me the sum of cities and the state/province/county from the Addresses table where the country isn't USA, the zip code isn't 00005, the address ID is less than 13, and the building number isn't 00704 Zoe Alley, or where the state/province/county isn't Louisiana and the city isn't New Bernieceburgh, but only if these results also match records where the zip code isn't 22194, the address ID is at least 11, the country isn't USA, or the city isn't South Eugene and the building number is 4834 Schaefer Light Suite 947 and the state/province/county is Washington?

SELECT SUM(city), state_province_county FROM Addresses WHERE country <> "USA" AND zip_postcode <> "00005" AND "address_id" < 13 AND line_1_number_building <> "00704 Zoe Alley" OR state_province_county != "Louisiana" AND city != "New Bernieceburgh" INTERSECT SELECT SUM(city), state_province_county FROM Addresses WHERE zip_postcode != "22194" OR "address_id" >= 11 OR country != "USA" OR city != "South Eugene" AND line_1_number_building = "4834 Schaefer Light Suite 947" AND state_province_county = "Washington"


Question: Could you give me the PetID and StuID combinations where the StuID is 1002, but exclude any combinations where the PetID is less than or equal to 2002 and the StuID is greater than or equal to 1002?

SELECT PetID, StuID FROM Has_Pet WHERE "StuID" = 1002 EXCEPT SELECT PetID, StuID FROM Has_Pet WHERE "PetID" <= 2002 AND "StuID" >= 1002


Question: What is the highest Club ID from the club table where the Club ID is less than or equal to 5, the start year is not 2005, the region is not USA, or the club name is Helsingborgs IF, combined with the highest Club ID from the match result table where Big Silver is less than 14 and Small Silver is 9?

SELECT MAX(Club_ID) FROM club WHERE "Club_ID" <= 5 AND "Start_year" != 2005 OR Region <> "USA" OR Club_name = "Helsingborgs IF" UNION ALL SELECT MAX(Club_ID) FROM match_result WHERE "Big_Silver" < 14 AND "Small_Silver" = 9


Question: Which aircraft IDs, excluding aircraft ID 2, are also aircraft ID 3 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 = 3


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

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


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

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


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

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


Question: Can you list all the driver IDs that are less than 1 from the driver table, and combine that with a list of all driver IDs less than 7 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 < 7


Question: Could you give me the IDs of the addresses that documents were mailed to, where the address ID is 5, or the document ID is greater than 12, or the mailing date was January 1st, 2007 at 10:32 PM, but only if the address ID is also less than 8?

SELECT mailed_to_address_id FROM Documents_Mailed WHERE "mailed_to_address_id" = 5 OR "document_id" > 12 OR mailing_date = "2007-01-01 22:32:11" INTERSECT SELECT mailed_to_address_id FROM Documents_Mailed WHERE "mailed_to_address_id" < 8


Question: Which driver IDs are equal to 6, but are not driver IDs less than or equal to 4 that are also in the school bus table?

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


Question: Which driver IDs appear in both the driver table where the ID is 10, and the school_bus table where the ID is 10 or greater?

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


Question: Could you list the document IDs from the Documents table where the shipping agent code isn't "UP", or the receipt date is September 27, 1982 at 2:52 PM and the document type code is "Hard Drive", or the receipt number isn't "93" and the document ID is greater than 17 and the document status code isn't "working", or the other details aren't "w", and also include the document IDs from the Documents_Mailed table where the mailed to address ID is less than 2?

SELECT document_id FROM Documents WHERE shipping_agent_code != "UP" OR receipt_date = "1982-09-27 14:52:15" AND document_type_code = "Hard Drive" OR receipt_number <> "93" AND "document_id" > 17 AND document_status_code != "working" OR other_details != "w" UNION SELECT document_id FROM Documents_Mailed WHERE "mailed_to_address_id" < 2


Question: Which driver IDs, that are 6 or greater, are not also driver ID 10 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 = 10


Question: Can you list the state of birth, oldest age, head ID, and name for everyone in the head table, combining two lists: one excluding people born in Delaware, and another including everyone except Franklin Langham or those older than 68?

SELECT born_state, MAX(age), head_ID, name FROM head WHERE born_state != "Delaware" UNION ALL SELECT born_state, MAX(age), head_ID, name FROM head WHERE name != "Franklin Langham" OR "age" > 68.0


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

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


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

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


Question: Can you list the price, publication ID, publication date, book ID, and publisher for all publications, including those not published by Pearson and those published in March 2007, or with a price of 3,000,000 and book ID of 5, or with a publication ID greater than 7, or where the publisher is not Pearson?

SELECT Price, Publication_ID, Publication_Date, Book_ID, Publisher FROM publication WHERE Publisher != "Pearson" UNION SELECT Price, Publication_ID, Publication_Date, Book_ID, Publisher FROM publication WHERE Publication_Date = "March 2007" OR "Price" = 3000000.0 AND "Book_ID" = 5 OR "Publication_ID" > 7 OR Publisher <> "Pearson"


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

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


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

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


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

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


Question: Which driver IDs are greater than 1 and also not equal to 4?

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


Question: Can you give me a list of driver IDs that are less than or equal to 7, excluding any driver IDs greater than 3 that are associated with school buses?

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


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

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


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

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


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

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


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


Question: Could you give me the document and paragraph IDs from the Paragraphs table where either the other details are not "None" or the paragraph ID is not 65 and the document ID is at least 16514113, combined with the document and paragraph IDs where the paragraph text is "Palestinian Territory", the document ID is at least 2394, the paragraph ID is greater than 608931827, and the other details are not "None"?

SELECT Document_ID, Paragraph_ID FROM Paragraphs WHERE Other_Details != "None" OR "Paragraph_ID" <> 65 AND "Document_ID" >= 16514113 UNION ALL SELECT Document_ID, Paragraph_ID FROM Paragraphs WHERE Paragraph_Text = "Palestinian Territory" AND "Document_ID" >= 2394 AND "Paragraph_ID" > 608931827 AND Other_Details != "None"


Question: Can you give me a list of driver IDs that are less than 10 and also not equal to 3, considering all drivers and school bus drivers?

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


Question: Can you list the aircraft IDs that are both less than or equal to 5 in the aircraft table and greater than or equal to 2 in the airport_aircraft table?

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


Question: Can you list the countries of car makers, excluding Citroen, but including those with country code 7 or the full name Honda, or those with an ID less than 3, but only if those countries are not also associated with makers having an ID less than 16 and not Renault, or a country code not equal to 1 and not Ford Motor Company?

SELECT Country FROM car_makers WHERE Maker != "citroen" AND Country = "7" OR FullName = "Honda" OR "Id" < 3 NOT IN (SELECT Country FROM car_makers WHERE "Id" < 16 AND Maker <> "renault" OR Country <> "1" AND FullName != "Ford Motor Company")


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

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


Question: Can you give me a list of aircraft IDs, including aircraft ID 4 from the aircraft table, and all aircraft IDs except 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: Can you give me a list of employee names who are 28 or older, combined with a list of shop names that are either not "FC KooTeePee" and not located in "Espoo" and don't have 5000 products, or have "Mika Laurikainen" as the manager?

SELECT Name FROM employee WHERE "Age" >= 28 UNION ALL SELECT Name FROM shop WHERE Name <> "FC KooTeePee" AND Location <> "Espoo" AND "Number_products" <> 5000 OR Manager_name = "Mika Laurikainen"


Question: Could you list the aircraft IDs that are greater than 2 when grouped in the aircraft table, and also less than or equal to 5 when grouped 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 give me a list of driver IDs that are both less than or equal to 12 from the driver table and not equal to 10 from the school bus table?

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


Question: Can you list all driver IDs less than or equal to 10, combining the unique IDs from both the driver and school bus lists?

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

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


Question: Can you list all the salaries from the employee table, including those of employees with an ID less than 552455348 who are not named John Williams, as well as those salaries that are not equal to 84476?

SELECT salary FROM employee WHERE "eid" < 552455348 AND name <> "John Williams" UNION SELECT salary FROM employee WHERE "salary" != 84476


Question: What is the count of full-time employees and the highest shop ID for shops that started in a year other than 2008 or have a shop ID less than 5, excluding the count of full-time employees and the highest shop ID for shops where the employee ID is greater than 1, the shop ID is not 2, or the start year is not 2013?

SELECT COUNT(Is_full_time), MAX(Shop_ID) FROM hiring WHERE Start_from <> "2008" OR "Shop_ID" < 5 EXCEPT SELECT COUNT(Is_full_time), MAX(Shop_ID) FROM hiring WHERE "Employee_ID" > 1 OR "Shop_ID" <> 2 OR Start_from != "2013"


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 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, excluding driver ID 2, that are not also driver ID 10 in the school bus list?

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


Question: Can you give me a list of car models, excluding "chevrolet chevelle malibu classic", but then remove any models that are also in a list where the ModelId is less than 13, the Maker is greater than or equal to 4, or the model is not "amc"?

SELECT Model FROM car_names WHERE Make != "chevrolet chevelle malibu classic" EXCEPT SELECT Model FROM model_list WHERE "ModelId" < 13 OR "Maker" >= 4 OR Model <> "amc"


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 10 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 both less than or equal to 8 and appear in the driver table, and also less than 9 and appear in the school bus table?

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


Question: Can you give me a list of template type codes that are either not "BK" or have a description other than "Advertisement", combined with template type codes from templates that have a date effective from not equal to "1986-11-14 12:20:18", or a template type code not equal to "PPT", or have template details that are not empty, or a template ID not equal to 7, or a version number not equal to 8 and a date effective to not equal to "2008-01-05 14:19:28"?

SELECT Template_Type_Code FROM Ref_Template_Types WHERE Template_Type_Code <> "BK" OR Template_Type_Description != "Advertisement" UNION SELECT Template_Type_Code FROM Templates WHERE Date_Effective_From <> "1986-11-14 12:20:18" OR Template_Type_Code <> "PPT" OR Template_Details != "" OR "Template_ID" != 7 OR "Version_Number" <> 8 AND Date_Effective_To <> "2008-01-05 14:19:28"


Question: Can you give me a list of student IDs from the Member_of_club table where their position isn't President, or their student ID is greater than 1007, or their club ID is greater than or equal to 2, combined with a list of student IDs from the Student table where their advisor is 8722, their major is greater than 600, and their sex is male?

SELECT StuID FROM Member_of_club WHERE Position != "President" OR "StuID" > 1007 OR "ClubID" >= 2 UNION SELECT StuID FROM Student WHERE "Advisor" = 8722 AND "Major" > 600 AND Sex = "M"


Question: Can you give me a list of driver IDs that appear in the driver table, excluding driver ID 3, but only if they don't appear in the school bus table with an ID of 3 or less?

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: Can you give me a list of driver IDs, excluding driver ID 10, that are in the driver table but not in the school bus table, also excluding driver ID 4 from the school bus table?

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


Question: Can you give me a list of all driver IDs, excluding driver ID 10 from the driver table and excluding driver ID 4 from the school_bus table, making sure there are no duplicates in the final list?

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


Question: Which driver IDs are both greater than 3 and also less than 10, considering drivers from both the driver and school bus lists?

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


Question: Can you give me a list of driver IDs, where each ID is greater than 7, and exclude 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 > 7 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 4


Question: Could you give me the payment dates and amounts that appear in both of these lists: one where the payment amount isn't exactly 6970.98 or the payment method is Direct Debit, and another where the payment date is March 6, 2018 at 9:36:41 PM, or the customer ID is 14 or higher, or the payment method is not Direct Debit?

SELECT datetime_payment, amount_payment FROM Customer_Payments WHERE "amount_payment" != 6970.98 OR payment_method_code = "Direct Debit" INTERSECT SELECT datetime_payment, amount_payment FROM Customer_Payments WHERE datetime_payment = "2018-03-06 21:36:41" OR "customer_id" >= 14 OR payment_method_code != "Direct Debit"


Question: How many payments were made using methods other than direct debit on February 6, 2018, at 1:35 PM by good customers, excluding those with the phone number (662)490-3108, or where the payment amount was 1708.18 and they became a customer on October 5, 2017, at 2:15 PM with a birthdate of September 18, 1998, at 4:45 AM, or where the outstanding amount is at least 9332.0, or where the email address is kroberts@example.org, and what are the mobile phone numbers of those customers?

SELECT COUNT(T1.amount_payment), T2.cell_mobile_phone_number FROM Customer_Payments as T1 JOIN Customers as T2 ON T1.customer_id = T2.customer_id WHERE payment_method_code <> "Direct Debit" AND datetime_payment = "2018-02-06 13:35:58" AND customer_status_code = "Good Customer" AND phone_number <> "(662)490-3108" OR "amount_payment" = 1708.18 AND date_became_customer = "2017-10-05 14:15:46" AND date_of_birth = "1998-09-18 04:45:01" OR "amount_outstanding" >= 9332.0 OR email_address = "kroberts@example.org"


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

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


Question: Can you give me a list of school IDs, including those from schools with either 287 students enrolled or the mascot "Falcons", as well as those from the budget table where the invested amount is not 8335 and the percentage of the total budget invested is not 2.7?

SELECT School_id FROM School WHERE "Enrollment" = 287 OR Mascot = "Falcons" UNION ALL SELECT School_id FROM budget WHERE "Invested" <> 8335 AND "total_budget_percent_invested" != 2.7


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


Question: Can you show me the delegate, election ID, committee, counties represented, party, year first elected, and district for all elections where the party is at least 1 or the counties represented are "09.1 9A", along with the same information for all elections where the counties represented are not "13"?

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

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

SELECT Delegate, Election_ID, Committee, Counties_Represented, Party, First_Elected, District FROM election WHERE "Party" >= 1 OR Counties_Represented = "09.1 9A" UNION SELECT Delegate, Election_ID, Committee, Counties_Represented, Party, First_Elected, District FROM election WHERE Counties_Represented <> "13"


Question: What is the average staff ID from lessons where the staff ID is 4 or greater, or the customer ID is 10 or greater and the lesson status is not cancelled, or the vehicle ID is greater than 1 and the lesson date is February 28, 2018 at 10:55:36, or the lesson time is not 9, or the price is 277 or greater, or the lesson ID is 1 or less, combined with the average staff ID from staff members where the staff ID is not 3 and the date they joined is June 6, 2016 at 8:54:28, or their nickname is thompson.constantin and their last name is Mertz, or their date of birth is not April 27, 1998 at 12:55:05?

SELECT AVG(staff_id) FROM Lessons WHERE "staff_id" >= 4 OR "customer_id" >= 10 AND lesson_status_code <> "Cancelled" OR "vehicle_id" > 1 AND lesson_date = "2018-02-28 10:55:36" OR lesson_time <> "9" OR "price" >= 277.0 OR "lesson_id" <= 1 UNION ALL SELECT AVG(staff_id) FROM Staff WHERE "staff_id" <> 3 AND date_joined_staff = "2016-06-06 08:54:28" OR nickname = "thompson.constantin" AND last_name = "Mertz" OR date_of_birth <> "1998-04-27 12:55:05"


Question: Can you give me a list of driver IDs that are not equal to 2, but also are not driver IDs less than 9 that are associated with school buses?

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


Question: Which driver IDs are greater than 2 and also greater than 7, considering driver IDs from both the driver and school bus lists?

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


Question: Can you list the Pet ID, age, and weight for all pets where the Pet ID is 2003 or higher and the age is greater than 1, combined with the Pet ID, age, and weight for all pets where the Pet ID is greater than 2001 and the weight is not 13.4?

SELECT PetID, pet_age, weight FROM Pets WHERE "PetID" >= 2003 AND "pet_age" > 1 UNION SELECT PetID, pet_age, weight FROM Pets WHERE "PetID" > 2001 AND "weight" <> 13.4


Question: What are the average employee ID, city, youngest name, and oldest age for employees 30 or older, excluding those results where the city is not Bath?

AVG(Employee_ID) City MIN(Name) MAX(Age)

SELECT AVG(Employee_ID), City, MIN(Name), MAX(Age) FROM employee WHERE "Age" >= 30 EXCEPT SELECT AVG(Employee_ID), City, MIN(Name), MAX(Age) FROM employee WHERE City != "Bath"


Question: What amenity feature types are available, excluding those that are either not "Amenity" or have a name other than "Amenity, eg Pool." in the feature types reference?

SELECT feature_type_code FROM Other_Available_Features WHERE feature_type_code = "Amenity" AND feature_name <> "AirCon" EXCEPT SELECT feature_type_code FROM Ref_Feature_Types WHERE feature_type_name <> "Amenity, eg Pool." OR feature_type_code <> "Amenity"


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

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


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

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


Question: Can you show me the product ID, color pages per minute, product name, DPI, and interface for all products where either the color pages per minute is less than 30, or the product ID is not 3, or the dimensions are 298 x 209 x 99 and the product is "Fujitsu fi-6130 A4 Series Scanner", or the DPI is less than 600, or the maximum page size is not A4, along with all products where the maximum page size is not A4?

SELECT product_id, pages_per_minute_color, product, dpi, interface FROM product WHERE "pages_per_minute_color" < 30.0 OR "product_id" <> 3 OR dimensions = "298 x 209 x 99" AND product = "Fujitsu fi-6130 A4 Series Scanner" OR "dpi" < 600.0 OR max_page_size <> "A4" UNION ALL SELECT product_id, pages_per_minute_color, product, dpi, interface FROM product WHERE max_page_size <> "A4"


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

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


Question: Can you list the aircraft IDs, excluding ID 4, that appear in the aircraft table, but are not aircraft IDs greater than or equal to 5 that appear in the airport_aircraft table?

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


Question: Can you show me the budget in billions and the highest department ID for each budget, but only if the highest department ID is less than or equal to 9, and also show me the budget in billions and the highest department ID for each budget where the highest department ID is less than 3?

SELECT Budget_in_Billions, MAX(Department_ID) FROM department GROUP BY Budget_in_Billions HAVING MAX(Department_ID) <= 9 UNION ALL SELECT Budget_in_Billions, MAX(Department_ID) FROM department GROUP BY Budget_in_Billions HAVING MAX(Department_ID) < 3


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

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


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

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


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

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


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 8 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, excluding driver ID 2, that are not also driver IDs, excluding driver ID 9, found in the school bus table?

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


Question: Which driver IDs, excluding 9, are also driver IDs greater than 4 in the school bus list?

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


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

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


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

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


Question: Which driver IDs are both not equal to 4 and greater than 3, considering the drivers from the driver table and the school bus table?

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


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

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: Can you give me the ages and IDs of people who meet both of these conditions: first, they either have an ID of 5 or greater, or are not from the United States and graduated from college in California; and second, they don't have an ID of 2, didn't graduate from college in Virginia, are younger than 37, are not named Jerry Corcoran, and are not from the United States?

SELECT Age, People_ID FROM people WHERE "People_ID" >= 5 OR Nationality <> "United States" AND Graduation_College = "California" INTERSECT SELECT Age, People_ID FROM people WHERE "People_ID" != 2 AND Graduation_College <> "Virginia" AND "Age" < 37 AND Name != "Jerry Corcoran" AND Nationality <> "United States"


Question: What are the average document ID, the count of copy numbers, and the average draft number for draft copies where either the draft number is 20 or greater and the document ID is greater than 1, or the copy number is 10, combined with the same averages and count for draft copies where either the copy number is not 4 and the draft number is less than 8, or the document ID is 23?

SELECT AVG(document_id), COUNT(copy_number), AVG(draft_number) FROM Draft_Copies WHERE "draft_number" >= 20 AND "document_id" > 1 OR "copy_number" = 10 UNION ALL SELECT AVG(document_id), COUNT(copy_number), AVG(draft_number) FROM Draft_Copies WHERE "copy_number" <> 4 AND "draft_number" < 8 OR "document_id" = 23


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 greater than 4?

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


Question: Can you find the smallest employee ID for employees in Wasps who are not 29 years old, or whose name isn't Steve Borthwick and whose employee ID is 5, and also find the smallest employee ID from hiring records where the employee is not full-time?

SELECT MIN(Employee_ID) FROM employee WHERE City = "Wasps" AND "Age" <> 29 OR Name <> "Steve Borthwick" AND "Employee_ID" = 5 UNION SELECT MIN(Employee_ID) FROM hiring WHERE Is_full_time != "T"


Question: Can you give me a list of driver IDs, including those from the driver table that are 8 or higher, 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 >= 8 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 10


Question: Could you give me the color pages per minute, dpi, product name, maximum dimensions, and product ID from the product table, but only for entries that meet these two sets of criteria: first, where the dimensions are "300 x 50 x 45", the maximum page size isn't "A4", the product name isn't "Canon imageFORMULA P-150" and the color pages per minute is greater than 10, or the product ID is less than 2; and second, where the dpi is 600 or the interface isn't "USB 2.0" and the color pages per minute isn't 28?

SELECT pages_per_minute_color, dpi, product, MAX(dimensions), product_id FROM product WHERE dimensions = "300 x 50 x 45" OR max_page_size <> "A4" OR product <> "Canon imageFORMULA P-150" AND "pages_per_minute_color" > 10.0 OR "product_id" < 2 INTERSECT SELECT pages_per_minute_color, dpi, product, MAX(dimensions), product_id FROM product WHERE "dpi" = 600.0 OR interface <> "USB 2.0" AND "pages_per_minute_color" <> 28.0


Question: Can you list all 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 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: What is the total number of aircraft IDs associated with each airport ID?

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


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

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

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


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

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


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


Question: Can you give me a list of employee IDs from the evaluation table, excluding those awarded in 2011 and employee ID 1, or where the bonus isn't 3000, but then remove any employee IDs that are less than 3 from the hiring table?

SELECT Employee_ID FROM evaluation WHERE Year_awarded != "2011" AND Employee_ID <> "1" OR "Bonus" != 3000.0 EXCEPT SELECT Employee_ID FROM hiring WHERE "Employee_ID" < 3


Question: Which driver IDs are both greater than 2 and present in the driver table, and also greater than 3 and present 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, excluding driver ID 11, that are not also driver IDs less than 3 in the school bus table?

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


Question: Can you give me a list of driver IDs, where each ID is greater than 4 and appears more than once in the driver table, but does not appear in the school_bus table with an ID greater than or equal to 4?

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


Question: Can you give me a list of driver IDs, up to and including 9, that are present in the driver table but not present in the school_bus table where the driver ID is 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: Can you list all the driver IDs that are greater than or equal to 6 from the driver table, and combine that with a list of all driver IDs that are greater than 3 from the school bus table?

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


Question: Can you give me the employee ID and other details for all employees who don't have the role code "PR", excluding those employees whose employee ID is not 5?

SELECT employee_id, other_details FROM Employees WHERE role_code <> "PR" EXCEPT SELECT employee_id, other_details FROM Employees WHERE "employee_id" <> 5


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


Question: Can you give me a list of branch and member IDs from the membership register for years other than 2016, excluding any branch and member IDs associated with member ID 3 in the purchase table?

SELECT Branch_ID, Member_ID FROM membership_register_branch WHERE Register_Year != "2016" EXCEPT SELECT Branch_ID, Member_ID FROM purchase WHERE "Member_ID" = 3


Question: Can you give me a list of document IDs from the Documents_Mailed table where the document ID is greater than 12 or the mailing date is January 1, 2007 at 10:32 PM, combined with a list of document IDs from the Draft_Copies table where the draft number is 2, the document ID is 20 or greater, or the copy number is greater than 10?

SELECT document_id FROM Documents_Mailed WHERE "document_id" > 12 OR mailing_date = "2007-01-01 22:32:11" UNION ALL SELECT document_id FROM Draft_Copies WHERE "draft_number" = 2 OR "document_id" >= 20 OR "copy_number" > 10


Question: Can you give me a list of Template IDs from the Documents table where the Document Description isn't "w" and Other Details isn't "None", or where the Template ID is greater than 4, combined with a list of Template IDs from the Templates table where Template Details isn't empty, or the Version Number is less than or equal to 7, or the Template Type Code is "PP" and the Template ID is greater than 8, or the Date Effective To isn't "1980-05-07 12:15:47"?

SELECT Template_ID FROM Documents WHERE Document_Description <> "w" AND Other_Details <> "None" OR "Template_ID" > 4 UNION SELECT Template_ID FROM Templates WHERE Template_Details <> "" OR "Version_Number" <= 7 OR Template_Type_Code = "PP" AND "Template_ID" > 8 OR Date_Effective_To <> "1980-05-07 12:15:47"


Question: Can you give me the date sold, property name, vendor's requested price, and all the feature columns, agreed selling price, property ID, and other property details for properties that either had an agreed selling price not equal to 170766.472 and no second house feature or were put on the market on "1981-08-23 05:40:38" and do not have no second shop feature and have a property ID of 6 or less and are not named "riverside", along with the same information for properties that either do not have "adipisci" as their second apartment feature and have other property details that are not "None", or were put on the market on "1978-05-15 10:53:37", or do not have "None" as their second other feature and do not have "None" as their third apartment feature and have "enim" as their first apartment feature, or do not have a property ID of 3, or had a buyer offered price less than 15.17, or are not named "murray hill", or do not have the address "60845 Else Highway Apt. 826 South Dougfort, CO 43200-4258", or have less than 9 rooms, or do not have "None" as their first other feature and do not have "None" as their first field feature, or do not have "None" as their third field feature and do not have "None" as their second shop feature and do not have a second house feature, or do not have a third house feature and do not have "None" as their first shop feature, or do not have "None" as their first house feature, or were not sold on "1984-02-01 19:54:54" and are not an apartment, or do not have "None" as their second field feature and had a vendor requested price of 2573.0, or had an agreed selling price greater than 4201.8?

SELECT date_sold, property_name, vendor_requested_price, fld_feature_1, apt_feature_3, oth_feature_3, agreed_selling_price, oth_feature_1, apt_feature_1, property_id, fld_feature_3, apt_feature_2, other_property_details, hse_feature_3 FROM Properties WHERE "agreed_selling_price" != 170766.472 AND hse_feature_2 = "None" OR date_on_market = "1981-08-23 05:40:38" AND shp_feature_2 != "None" AND "property_id" <= 6 AND property_name <> "riverside" UNION ALL SELECT date_sold, property_name, vendor_requested_price, fld_feature_1, apt_feature_3, oth_feature_3, agreed_selling_price, oth_feature_1, apt_feature_1, property_id, fld_feature_3, apt_feature_2, other_property_details, hse_feature_3 FROM Properties WHERE apt_feature_2 <> "adipisci" AND other_property_details != "None" OR date_on_market = "1978-05-15 10:53:37" OR oth_feature_2 != "None" AND apt_feature_3 != "None" AND apt_feature_1 = "enim" OR "property_id" <> 3 OR "buyer_offered_price" < 15.17 OR property_name <> "murray hill" OR property_address <> "60845 Else Highway Apt. 826 South Dougfort, CO 43200-4258" OR "room_count" < 9 OR oth_feature_1 != "None" AND fld_feature_1 <> "None" OR fld_feature_3 <> "None" AND shp_feature_2 <> "None" AND hse_feature_2 = "None" OR hse_feature_3 = "None" AND shp_feature_1 = "None" OR hse_feature_1 != "None" OR date_sold <> "1984-02-01 19:54:54" AND property_type_code != "Apartment" OR fld_feature_2 != "None" AND "vendor_requested_price" = 2573.0 OR "agreed_selling_price" > 4201.8


Question: Can you give me a list of branch names that either didn't open in 2009, aren't named "Brooke Greville", or are located on Cecilia Avenue, combined with a list of member names where the member ID isn't 5 and their hometown isn't Fort Campbell, Kentucky?

SELECT Name FROM branch WHERE Open_year <> "2009" OR Name != "Brooke Greville" OR Address_road = "Cecilia Avenue" UNION SELECT Name FROM member WHERE "Member_ID" != 5 AND Hometown != "Fort Campbell, Kentucky"


Question: Can you list the ranks from match results where the "Small_Silver" value is at least 6 and the "Club_ID" is at least 4, combined with the ranks of female players who aren't player ID 2 and are ranked "3rd", or whose sponsor isn't "Charleswood—St. James—Assiniboia"?

SELECT Rank FROM match_result WHERE "Small_Silver" >= 6 AND "Club_ID" >= 4 UNION ALL SELECT Rank FROM player WHERE "Player_ID" <> 2 AND Gender = "F" AND Rank = "3rd" OR Sponsor_name <> "Charleswood—St. James—Assiniboia"


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


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

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


Question: Can you list the aircraft IDs that are both less than or equal to 4 and also not equal to 2, considering the aircraft and airport_aircraft datasets?

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


Question: Can you give me the average district, location, and shop ID, along with the number of products, shop name, and the earliest manager name for shops, combining two sets of results: first, for shops not in Turku or in the Tehtaan kenttä district with a shop ID of 9 or greater, and second, for shops with a shop ID greater than 7 or a name other than FC KooTeePee?

SELECT AVG(District), AVG(Location), AVG(Shop_ID), COUNT(Number_products), Name, MIN(Manager_name) FROM shop WHERE Location != "Turku" OR District = "Tehtaan kenttä" AND "Shop_ID" >= 9 UNION ALL SELECT AVG(District), AVG(Location), AVG(Shop_ID), COUNT(Number_products), Name, MIN(Manager_name) FROM shop WHERE "Shop_ID" > 7 OR Name <> "FC KooTeePee"


Question: Can you give me a list of driver IDs, excluding driver ID 8, from the driver table, but only those driver IDs that are not in the school bus table, excluding driver ID 10?

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


Question: Can you give me a list of all the driver IDs, excluding driver ID 4 from the driver table, combined with a list of all driver IDs, excluding driver ID 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 find the smallest student ID from the Has_Pet table, excluding those with PetID 2001 and Student ID 1001, and combine that with the smallest student ID from the Student table where the major is less than 520, the student ID is greater than or equal to 1024, the last name is Kumar, or the first name isn't Jun, or the city code isn't BAL and the sex is male, or the age isn't 20?

SELECT MIN(StuID) FROM Has_Pet WHERE "PetID" <> 2001 AND "StuID" != 1001 UNION ALL SELECT MIN(StuID) FROM Student WHERE "Major" < 520 AND "StuID" >= 1024 AND LName = "Kumar" OR Fname != "Jun" OR city_code != "BAL" AND Sex = "M" OR "Age" <> 20


Question: Can you give me a list of driver IDs, excluding driver 9 from the driver list and excluding driver 7 from the school bus list?

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


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

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


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

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


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

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


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


Question: For each aircraft, what is the total number of aircraft IDs associated with it in the airport aircraft table?

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


Question: Can you give me a list of student IDs for those who have a pet with an ID greater than 2002 and whose own ID is 1002, along with a list of student IDs for those whose major is less than 520?

SELECT StuID FROM Has_Pet WHERE "StuID" = 1002 AND "PetID" > 2002 UNION ALL SELECT StuID FROM Student WHERE "Major" < 520


Question: Can you give me a list of student IDs, including those who have any allergy other than soy, and also those who are students with a major code less than or equal to 550, or whose first name isn't Sarah, advisor isn't 8722, student ID is less than or equal to 1029, are male, have the last name Gompers, or have a city code that isn't NYC?

SELECT StuID FROM Has_Allergy WHERE Allergy != "Soy" UNION ALL SELECT StuID FROM Student WHERE "Major" <= 550 OR Fname <> "Sarah" AND "Advisor" <> 8722 AND "StuID" <= 1029 AND Sex = "M" AND LName = "Gompers" OR city_code != "NYC"


Question: Can you list the aircraft IDs that are both less than or equal to 2 in the aircraft table and greater than or equal to 1 in the airport_aircraft table?

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


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

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: Could you list all the aircraft IDs from the certificate table where the event ID is greater than 573284895 and the aircraft ID is not 4, combined with a list of aircraft IDs from the flight table where the price is not 220.98, or the flight number is not 2, or the origin is Los Angeles and the departure date is not April 12, 2005 at 5:30 AM, or the arrival date is not April 12, 2005 at 5:03 AM, or the aircraft ID is 1, or the destination is Washington D.C., or the distance is less than or equal to 5478?

SELECT aid FROM certificate WHERE "eid" > 573284895 AND "aid" != 4 UNION SELECT aid FROM flight WHERE "price" <> 220.98 OR "flno" != 2 OR origin = "Los Angeles" AND departure_date <> "04/12/2005 05:30" OR arrival_date != "04/12/2005 05:03" OR "aid" = 1 OR destination = "Washington D.C." OR "distance" <= 5478


Question: What are the total document IDs, earliest other details, and document descriptions for documents where the description is "w" or the other details are "None", excluding those where the template ID is not 21 and the document name is not "Understanding DB"?

SELECT SUM(Document_ID), MIN(Other_Details), Document_Description FROM Documents WHERE Document_Description = "w" OR Other_Details = "None" EXCEPT SELECT SUM(Document_ID), MIN(Other_Details), Document_Description FROM Documents WHERE "Template_ID" <> 21 AND Document_Name <> "Understanding DB"


Question: Can you list all the store IDs from the store district table, including those where the district ID is not 11 and the store ID is not 2, along with store IDs that are greater than 3?

SELECT Store_ID FROM store_district WHERE "District_ID" != 11 AND "Store_ID" != 2 UNION ALL SELECT Store_ID FROM store_district WHERE "Store_ID" > 3


Question: Which driver has an ID of 3, but is not a driver with an ID of 4 who drives 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 = 4


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

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


Question: Which driver IDs, excluding driver ID 7, are also driver ID 4 in the school bus records?

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


Question: What is the sum of CountryId for countries with a CountryId of 10 and a Continent value less than or equal to 5, excluding Sweden, after subtracting the sum of CountryId for countries with a CountryId less than or equal to 2?

SELECT SUM(CountryId) FROM countries WHERE "CountryId" = 10 AND "Continent" <= 5 AND CountryName <> "sweden" EXCEPT SELECT SUM(CountryId) FROM countries WHERE "CountryId" <= 2


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

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


Question: Can you give me the document type codes that appear both in documents received on a date other than July 2nd, 2017 with receipt number 83, or with a document type code other than CD, or with a shipping agent code other than AL, or with a document ID greater than 14 and other details not equal to "u", and also in the reference document types with document type code CD or a document type description other than "b"?

SELECT document_type_code FROM Documents WHERE receipt_date != "2017-07-02 17:39:09" AND receipt_number = "83" OR document_type_code != "CD" OR shipping_agent_code != "AL" OR "document_id" > 14 AND other_details != "u" INTERSECT SELECT document_type_code FROM Ref_Document_Types WHERE document_type_code = "CD" OR document_type_description != "b"


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

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


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 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 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 list the Store ID and Store Name for stores that either have a Store ID of 5 or less and at least 17811 product categories, or have a Store Name that is not Neguac, combined with the Store ID and Store Name for stores that have 793 or fewer product categories, or have a Store ID of 2, an area size of at least 21.73, are a City Mall, and have a ranking of 9 or higher?

SELECT Store_ID, Store_Name FROM store WHERE "Store_ID" <= 5 AND "Number_of_product_category" >= 17811.0 OR Store_Name <> "Neguac" UNION SELECT Store_ID, Store_Name FROM store WHERE "Number_of_product_category" <= 793.0 OR "Store_ID" = 2 AND "Area_size" >= 21.73 AND Type = "City Mall" AND "Ranking" >= 9


Question: Which driver has an ID of 4 and also drives a school bus, but not school bus number 7?

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


Question: Can you give me the genders and ranks of coaches who either have a rank of 3, aren't named James Wong, and are associated with club ID 3, or have a coach ID that isn't 4, but exclude the genders and ranks of players who either have a vote count not equal to 14355 or reside in Winnipeg?

SELECT Gender, Rank FROM coach WHERE "Rank" = 3 AND Coach_name <> "James Wong" AND "Club_ID" = 3 OR "Coach_ID" != 4 EXCEPT SELECT Gender, Rank FROM player WHERE "Votes" != 14355 OR Residence = "Winnipeg"


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

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


Question: Can you list the county name, population, and county ID for all counties where the county ID is 3 and the population is not 87200, or where the county name is not Mansfield, combined with all counties where the county ID is not 3 or the zip code is not D21?

SELECT County_name, Population, County_Id FROM county WHERE "County_Id" = 3 AND "Population" <> 87200.0 OR County_name != "Mansfield" UNION ALL SELECT County_name, Population, County_Id FROM county WHERE "County_Id" != 3 OR Zip_code != "D21"


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