Question: Can you give me a list of Club IDs from clubs that are not named "Bootup Baltimore" and don't have a Club ID of 3, or have a description that isn't "Venture capital fund for student business", combined with a list of Club IDs from the Member_of_club table where the student ID is less than 1001?

SELECT ClubID FROM Club WHERE ClubName != "Bootup Baltimore" AND "ClubID" != 3 OR ClubDesc != "Venture capital fund for student business." UNION ALL SELECT ClubID FROM Member_of_club WHERE "StuID" < 1001


Question: Can you give me a list of driver IDs, combining those from the driver table excluding driver ID 2, with those from the school bus table that are less than 4, removing any duplicates?

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


Question: Can you give me a list of driver IDs less than or equal to 9, excluding any driver IDs that are not equal to 4 from 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: What is the total of all document IDs mailed to addresses with an ID greater than 5, combined with the total of all document IDs for draft copies where the document ID is greater than 20 and the copy number is greater than 15?

SELECT SUM(document_id) FROM Documents_Mailed WHERE "mailed_to_address_id" > 5 UNION SELECT SUM(document_id) FROM Draft_Copies WHERE "document_id" > 20 AND "copy_number" > 15


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

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


Question: Can you give me a list of branch IDs, including those from branches located on Valleys Place or with a name other than Saint Amant, as well as branch IDs from the membership register branch table that are not equal to 4 and have a register year other than 2016?

SELECT Branch_ID FROM branch WHERE Address_road = "Valleys Place" OR Name <> "Saint Amant" UNION ALL SELECT Branch_ID FROM membership_register_branch WHERE Branch_ID != "4" AND Register_Year <> "2016"


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


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 8 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 appear in the driver table, excluding driver ID 7, but only if they are not also driver IDs in the school bus table that 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 list all the continents, excluding Asia, where the continent ID is 1 or greater, but without including America?

SELECT Continent FROM continents WHERE Continent != "asia" AND "ContId" >= 1 EXCEPT SELECT Continent FROM continents WHERE Continent = "america"


Question: Which driver IDs appear in both the driver table, excluding driver ID 3, and the school_bus table, including only driver IDs greater than 9?

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


Question: Can you give me a list of company names that are "PetroChina", along with a list of names from the people table where the People_ID is not 2 or the Nationality is not "United States"?

SELECT Name FROM company WHERE Name = "PetroChina" UNION ALL SELECT Name FROM people WHERE "People_ID" != 2 OR Nationality <> "United States"


Question: Can you give me a list of student IDs who have a ragweed allergy, excluding student ID 1007, combined with a list of student IDs whose major is not 600?

SELECT StuID FROM Has_Allergy WHERE Allergy = "Ragweed" AND "StuID" <> 1007 UNION ALL SELECT StuID FROM Student WHERE "Major" <> 600


Question: What is the highest item ID for blue hoodies, excluding item ID 3, and what is the highest item ID for items that are not cups, excluding item ID 5?

SELECT MAX(i_id) FROM item WHERE "i_id" != 3 AND title = "blue hoodie" UNION SELECT MAX(i_id) FROM item WHERE "i_id" <> 5 AND title <> "cup"


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

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


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

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


Question: Can you give me the names, birth dates, and heights of all people, including those who are not person number 2, or whose name is not Semen Poltavskiy and nationality is not Russia, or whose height is greater than 207, along with everyone else whose height is 207 or less?

SELECT Name, Birth_Date, Height FROM people WHERE "People_ID" != 2 OR Name != "Semen Poltavskiy" AND Nationality != "Russia" OR "Height" > 207.0 UNION SELECT Name, Birth_Date, Height FROM people WHERE "Height" <= 207.0


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

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


Question: Can you tell me the aircraft ID, the lowest maximum disk loading, the maximum gross weight, the total disk area, the description, and the average aircraft value for aircraft where either the maximum gross weight isn't 73,500 lb, the aircraft ID is 1, the maximum disk loading isn't 2.6 lb/ft², the description is "Tandem rotor helicopter", the total disk area is 5,655 ft², or the aircraft isn't a Robinson R-22, combined with the same information for aircraft where the total disk area isn't 4,900 ft² and the description isn't "Heavy-lift helicopter"?

1
2.6 lb/ft² (14 kg/m²)
1,370 lb (635 kg)
497 ft² (46.2 m²)
Light utility helicopter
0

SELECT Aircraft_ID, MIN(Max_disk_Loading), Max_Gross_Weight, Total_disk_area, Description, AVG(Aircraft) FROM aircraft WHERE Max_Gross_Weight != "73,500 lb (33,300 kg)" AND "Aircraft_ID" = 1 OR Max_disk_Loading != "2.6 lb/ft² (14 kg/m²)" OR Description = "Tandem rotor helicopter" OR Total_disk_area = "5,655 ft² (526 m²)" OR Aircraft != "Robinson R-22" UNION SELECT Aircraft_ID, MIN(Max_disk_Loading), Max_Gross_Weight, Total_disk_area, Description, AVG(Aircraft) FROM aircraft WHERE Total_disk_area != "4,900 ft² (460 m²)" AND Description <> "Heavy-lift helicopter"


Question: Can you list all the driver IDs that are greater than or equal to 8 from the driver table, combined with all the driver IDs that are greater than or equal to 7 from the school bus table, removing any duplicates?

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


Question: What is the smallest school ID from the budget table where the school ID is 3, the year is 2004, or the invested amount is less than or equal to 95542, combined with the smallest school ID from the endowment table where the endowment ID is 2 and the amount is greater than 9.83, or the donator name is not Valverde, or the school ID is less than or equal to 2?

SELECT MIN(School_id) FROM budget WHERE "School_id" = 3 OR "Year" = 2004 OR "Invested" <= 95542 UNION SELECT MIN(School_id) FROM endowment WHERE "endowment_id" = 2 AND "amount" > 9.83 OR donator_name <> "Valverde" OR "School_id" <= 2


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


Question: Can you give me the IDs of drivers with IDs less than or equal to 2, excluding those drivers whose IDs are also less than 7 and appear in the school bus table?

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


Question: Can you give me a list of driver IDs from the driver table that are less than or equal to 6, combined with a list of driver IDs from the school_bus table that are less than 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 from the driver table that are 11 or higher, excluding any driver IDs from the school_bus table that are greater 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 list the aircraft IDs that are less than 4 from the aircraft table, combined with the aircraft IDs that are greater than 1 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 > 1


Question: Can you list the address IDs and document IDs from the Documents_Mailed table where either the document ID is 24 or greater and the mailing date is March 20, 2007 at 5:22 AM and the address ID is less than 8, or the mailing date is not May 16, 1986 at 6:25 AM and the document ID is not 10 and the address ID is 0?

SELECT mailed_to_address_id, document_id FROM Documents_Mailed WHERE "document_id" >= 24 AND mailing_date = "2007-03-20 05:22:01" AND "mailed_to_address_id" < 8 UNION ALL SELECT mailed_to_address_id, document_id FROM Documents_Mailed WHERE mailing_date != "1986-05-16 06:25:33" AND "document_id" != 10 AND "mailed_to_address_id" = 0


Question: Could you give me a list of all Store IDs, including those from the store table that are not of type "City Mall" or are not named "Blackville", or have a Store ID of 4, along with all Store IDs from the store_district table that are not 4?

SELECT Store_ID FROM store WHERE Type <> "City Mall" OR Store_Name <> "Blackville" OR "Store_ID" = 4 UNION ALL SELECT Store_ID FROM store_district WHERE "Store_ID" <> 4


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

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


Question: Can you give me a list of driver IDs, excluding driver ID 4, that appear in the driver table but not in the school_bus table, also excluding driver ID 9 from the school_bus table?

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


Question: Which driver IDs are present in both the list of drivers excluding driver 7, and the list of school bus drivers including driver 7 and above?

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 less than 4, excluding any driver IDs that are also greater than 9 in the school bus list?

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


Question: Can you give me a list of aircraft IDs, excluding aircraft ID 5, and also a list of aircraft IDs from the airport aircraft table, excluding aircraft ID 1?

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


Question: Can you give me a list of driver IDs where the ID is 8 from the driver table, combined with a list of driver IDs greater than 4 from the school bus table?

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


Question: Can you give me a list of driver IDs that are not 5, and are also not driver IDs greater than 3 that are associated with school buses?

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


Question: Can you give me the date they left, the latest first name, nickname, and birthdate for staff members who meet both of these conditions: either their middle name is Duane, their joining date isn't August 30, 2017 at 3:08 PM, or their address ID is less than or equal to 1, their staff ID is greater than 15, and their first name is Queenie; and also either their address ID is 2, their joining date is August 27, 2017 at 7:19:44 PM, their birthdate is May 19, 2004 at 2:11:13 PM, or their middle name isn't Mayra?

SELECT date_left_staff, MAX(first_name), nickname, date_of_birth FROM Staff WHERE middle_name = "Duane" OR date_joined_staff <> "2017-08-30 15:08:37" OR "staff_address_id" <= 1 AND "staff_id" > 15 AND first_name = "Queenie" INTERSECT SELECT date_left_staff, MAX(first_name), nickname, date_of_birth FROM Staff WHERE "staff_address_id" = 2 OR date_joined_staff = "2017-08-27 19:19:44" OR date_of_birth = "2004-05-19 14:11:13" OR middle_name <> "Mayra"


Question: Which driver IDs are both not equal to 9 and greater than 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 <> 9 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 4


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

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


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

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 8 from the driver table and driver ID 3 from the school_bus table, making sure to list each driver ID only once?

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


Question: Which driver IDs are both greater than 2 and also equal to 3?

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


Question: Can you give me a list of driver IDs less than or equal to 8, 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 <= 8 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 4


Question: Can you give me a list of driver IDs that are both greater than or equal to 8 and not equal to 10, 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 >= 8 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 10


Question: Can you give me the total of all city codes for students where the city code is ROC, or where the student is not male, the advisor is not 8721, the first name is not Tracy, the major is 50 or higher, or the last name is not Woods, or the age is 20 or younger, combined with the total of all city codes for students where the student ID is not 1034, the first name is not Michael, and the age is 19?

SELECT SUM(city_code) FROM Student WHERE city_code = "ROC" OR Sex <> "M" AND "Advisor" != 8721 AND Fname != "Tracy" AND "Major" >= 50 AND LName <> "Woods" OR "Age" <= 20 UNION ALL SELECT SUM(city_code) FROM Student WHERE "StuID" != 1034 AND Fname <> "Michael" AND "Age" = 19


Question: What is the highest Aircraft ID and corresponding ID from the aircraft and airport aircraft tables, matching on Aircraft ID?

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


Question: Could you give me a list of all Store IDs, including those from districts that aren't district 15 and those that sell products with a product ID of 6 or higher?

SELECT Store_ID FROM store_district WHERE "District_ID" <> 15 UNION ALL SELECT Store_ID FROM store_product WHERE "Product_ID" >= 6


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

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


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

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


Question: Can you give me the Club IDs that meet these two conditions: first, they either started in a year other than 2001 and have a Club ID other than 1, or they are located in the USA and are not named Helsingborgs IF; and second, they have at least 139 points in the match results?

SELECT Club_ID FROM club WHERE "Start_year" != 2001 AND "Club_ID" != 1 OR Region = "USA" AND Club_name != "Helsingborgs IF" INTERSECT SELECT Club_ID FROM match_result WHERE "Points" >= 139


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

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


Question: Can you give me a list of driver IDs from the driver table where the ID is 12 or less, combined with a list of driver IDs from the school_bus table where the ID is exactly 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 driver ID 11, and those from the school bus table excluding driver ID 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 give me the age, smallest head ID, name, and smallest born state for people named anyone other than Sergio García with a head ID greater than 1 who were born in Connecticut, but exclude anyone named anyone other than Franklin Langham or with a head ID greater than 4 who weren't born in California?

SELECT age, MIN(head_ID), name, MIN(born_state) FROM head WHERE name != "Sergio García" AND "head_ID" > 1 AND born_state = "Connecticut" EXCEPT SELECT age, MIN(head_ID), name, MIN(born_state) FROM head WHERE name != "Franklin Langham" OR "head_ID" > 4 AND born_state != "California"


Question: Which driver IDs, excluding driver ID 2, 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 are greater than or equal to 6, but not less than or equal to 10 and present in the school bus table?

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


Question: Can you give me a list of driver IDs that are not equal to 3 from the driver table, excluding any driver IDs greater than 10 that appear 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 > 10


Question: Which aircraft IDs, excluding ID 1, are present in the aircraft table and also present in the airport_aircraft table, excluding ID 5?

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


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

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


Question: Can you list the driver IDs that are less than 6 from the driver table, combined with the driver IDs that are greater than 3 from the school_bus table, removing any duplicates?

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: Which driver IDs are both not equal to 6 and also greater than or equal to 9?

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


Question: Can you list all the aircraft IDs, first from the aircraft table excluding ID 3, and then from the airport_aircraft table including only those less 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 give me the student IDs that are both in the club membership list (excluding members of club 4 and student 1001, or those who aren't presidents) and also meet certain student criteria (like having a major code of 600 or less and a student ID of 1029, or an advisor code greater than 8722 and a city code of YYZ, or being male, or being over 18 with a last name other than Goldman and a first name of David)?

SELECT StuID FROM Member_of_club WHERE "ClubID" != 4 AND "StuID" != 1001 OR Position != "President" INTERSECT SELECT StuID FROM Student WHERE "Major" <= 600 AND "StuID" = 1029 OR "Advisor" > 8722 AND city_code = "YYZ" OR Sex = "M" OR "Age" > 18 AND LName != "Goldman" AND Fname = "David"


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

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


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

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


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

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


Question: Can you list the aircraft IDs that are greater than 3, excluding those 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 > 3 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID != 1


Question: Can you find the smallest ID and corresponding company ID from the airport and flight information, but only for entries where the IATA code isn't "BLL", the date is January 29, 1964, or the altitude is 3650 or less, the ICAO code isn't "EBBR", the airport ID is greater than 2, and the airport name is "Billund Airport"?

SELECT MIN(T1.id), T2.company_id FROM airport as T1 JOIN flight as T2 ON T1.id = T2.id WHERE IATA <> "BLL" OR Date = "January 29, 1964" OR "Altitude" <= 3650.0 AND ICAO <> "EBBR" AND "airport_id" > 2 AND name = "Billund Airport"


Question: Can you list the aircraft IDs that are less than or equal to 2, excluding any aircraft IDs that are also equal to 3 in the airport aircraft list?

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


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

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


Question: How many books titled "The Dome: Ground Zero" were published, excluding those published in August 2008, and what are the prices of books where either the price is not 2,000,000 or the writer is not Garth Ennis, given that the average publication ID is greater than 5?

SELECT COUNT(T1.Book_ID), T2.Price FROM book as T1 JOIN publication as T2 ON T1.Book_ID = T2.Book_ID WHERE Title = "The Dome: Ground Zero" AND Publication_Date <> "August 2008" OR Price <> 2000000.0 AND Writer <> "Garth Ennis" AND AVG(Publication_ID) > 5


Question: Could you give me a list of employee names that meet these conditions: they either don't have an employee ID of 8 or aren't 30 years old, and their name isn't Phil Vickery, but exclude any names that also appear in a list of shop managers where the shop ID is greater than 4, the number of products isn't 4780, or the location isn't Turku and the manager's name isn't Job Dragtsma?

SELECT Name FROM employee WHERE "Employee_ID" != 8 OR "Age" != 30 AND Name <> "Phil Vickery" EXCEPT SELECT Name FROM shop WHERE "Shop_ID" > 4 OR "Number_products" <> 4780 OR Location != "Turku" AND Manager_name <> "Job Dragtsma"


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

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


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

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


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

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: Which driver IDs are both less than or equal to 3 and present in the driver table, and also less than or equal to 10 and present in the school_bus table?

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


Question: Can you give me a list of driver IDs, excluding driver ID 12, from the driver table, but then remove any driver IDs that are also driver ID 7 in the school bus table?

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


Question: How many products are there for each manager, excluding those managers who work at the FF Jaro shop in Jakobstad and have more than 10,000 products, considering only shops with at least 4780 products, or managers other than Mika Lehkosuo, or shops with an ID other than 1, or shops not in the Veritas Stadion district?

SELECT COUNT(Number_products), Manager_name FROM shop WHERE "Number_products" >= 4780 OR Manager_name != "Mika Lehkosuo" OR "Shop_ID" != 1 OR District <> "Veritas Stadion" EXCEPT SELECT COUNT(Number_products), Manager_name FROM shop WHERE Location = "Jakobstad" AND Name = "FF Jaro" AND "Number_products" > 10000


Question: Can you give me a list of driver IDs, including driver ID 4 from the driver table and any driver IDs greater than 7 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 > 7


Question: Can you give me a list of driver IDs, excluding driver ID 4, from the driver table, but only those driver IDs that are not also in the school bus table with driver IDs greater than 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 the lowest market value, lowest company ID, profits, and the number of companies in each industry, grouped by profits, excluding "Industrial and Commercial Bank of China" and including companies with a company ID greater than 9, assets greater than or equal to 302.6 billion, or in the Banking industry, only showing groups with at least one company or a minimum market value of at least 170.1 billion and a minimum company ID less than 15; then remove from that result the lowest market value, lowest company ID, profits, and the number of companies in each industry, grouped by profits, including companies with a market value less than or equal to 180 billion, or not named "General Electric", or in the Retailing industry with a company ID greater than 17, or with profits of 20.1 billion and sales greater than 447 billion, or assets greater than or equal to 319.4 billion, only showing groups with a minimum market value not equal to 154.8 billion?

SELECT MIN(Market_Value_in_Billion), MIN(Company_ID), Profits_in_Billion, COUNT(Industry) FROM company WHERE Name <> "Industrial and Commercial Bank of China" AND "Company_ID" > 9.0 OR "Assets_in_Billion" >= 302.6 OR Industry = "Banking" GROUP BY Profits_in_Billion HAVING COUNT(Industry) >= 1 OR MIN(Market_Value_in_Billion) >= 170.1 AND MIN(Company_ID) < 15.0 EXCEPT SELECT MIN(Market_Value_in_Billion), MIN(Company_ID), Profits_in_Billion, COUNT(Industry) FROM company WHERE "Market_Value_in_Billion" <= 180.0 OR Name <> "General Electric" OR Industry = "Retailing" AND "Company_ID" > 17.0 OR "Profits_in_Billion" = 20.1 AND "Sales_in_Billion" > 447.0 OR "Assets_in_Billion" >= 319.4 GROUP BY Profits_in_Billion HAVING MIN(Market_Value_in_Billion) <> 154.8


Question: What is the average aircraft ID and corresponding ID from the airport aircraft table, matching aircraft IDs between the aircraft and airport aircraft tables?

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


Question: Which driver has an ID of 9 and is also associated with a school bus having a driver ID of 3 or greater?

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: Can you give me a list of item IDs, including those where the title isn't "comb" and the ID is 3 or less, combined with those where the ID is 5 or more, or the title isn't "avocado"?

SELECT i_id FROM item WHERE title != "comb" AND "i_id" <= 3 UNION ALL SELECT i_id FROM item WHERE "i_id" >= 5 OR title <> "avocado"


Question: Can you give me a list of driver IDs, combining those from the driver table excluding ID 10, with those from the school bus table that are greater than 7?

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


Question: Can you give me a list of driver IDs from the driver table where each ID is less than or equal to 2, 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 <= 2 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 7


Question: Can you give me a list of driver IDs, including all driver IDs from the driver table that are greater than or equal to 1, combined with all driver IDs from the school bus table that are exactly 7?

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: What is the average album ID for albums where the ID is 74 and the title is not "Mozart Gala: Famous Arias", or the artist ID is greater than or equal to 22, combined with the average employee ID for employees where the fax number is not "+1 (403) 262-3322" and the ID is greater than 5, or the city is not "Edmonton", or the country is not "Canada", or the reports_to value is greater than 1?

SELECT AVG(id) FROM albums WHERE "id" = 74 AND title != "Mozart Gala: Famous Arias" OR "artist_id" >= 22 UNION SELECT AVG(id) FROM employees WHERE fax != "+1 (403) 262-3322" AND "id" > 5 OR city != "Edmonton" OR country != "Canada" OR "reports_to" > 1.0


Question: Can you give me a list of driver IDs, including driver ID 4 from the driver table and any driver IDs greater than or equal to 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: Can you give me a list of driver IDs that are greater than 6 and also not equal to 10, considering only the unique driver IDs from both the driver and school bus lists?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 6 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 from the driver table where the ID is less than or equal to 4, combined with a list of driver IDs from the school_bus table where the ID is greater than 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 employee IDs from Bristol who are not 36 years old and have an ID less than 4, or whose name isn't Matt Stevens, combined with a list of employee IDs from the hiring table that are less than or equal to 5, started in 2003, and are full-time?

SELECT Employee_ID FROM employee WHERE City = "Bristol" AND "Age" <> 36 AND "Employee_ID" < 4 OR Name <> "Matt Stevens" UNION SELECT Employee_ID FROM hiring WHERE "Employee_ID" <= 5 AND Start_from = "2003" AND Is_full_time = "T"


Question: What are the total passengers at each airport and the corresponding aircraft ID?

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


Question: Can you give me a list of aircraft names where the aircraft ID is less than 2, combined with a list of employee names who are not Robert Brown and have a salary greater than 212156?

SELECT name FROM aircraft WHERE "aid" < 2 UNION ALL SELECT name FROM employee WHERE name <> "Robert Brown" AND "salary" > 212156


Question: Can you give me a list of driver IDs, where each ID is greater than 8, but excluding any driver IDs that are also less than 4 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 < 4


Question: Can you give me a list of driver IDs, including those from the driver table excluding driver ID 4, and those from the school_bus table that only include driver ID 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 property type codes from the Properties table where any of these conditions are true: shp_feature_3 is not "None" and apt_feature_3 is not "None", or property_id is not 10, or property_type_code is not "Apartment", or fld_feature_1 is "None" and date_on_market is not "1981-08-23 05:40:38" and hse_feature_1 is not "None", or oth_feature_3 is not "None" and apt_feature_1 is not "qui" and shp_feature_1 is "None", or fld_feature_2 is not "None", or property_address is not "1474 Dibbert Fields Suite 055 South Renee, IN 58286-3097", or hse_feature_2 is not "None", or other_property_details is not "None" and apt_feature_2 is not "est", or date_sold is "1979-05-13 16:58:06", or shp_feature_2 is not "None" and hse_feature_3 is "None" and fld_feature_3 is not "None", and also include the property type code "Shop" from the Ref_Property_Types table?

SELECT property_type_code FROM Properties WHERE shp_feature_3 != "None" AND apt_feature_3 <> "None" OR "property_id" != 10 OR property_type_code <> "Apartment" OR fld_feature_1 = "None" AND date_on_market != "1981-08-23 05:40:38" AND hse_feature_1 <> "None" OR oth_feature_3 <> "None" AND apt_feature_1 <> "qui" AND shp_feature_1 = "None" OR fld_feature_2 <> "None" OR property_address != "1474 Dibbert Fields Suite 055 South Renee, IN 58286-3097" OR hse_feature_2 != "None" OR other_property_details <> "None" AND apt_feature_2 <> "est" OR date_sold = "1979-05-13 16:58:06" OR shp_feature_2 <> "None" AND hse_feature_3 = "None" AND fld_feature_3 != "None" UNION SELECT property_type_code FROM Ref_Property_Types WHERE property_type_code = "Shop"


Question: Can you give me a list of driver IDs that are equal to 9, considering both the driver and school bus records?

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


Question: Can you give me a list of staff IDs from lessons where the lesson ID is greater than 2, the vehicle ID is greater than or equal to 2, or the lesson status is not cancelled, combined with a list of staff IDs from the staff table where the date they left is not 2018-03-08 04:23:14, their staff address ID is 2 and their last name isn't Jast and their date of birth isn't 2015-08-01 13:22:43 and their staff ID isn't 10 and their join date is 2016-05-16 20:56:53, or their nickname isn't santos45, or their middle name is Maiya, or their first name isn't Ernestina?

SELECT staff_id FROM Lessons WHERE "lesson_id" > 2 OR "vehicle_id" >= 2 OR lesson_status_code != "Cancelled" UNION ALL SELECT staff_id FROM Staff WHERE date_left_staff != "2018-03-08 04:23:14" OR "staff_address_id" = 2 AND last_name <> "Jast" AND date_of_birth <> "2015-08-01 13:22:43" AND "staff_id" <> 10 AND date_joined_staff = "2016-05-16 20:56:53" OR nickname != "santos45" OR middle_name = "Maiya" OR first_name != "Ernestina"


Question: Can you give me a list of driver IDs that are greater than 9 from the driver table, combined with a list of driver IDs that are greater than 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 appear in the aircraft table, excluding aircraft ID 3, but only if they are not also aircraft IDs in the airport_aircraft table that are greater than 3?

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


Question: Can you give me a list of driver IDs, combining those from the driver table excluding ID 10 with those from the school bus table that are less than 4, removing any duplicates?

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


Question: Can you list all the source user IDs from the trust table where the trust value is at least 4 and the target user ID is at least 2, and also include all source user IDs from the trust table where the source user ID is at least 1?

SELECT source_u_id FROM trust WHERE "trust" >= 4 AND "target_u_id" >= 2 UNION ALL SELECT source_u_id FROM trust WHERE "source_u_id" >= 1


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

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


Question: Can you list the feature ID, description, and type for all amenities, and also include any features with an ID less than 3, or that are amenities, or are described as a "Burglar Alarm" but are not named "AirCon"?

SELECT feature_id, feature_description, feature_type_code FROM Other_Available_Features WHERE feature_type_code = "Amenity" UNION SELECT feature_id, feature_description, feature_type_code FROM Other_Available_Features WHERE "feature_id" < 3 OR feature_type_code = "Amenity" OR feature_description = "Burglar Alarm" AND feature_name != "AirCon"


Question: Can you give me a list of aircraft IDs, excluding aircraft ID 4, that are in the aircraft table but not in the airport_aircraft table, where aircraft ID 3 is also excluded from the airport_aircraft table?

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


Question: Can you give me a list of driver IDs, combining those from the driver table excluding driver ID 11, with 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: Could you list the creation date, budget in billions, number of employees, and name for departments that either have a ranking of 5, a department ID less than 9, a number of employees not equal to 67000, or were created in 1789, but only if they also have a department ID greater than or equal to 10?

SELECT Creation, Budget_in_Billions, Num_Employees, Name FROM department WHERE "Ranking" = 5 OR "Department_ID" < 9 OR "Num_Employees" != 67000.0 OR Creation = "1789" INTERSECT SELECT Creation, Budget_in_Billions, Num_Employees, Name FROM department WHERE "Department_ID" >= 10


Question: Can you list the aircraft IDs that are not equal to 2, excluding those 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 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <> 1


Question: Can you give me a list of driver IDs, including those from the driver table that are less than or equal to 12, and 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: Can you give me a list of Branch IDs for branches named "Popert" that are not in London on Abbey Rise, or have a Branch ID of 8 or higher, combined with the Branch ID "6" from the membership register?

SELECT Branch_ID FROM branch WHERE City <> "London" AND Address_road <> "Abbey Rise" AND Name = "Popert" OR "Branch_ID" >= 8 UNION SELECT Branch_ID FROM membership_register_branch WHERE Branch_ID = "6"


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

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


Question: What is the smallest aircraft ID associated with each airport ID, excluding airport ID 9?

SELECT MIN(T1.Aircraft_ID), T2.Airport_ID FROM aircraft as T1 JOIN airport_aircraft as T2 ON T1.Aircraft_ID = T2.Aircraft_ID WHERE Airport_ID <> 9


Question: Which aircraft IDs are both less than or equal to 5 when considering only aircraft and less than 5 when considering only airport aircraft?

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


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

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


Question: Which driver IDs are equal to 1 in the driver table, but not equal to 10 in the school_bus table?

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


Question: Can you give me a list of driver IDs, including those from the driver table where the ID is not 1, and those from the school bus table where the ID is less than 3, making sure to avoid any duplicates?

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


Question: Can you list the aircraft IDs that are equal to 4 from the aircraft table, and also list the aircraft IDs that are less than 1 from the airport_aircraft table?

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


Question: Can you give me a list of driver IDs, excluding driver ID 10, 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 != 10 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 from the driver table where each ID is less than or equal to 8, combined with a list of driver IDs from the school_bus table where each ID is less than or equal to 4?

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


Question: Can you give me the driver ID that appears exactly once as driver ID 8 in the driver table but not in the school bus table where the driver ID is greater 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 where the ID is 1 or greater, and those from the school bus table where the ID is less than 10?

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


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


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

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


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

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


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

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


Question: What is the largest template ID that appears both in documents that are not customer reviews and in templates that either expired on a date other than May 12, 1998, are of type BK, have empty details, have a version number greater than 5, started being effective on February 20, 2005, or have an ID of 19?

SELECT MAX(Template_ID) FROM Documents WHERE Document_Name <> "Customer reviews" INTERSECT SELECT MAX(Template_ID) FROM Templates WHERE Date_Effective_To <> "1998-05-12 12:51:29" OR Template_Type_Code = "BK" OR Template_Details = "" OR "Version_Number" > 5 OR Date_Effective_From = "2005-02-20 00:31:34" OR "Template_ID" = 19


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

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


Question: Can you give me the IDs of drivers, up to ID 4, who are drivers but not school bus drivers with IDs less than 7?

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


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

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


Question: Can you give me a list of driver IDs, excluding driver ID 1 from the driver table and driver ID 3 from the school_bus table, showing each distinct driver ID from both tables?

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


Question: Can you give me the zip codes from the county table where the county ID is less than or equal to 5, or the zip code is not "D21" and the population is less than or equal to 13300, or the county name is not "Mansfield" and is also a zip code that's not "D09"?

SELECT Zip_code FROM county WHERE "County_Id" <= 5 OR Zip_code != "D21" AND "Population" <= 13300.0 OR County_name <> "Mansfield" IN (SELECT Zip_code FROM county WHERE Zip_code != "D09")


Question: Can you give me the store name, type, number of product categories, area size, and store ID for stores that meet these two sets of criteria: first, stores that aren't village stores, have a store ID of 1 or less, and aren't named Miramichi, or have at least 990 product categories and a ranking that isn't 10; and second, stores with a store ID of 2 or greater, or an area size of 179.84, or that aren't village stores with a ranking greater than 1 and aren't named Blackville, or have less than 990 product categories?

SELECT Store_Name, Type, Number_of_product_category, Area_size, Store_ID FROM store WHERE Type != "Village Store" AND "Store_ID" <= 1 AND Store_Name <> "Miramichi" OR "Number_of_product_category" >= 990.0 AND "Ranking" != 10 INTERSECT SELECT Store_Name, Type, Number_of_product_category, Area_size, Store_ID FROM store WHERE "Store_ID" >= 2 OR "Area_size" = 179.84 OR Type != "Village Store" AND "Ranking" > 1 AND Store_Name != "Blackville" OR "Number_of_product_category" < 990.0


Question: Can you give me the Store ID and Product ID combinations that are both either from store 1 or not product 2, and also have a product ID of 6 or higher?

SELECT Store_ID, Product_ID FROM store_product WHERE "Store_ID" = 1 OR "Product_ID" != 2 INTERSECT SELECT Store_ID, Product_ID FROM store_product WHERE "Product_ID" >= 6


Question: Can you give me a list of driver IDs, including those from the driver table that are greater than or equal to 3, and those from the school bus table that are exactly 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: Which driver has an ID of 4 and also drives a school bus, but not school bus number 9?

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


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

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: Which driver IDs are both greater than or equal to 6 and present in the driver table, and also less than 9 and present in the school_bus table?

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


Question: Can you list the coach's name, ID, gender, rank, and club ID for all coaches with an ID of 2 or less, combined with the same information for coaches who are male and have a club ID of 1 or less, or have a rank of 5 or more and are not named Jameson Tomas?

SELECT Coach_name, Coach_ID, Gender, Rank, Club_ID FROM coach WHERE "Coach_ID" <= 2 UNION SELECT Coach_name, Coach_ID, Gender, Rank, Club_ID FROM coach WHERE "Club_ID" <= 1 AND Gender = "M" OR "Rank" >= 5 AND Coach_name <> "Jameson Tomas"


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

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


Question: Can you give me the Aircraft IDs that are greater than 2 when grouped in the aircraft table, but also not equal to 1 when grouped in the airport_aircraft table?

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


Question: Could you please provide the document type code, shipping agent code, document status code, and receipt date from the Documents table, combining results from two sets of criteria: first, where the document ID is 10, the document type is not "Hard Drive", the receipt date is not "1986-12-14 14:18:59", the other details are "u", and the document status is "done", or the shipping agent code is not "FE", or the receipt number is "79"; and second, where the other details are not "h" or the document type is "Paper"?

Hard Drive
AL
overdue
1985-11-05 17:59:34

Hard Drive
FE
working
1999-04-17 14:19:32

Hard Drive
FE
working
2005-09-30 00:10:02

Hard Drive
US
overdue
1996-05-31 06:51:58

SELECT document_type_code, shipping_agent_code, document_status_code, receipt_date FROM Documents WHERE "document_id" = 10 AND document_type_code != "Hard Drive" AND receipt_date <> "1986-12-14 14:18:59" AND other_details = "u" AND document_status_code = "done" OR shipping_agent_code != "FE" OR receipt_number = "79" UNION SELECT document_type_code, shipping_agent_code, document_status_code, receipt_date FROM Documents WHERE other_details != "h" OR document_type_code = "Paper"


Question: Can you give me a list of driver IDs, excluding driver ID 5, from the driver table, but then remove any driver IDs from that list that are also in the school bus table, excluding driver ID 3?

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


Question: Can you give me a list of driver IDs, greater than 7, that appear in the driver table but not in the school_bus table where the driver ID is 3?

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: Which driver IDs are both not equal to 8 and also less than 4?

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 a list of driver IDs that are both not equal to 4 and also greater than or equal to 7, considering only unique driver IDs from the driver and school_bus tables?

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 list the driver IDs that are greater than 3 from the driver table, combined with the driver IDs that are less than or equal to 10 from the school bus table, removing any duplicates?

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


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

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


Question: Which aircraft have an ID of 2 or greater, excluding those aircraft that are also associated with airports and have an ID not equal to 2?

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


Question: Could you give me the template type codes and descriptions that satisfy both of the following conditions: first, the description is not "CV" or the code is "BK", and second, the code is "CV" or the description is not "Advertisement"?

SELECT Template_Type_Code, Template_Type_Description FROM Ref_Template_Types WHERE Template_Type_Description != "CV" OR Template_Type_Code = "BK" INTERSECT SELECT Template_Type_Code, Template_Type_Description FROM Ref_Template_Types WHERE Template_Type_Code = "CV" OR Template_Type_Description != "Advertisement"


Question: Can you give me a list of driver IDs from the driver table where the ID is 8 or higher, combined with a list of driver IDs from the school_bus table where the ID is 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: Could you give me a list of album IDs for albums by artists with an artist ID of 245 or higher, combined with a list of playlist IDs for playlists that aren't named "90’s Music"?

SELECT id FROM albums WHERE "artist_id" >= 245 UNION ALL SELECT id FROM playlists WHERE name <> "90’s Music"


Question: Can you give me a list of driver IDs that are greater than 8, excluding those driver IDs that are also greater than 3 and associated with a school bus?

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 6 or greater, and those from the school bus table that are greater than 10?

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


Question: Can you give me a list of customer IDs from the customer payments table, excluding customer ID 12, combined with a list of customer IDs from the lessons table where either the staff ID is not 4 and the price is no more than 295, or the lesson time is 6 and the lesson date is not March 7th, 2018 at 4:12 PM, or the lesson ID is not 14?

SELECT customer_id FROM Customer_Payments WHERE "customer_id" != 12 UNION ALL SELECT customer_id FROM Lessons WHERE "staff_id" <> 4 AND "price" <= 295.0 OR lesson_time = "6" AND lesson_date != "2018-03-07 16:12:36" OR "lesson_id" != 14


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


Question: Can you list all the aircraft IDs from both the aircraft and airport_aircraft tables, excluding aircraft ID 2, and making sure to list each unique aircraft ID only once?

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


Question: Can you give me a list of user IDs from the user accounts table, including those named Nancy or with a user ID greater than 4, and also those with a user ID of 6 or higher or named Rosie?

SELECT u_id FROM useracct WHERE name = "Nancy" OR "u_id" > 4 UNION ALL SELECT u_id FROM useracct WHERE "u_id" >= 6 OR name = "Rosie"


Question: Can you list all the driver IDs from the driver table that are less than 8, and combine that with a list of all driver IDs from the school bus table that are less than 7?

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


Question: Can you give me the birth dates of customers who either don't have the cell phone number (630)964-2426 and have a customer address ID less than 13, or don't have the email karina.carroll@example.net, or don't have the phone number 206-054-0689x05861, aren't named Omer, and have an amount outstanding of at least 3751, or don't have a customer status of 'Bad Customer', or have a customer ID of 5 or less and are named Ortiz, or don't have the birth date 1991-02-10 00:42:17, along with the birth dates of staff members who either don't have the birth date 2003-01-16 06:29:11, aren't named Turner, and don't have the nickname 'ymiller', or joined on 2016-05-16 20:56:53, aren't named Tre, have a staff address ID greater than 2, and have a staff ID of 4 or less, or left on 2018-03-14 07:14:37?

SELECT date_of_birth FROM Customers WHERE cell_mobile_phone_number <> "(630)964-2426" AND "customer_address_id" < 13 OR email_address <> "karina.carroll@example.net" OR phone_number <> "206-054-0689x05861" AND first_name <> "Omer" AND "amount_outstanding" >= 3751.0 OR customer_status_code <> "Bad Customer" OR "customer_id" <= 5 AND last_name = "Ortiz" OR date_of_birth != "1991-02-10 00:42:17" UNION ALL SELECT date_of_birth FROM Staff WHERE date_of_birth <> "2003-01-16 06:29:11" AND last_name <> "Turner" AND nickname != "ymiller" OR date_joined_staff = "2016-05-16 20:56:53" AND middle_name <> "Tre" AND "staff_address_id" > 2 AND "staff_id" <= 4 OR date_left_staff = "2018-03-14 07:14:37"


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

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


Question: Which driver IDs, excluding driver ID 5, are not also driver ID 7 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 = 7


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

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


Question: Could you list the feature type codes that are both from available features with the name "AirCon" where the feature type is not "Security" or the feature ID is greater than 3, and from reference feature types where the name is not "Amenity, eg Pool." or the feature type code is "Security"?

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


Question: Can you give me the school name, average mascot value, location, number of enrollments, and county for schools, excluding those that are not in class AAA, don't have 379 enrollments, are not in football class AAA, are in Lakeville, or are not named LaVille, or have the mascot Falcons, but including only those schools that are not in County 50 Marshall, or have the mascot Trojans, or don't have the school ID 6, or are not in football class AAA?

School_name AVG(Mascot) Location COUNT(Enrollment) County

SELECT School_name, AVG(Mascot), Location, COUNT(Enrollment), County FROM School WHERE County != "50 Marshall" OR Mascot = "Trojans" OR School_id <> "6" OR IHSAA_Football_Class != "AAA" EXCEPT SELECT School_name, AVG(Mascot), Location, COUNT(Enrollment), County FROM School WHERE IHSAA_Class != "AAA" AND "Enrollment" <> 379 AND IHSAA_Football_Class != "AAA" AND Location = "Lakeville" AND School_name != "LaVille" OR Mascot = "Falcons"


Question: Can you give me a list of driver IDs, including those that are not 10 from the driver table, and also those that are exactly 9 from the school_bus table?

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


Question: Can you list the aircraft IDs that are less than 1 from the aircraft table, and also list the aircraft IDs that are less than or equal to 2 from the airport_aircraft table, combining the two lists?

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


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

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


Question: Can you give me all the dates staff left, considering staff who either have a staff address ID of 7 or less, or a nickname other than norma73, or a last name other than Rogahn, or a first name other than Ernestina who left on 2018-03-04 17:13:53 and have a staff ID of 12, or joined on 2017-10-21 17:20:57, were born on 2010-12-08 16:55:14, and have a middle name of Ulices, along with staff who have a first name other than Winnifred and left on 2018-03-01 17:10:03, or have a staff ID of 15 or less, or a middle name other than Mayra, or were not born on 2000-06-13 18:09:11 and have a last name other than Turner, or have a staff address ID other than 3, or a nickname other than bkunze, or did not join on 2017-04-27 03:21:26?

SELECT date_left_staff FROM Staff WHERE "staff_address_id" <= 7 OR nickname != "norma73" OR last_name <> "Rogahn" OR first_name <> "Ernestina" AND date_left_staff = "2018-03-04 17:13:53" AND "staff_id" = 12 OR date_joined_staff = "2017-10-21 17:20:57" AND date_of_birth = "2010-12-08 16:55:14" AND middle_name = "Ulices" UNION SELECT date_left_staff FROM Staff WHERE first_name <> "Winnifred" AND date_left_staff = "2018-03-01 17:10:03" OR "staff_id" <= 15 OR middle_name <> "Mayra" OR date_of_birth != "2000-06-13 18:09:11" AND last_name != "Turner" OR "staff_address_id" != 3 OR nickname <> "bkunze" OR date_joined_staff != "2017-04-27 03:21:26"


Question: Can you give me a list of driver IDs, combining those from the driver table excluding ID 7, and those from the school_bus table excluding ID 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: What is the total customer ID for payments of $5475.26, combined with the total customer ID for lessons where the customer ID is 3 or greater and the lesson date is not March 16, 2018 at 7:08:52 AM, and the vehicle ID is 1 or greater and the lesson status is not cancelled, or the lesson ID is less than 7 and the staff ID is less than 1?

SELECT SUM(customer_id) FROM Customer_Payments WHERE "amount_payment" = 5475.26 UNION SELECT SUM(customer_id) FROM Lessons WHERE "customer_id" >= 3 AND lesson_date != "2018-03-16 07:08:52" AND "vehicle_id" >= 1 AND lesson_status_code != "Cancelled" OR "lesson_id" < 7 AND "staff_id" < 1


Question: Can you show me the rank, club ID, bronze, big silver, gold, points, and small silver for all match results where either gold is at least 13, small silver is greater than 4, big silver is less than 12, bronze is at least 9, and the club ID is not 6, or where the points are exactly 102; and also show me the rank, club ID, bronze, big silver, gold, points, and small silver for all match results where bronze is not 6 and the club ID is not 2, or small silver is at most 4, or gold is at most 12, the rank is less than 1, big silver is greater than 14, or the points are at least 84?

SELECT Rank, Club_ID, Bronze, Big_Silver, Gold, Points, Small_Silver FROM match_result WHERE "Gold" >= 13 AND "Small_Silver" > 4 AND "Big_Silver" < 12 AND "Bronze" >= 9 AND "Club_ID" <> 6 OR "Points" = 102 UNION ALL SELECT Rank, Club_ID, Bronze, Big_Silver, Gold, Points, Small_Silver FROM match_result WHERE "Bronze" != 6 AND "Club_ID" != 2 OR "Small_Silver" <= 4 OR "Gold" <= 12 AND "Rank" < 1 AND "Big_Silver" > 14 OR "Points" >= 84


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

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


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

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


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

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 the average group equity shareholding, type, principal activities, name, average ID, and incorporation location for companies, combining two sets of results: first, companies not incorporated in China, or whose principal activity is cargo airline, or are not joint ventures, or are not named CLS Catering Services Limited, or have an ID greater than or equal to 1 and group equity shareholding less than 18.77; and second, companies that are joint ventures, with group equity shareholding not equal to 100.0, and not incorporated in Hong Kong, or are named Vogue Laundry Service Limited?

74.4835714286
Corporate
Airline
Air China
7.5
China

52.8
Joint Venture
Cargo airline
Air China Cargo
10.4
China

SELECT AVG(Group_Equity_Shareholding), Type, Principal_activities, name, AVG(id), Incorporated_in FROM operate_company WHERE Incorporated_in != "China" OR Principal_activities = "Cargo airline" OR Type <> "Joint Venture" OR name != "CLS Catering Services Limited" OR "id" >= 1 AND "Group_Equity_Shareholding" < 18.77 UNION ALL SELECT AVG(Group_Equity_Shareholding), Type, Principal_activities, name, AVG(id), Incorporated_in FROM operate_company WHERE Type = "Joint Venture" AND "Group_Equity_Shareholding" != 100.0 AND Incorporated_in <> "Hong Kong" OR name = "Vogue Laundry Service Limited"


Question: What are the total copy numbers and document IDs from the circulation history for employees with IDs greater than 2, combined with the total copy numbers and document IDs from draft copies where the document ID is not 23, the draft number is less than 9, or the copy number is less than 10?

SELECT SUM(copy_number), document_id FROM Circulation_History WHERE "employee_id" > 2 UNION SELECT SUM(copy_number), document_id FROM Draft_Copies WHERE "document_id" <> 23 OR "draft_number" < 9 OR "copy_number" < 10


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

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


Question: Can you give me the IDs of drivers that are less than 4, and also greater than or equal to 3, considering only unique driver IDs from both the driver and school bus tables?

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: Can you list the driver IDs that appear in the driver table, excluding driver ID 4, but only include those that do not appear in the school bus table with driver IDs less than 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 list all the continents from the continents table, excluding Asia or where the Continent ID is 5 or greater, and also list all the continents from the countries table, but only for countries that aren't Germany and have a Country ID greater than 6?

SELECT Continent FROM continents WHERE Continent <> "asia" OR "ContId" >= 5 UNION ALL SELECT Continent FROM countries WHERE CountryName != "germany" AND "CountryId" > 6


Question: Can you give me a list of aircraft IDs and their distances, excluding aircraft ID 10, combined with a list of aircraft IDs and distances from flights that are not flight number 33 and either don't arrive on "04/12/2005 12:02" or have a distance that isn't 2551?

SELECT aid, distance FROM aircraft WHERE "aid" <> 10 UNION SELECT aid, distance FROM flight WHERE "flno" != 33 AND arrival_date != "04/12/2005 12:02" OR "distance" <> 2551


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

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


Question: Can you give me a list of driver IDs, excluding driver ID 7, that appear in the driver table but not in the school_bus table for driver IDs less than 7?

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 IDs of documents that are in both the draft documents list with draft details not equal to "b", and in the documents list where the document type is not "Hard Drive", the shipping agent is not "FE", and the document status is not "overdue", or where other details are "z" and the receipt date is not "2014-12-25 17:22:44"?

SELECT document_id FROM Document_Drafts WHERE draft_details <> "b" INTERSECT SELECT document_id FROM Documents WHERE document_type_code <> "Hard Drive" AND shipping_agent_code != "FE" AND document_status_code != "overdue" OR other_details = "z" AND receipt_date <> "2014-12-25 17:22:44"


Question: Can you give me the Election ID, Counties Represented, First Elected year, Delegate, Party, and District for all elections, excluding those where the Delegate is James E. Malone Jr. and the Party isn't 1 and the Committee isn't Ways and Means, or the District isn't 3, or the Election ID isn't 3 and the Counties Represented isn't 13, but including those where the First Elected year is 2006 or the Committee isn't Health and Government Operations and the Delegate isn't Shane E. Pendergrass, or the Party isn't 1, or the District is at least 2?

SELECT Election_ID, Counties_Represented, First_Elected, Delegate, Party, District FROM election WHERE "First_Elected" = 2006.0 OR Committee <> "Health and Government Operations" AND Delegate != "Pendergrass, Shane E. Shane Pendergrass" OR "Party" <> 1 OR "District" >= 2 EXCEPT SELECT Election_ID, Counties_Represented, First_Elected, Delegate, Party, District FROM election WHERE Delegate = "Malone, James E. Jr. James E. Malone, Jr." AND "Party" <> 1 AND Committee != "Ways and Means" OR "District" <> 3 OR "Election_ID" <> 3 AND Counties_Represented <> "13"


Question: Could you list the arrival date, airline ID, flight number, distance, origin, destination, price, and departure date for all flights where the distance is not 7487, and also include flights where the distance is at least 2308 and the arrival date is December 4th, 2005 at 12:02 PM and the flight number is 99 or less, or the departure date is December 4th, 2005 at 9:30 AM, or the destination is Tokyo?

arrival_date aid flno distance origin destination price departure_date

SELECT arrival_date, aid, flno, distance, origin, destination, price, departure_date FROM flight WHERE "distance" != 7487 UNION ALL SELECT arrival_date, aid, flno, distance, origin, destination, price, departure_date FROM flight WHERE "distance" >= 2308 AND arrival_date = "04/12/2005 12:02" AND "flno" <= 99 OR departure_date = "04/12/2005 09:30" OR destination = "Tokyo"


Question: Can you give me a list of store IDs that either aren't store ID 3 or aren't in district 11, combined with a list of store IDs that have a product ID greater than 4 or a store ID greater than 3?

SELECT Store_ID FROM store_district WHERE "Store_ID" != 3 OR "District_ID" != 11 UNION SELECT Store_ID FROM store_product WHERE "Product_ID" > 4 OR "Store_ID" > 3


Question: Can you give me a list of employee IDs, including those of employees who either don't live in Bristol and are 29 years old, or those from the hiring table who work at a shop with an ID less than 1, are full-time, started in 2010, or have an employee ID of 7?

SELECT Employee_ID FROM employee WHERE City <> "Bristol" AND "Age" = 29 UNION SELECT Employee_ID FROM hiring WHERE "Shop_ID" < 1 OR Is_full_time = "T" OR Start_from = "2010" OR "Employee_ID" = 7


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

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


Question: Can you list all aircraft IDs from the aircraft table that are greater than 3, and combine that with a list of all aircraft IDs from the airport_aircraft table that are greater than 2?

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


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

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


Question: What is the difference between the total People IDs of people named Sergey Grankin, or whose People ID is not 4, or who are not Russian, or whose height is not more than 187 and were not born on August 16, 1982, and the total People IDs of poker players who have made fewer than or equal to 42 final tables, or whose best finish is less than 2, and whose Poker Player ID is 5, People ID is less than 1, and earnings are less than 476090?

SELECT SUM(People_ID) FROM people WHERE Name = "Sergey Grankin" OR "People_ID" <> 4 OR Nationality <> "Russia" OR "Height" <= 187.0 AND Birth_Date != "August 16, 1982" EXCEPT SELECT SUM(People_ID) FROM poker_player WHERE "Final_Table_Made" <= 42.0 OR "Best_Finish" < 2.0 AND "Poker_Player_ID" = 5 AND "People_ID" < 1 AND "Earnings" < 476090.0


Question: Can you give me the Party IDs and years that appear in both of these scenarios: first, when the year is after 1998, or the party isn't Working Families, the governor isn't Eliot Spitzer, there's no US Senate election, the comptroller isn't Carl McCall, the lieutenant governor is Dennis Mehiel, or the attorney general is Eliot Spitzer and the Party ID isn't 3; and second, when the attorney general is Andrew Cuomo, or there is a US Senate election and the party isn't Working Families and the lieutenant governor isn't David Paterson and the Party ID is greater than 7, or the year is after 2002, or the comptroller isn't Carl McCall?

SELECT Party_ID, Year FROM party WHERE "Year" > 1998.0 OR Party != "Working Families" AND Governor != "Eliot Spitzer" AND US_Senate = "(no election)" AND Comptroller <> "Carl McCall" OR Lieutenant_Governor = "Dennis Mehiel" OR Attorney_General = "Eliot Spitzer" AND "Party_ID" <> 3 INTERSECT SELECT Party_ID, Year FROM party WHERE Attorney_General = "Andrew Cuomo" OR US_Senate != "(no election)" AND Party != "Working Families" AND Lieutenant_Governor <> "David Paterson" AND "Party_ID" > 7 OR "Year" > 2002.0 OR Comptroller <> "Carl McCall"


Question: Could you list the document ID, status code, receipt date, type code, other details, and shipping agent code for all documents that either aren't of type "Paper" and have a document ID less than or equal to 1, or have other details that aren't "x", a status code that isn't "done", and a receipt date that isn't "2017-07-02 17:39:09", combined with all documents that are "overdue" or have a document ID greater than or equal to 4, or have a receipt date that isn't "1999-04-17 14:19:32"?

SELECT document_id, document_status_code, receipt_date, document_type_code, other_details, shipping_agent_code FROM Documents WHERE document_type_code <> "Paper" AND "document_id" <= 1 OR other_details <> "x" AND document_status_code != "done" AND receipt_date != "2017-07-02 17:39:09" UNION SELECT document_id, document_status_code, receipt_date, document_type_code, other_details, shipping_agent_code FROM Documents WHERE document_status_code = "overdue" OR "document_id" >= 4 OR receipt_date != "1999-04-17 14:19:32"


Question: Can you give me a list of driver IDs from the driver table that are greater than or equal to 2, excluding any driver IDs that are equal to 10 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: Can you list the aircraft IDs that appear at least twice in the aircraft table, along with the aircraft IDs that appear more than five times in the airport_aircraft table?

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


Question: Can you list the aircraft IDs that are less than 3 from the aircraft table, and also include the aircraft ID 2 from the airport_aircraft table?

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


Question: Can you give me a list of driver IDs that are less than 11, and combine that with a list of driver IDs from the school bus table that are greater 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 driver IDs are both greater than or equal to 5 in the driver table and greater than or equal to 7 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 >= 7


Question: Can you give me the IDs of drivers who are both: either 37 years old and from East Hartford, or have an ID of 8, a name other than Douglas McCrory, and are not affiliated with the Rep party; and also either work at a school with an ID less than 3, or are not full-time, have an ID other than 7, and have worked for 6 years?

SELECT Driver_ID FROM driver WHERE "Age" = 37 AND Home_city = "East Hartford" OR "Driver_ID" = 8 AND Name != "Douglas McCrory" AND Party <> "Rep" INTERSECT SELECT Driver_ID FROM school_bus WHERE "School_ID" < 3 OR If_full_time <> "T" AND "Driver_ID" != 7 AND "Years_Working" = 6


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 5 EXCEPT 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 2 and also less than or equal to 7, considering only the unique driver IDs from the driver and school_bus tables?

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


Question: Can you list the aircraft IDs that are greater than 2 when grouped in the aircraft table, and also list aircraft IDs that are greater than or equal to 2 when grouped in the airport_aircraft table, combining the results into a single list?

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


Question: Can you give me a list of driver IDs less than 10 from the driver table, excluding any 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 < 10 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 3


Question: What is the total number of counties represented by members of the "Environmental Matters" committee elected in 1994 or later with an Election ID of 7 or greater, combined with the total number of counties represented by all members who either are not from District 3 and are not Delegate "Guzzone, Guy Guy Guzzone", or have an Election ID of 3 or less, or are not from Party 1, or are not on the "Economic Matters" committee, or do not represent "12.2 12B" counties, or were first elected after 1994?

SELECT SUM(Counties_Represented) FROM election WHERE Committee = "Environmental Matters" AND "Election_ID" >= 7 AND "First_Elected" >= 1994.0 UNION ALL SELECT SUM(Counties_Represented) FROM election WHERE "District" <> 3 AND Delegate <> "Guzzone, Guy Guy Guzzone" OR "Election_ID" <= 3 OR "Party" != 1 OR Committee != "Economic Matters" OR Counties_Represented <> "12.2 12B" OR "First_Elected" > 1994.0


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

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


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

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


Question: How many aircraft have an ID of 7 or greater and are not Boeing 727s, and how many employees have an ID greater than 486512566 and are not named Milo Brooks?

SELECT COUNT(name) FROM aircraft WHERE "aid" >= 7 AND name != "Boeing 727" UNION ALL SELECT COUNT(name) FROM employee WHERE "eid" > 486512566 AND name <> "Milo Brooks"


Question: Can you list all the property feature descriptions where the feature ID is not 3 and the property ID is at least 6, or the description is "cumque", and also include all descriptions where the description is "doloribus" or the feature ID is not 2?

SELECT property_feature_description FROM Other_Property_Features WHERE "feature_id" != 3 AND "property_id" >= 6 OR property_feature_description = "cumque" UNION ALL SELECT property_feature_description FROM Other_Property_Features WHERE property_feature_description = "doloribus" OR "feature_id" <> 2


Question: Can you give me a list of album IDs for albums titled "Strauss: Waltzes" or with an ID greater than 30, combined with a list of genre IDs that are not "Easy Listening"?

SELECT id FROM albums WHERE title = "Strauss: Waltzes" OR "id" > 30 UNION ALL SELECT id FROM genres WHERE name <> "Easy Listening"


Question: Can you give me a list of driver IDs that are both less than or equal to 9 and 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: 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 greater than 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: Can you list the aircraft IDs that are less than 3 when grouped, excluding those aircraft IDs from a separate list of airport aircraft that are greater than or equal to 2 when grouped?

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


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

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


Question: Can you show me the School ID, total budget percent invested, budget invested percent, total budget percent budgeted, invested amount, and budgeted amount from the budget table for entries where either the total budget percent budgeted is at least 2.0, or the invested amount is not 146102 and the School ID is 1, or the budgeted amount is no more than 4979, the year is 2006, and the budget invested percent is not 228.8, combined with entries where either the budgeted amount is at least 3666, or the School ID is no more than 3, or the total budget percent budgeted is not 1.3, the total budget percent invested is at least 2.7, and the invested amount is no more than 2134?

SELECT School_id, total_budget_percent_invested, Budget_invested_percent, total_budget_percent_budgeted, Invested, Budgeted FROM budget WHERE "total_budget_percent_budgeted" >= 2.0 OR "Invested" != 146102 AND "School_id" = 1 OR "Budgeted" <= 4979 AND "Year" = 2006 AND Budget_invested_percent != "228.8" UNION ALL SELECT School_id, total_budget_percent_invested, Budget_invested_percent, total_budget_percent_budgeted, Invested, Budgeted FROM budget WHERE "Budgeted" >= 3666 OR "School_id" <= 3 OR "total_budget_percent_budgeted" != 1.3 AND "total_budget_percent_invested" >= 2.7 AND "Invested" <= 2134


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

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


Question: Can you give me the school IDs for schools with ID 7 that are not in New Carlisle and not in Elkhart County, along with the school IDs from the endowment table where the donator is "Com. Dom. En Estados Unidos" or the "School_id" is greater than 7 or where "endowment_id" is less than or equal to 3 and the "amount" is greater than 9.05?

SELECT School_id FROM School WHERE School_id = "7" AND Location != "New Carlisle" AND County != "20 Elkhart" UNION ALL SELECT School_id FROM endowment WHERE donator_name = "Com. Dom. En Estados Unidos" OR "School_id" > 7 OR "endowment_id" <= 3 AND "amount" > 9.05


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


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

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: Which driver has an ID of 5, but is not a driver with an ID other than 4 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 <> 4


Question: Can you give me a list of driver IDs that are greater than 5, excluding any driver IDs less than 9 that are also 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 give me a list of aircraft IDs that appear in the aircraft table, excluding aircraft ID 1, but then remove any aircraft IDs from that list that also appear in the airport_aircraft table with an ID of 2 or less?

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


Question: Which driver IDs are not 11 and appear in the driver table, and are also not 10 and appear in the school bus table?

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


Question: Could you give me the sum of the 'eid' values from the 'certificate' table where 'aid' is less than 12 and 'eid' is less than 142519864, combined with the sum of the 'eid' values from the 'employee' table where 'eid' is less than or equal to 489456522 and 'salary' is less than 212156, or where the name is not "Haywood Kelly"?

SELECT SUM(eid) FROM certificate WHERE "aid" < 12 AND "eid" < 142519864 UNION ALL SELECT SUM(eid) FROM employee WHERE "eid" <= 489456522 AND "salary" < 212156 OR name != "Haywood Kelly"


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID < 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, first from the driver table excluding driver ID 5, and then combined with a list of driver IDs from the school bus table that are 4 or greater, 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 >= 4


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

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


Question: Could you give me a list of staff IDs from the Lessons table, including those where the staff ID is not 12 and the vehicle ID is greater than 1, or where the lesson date is not March 16, 2018 at 7:08:52 AM and the customer ID is greater than or equal to 6, combined with a list of staff IDs from the Staff table where the staff address ID is less than 5 and the staff ID is greater than 9 and the date of birth is August 1, 2015 at 1:22:43 PM, or the nickname is not santos45, or the last name is not Maggio and the first name is not Simeon, or the date left staff is not March 8, 2018 at 5:16:29 AM, or the middle name is not Stephania?

SELECT staff_id FROM Lessons WHERE "staff_id" != 12 AND "vehicle_id" > 1 OR lesson_date != "2018-03-16 07:08:52" AND "customer_id" >= 6 UNION ALL SELECT staff_id FROM Staff WHERE "staff_address_id" < 5 AND "staff_id" > 9 AND date_of_birth = "2015-08-01 13:22:43" OR nickname <> "santos45" OR last_name != "Maggio" AND first_name != "Simeon" OR date_left_staff <> "2018-03-08 05:16:29" OR middle_name != "Stephania"


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

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