Question: What employee IDs have certificate aid 8 and are held by employees with a salary of 289950, or a name other than Jennifer Thomas, or an employee ID less than or equal to 489456522, and also have certificate eid 355548984?

SELECT eid FROM certificate WHERE "eid" = 355548984 AND "aid" = 8 INTERSECT SELECT eid FROM employee WHERE "salary" = 289950 OR name <> "Jennifer Thomas" OR "eid" <= 489456522


Question: What are the user IDs that meet these conditions: either the user ID in the review table is greater than 2, or the item ID is less than 5 and the rating is not 6, or the account ID is less than or equal to 3 and the rank is not 7; and also have a user ID less than or equal to 3 and the name "Helen" in the user account table?

SELECT u_id FROM review WHERE "u_id" > 2 OR "i_id" < 5 AND "rating" <> 6 OR "a_id" <= 3 AND "rank" != 7 INTERSECT SELECT u_id FROM useracct WHERE "u_id" <= 3 AND name = "Helen"


Question: What are the driver IDs that are less than or equal to 1, and also the driver IDs that are greater than 10, considering both driver and school bus information?

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: What are the driver IDs that are present in both the driver and school bus tables, where the driver ID is no more than 6 in the driver table and no more than 7 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 <= 7


Question: What are the IDs and years of cars, grouped by their full names, where the number of cylinders is less than 6 and the year is after 1970, or the country is not "1", or the MPG is not "16" and the engine displacement is greater than 140.0, or the maker is not "opel" and the weight is 2904?

SELECT T1.Id, T2.Year FROM car_makers as T1 JOIN cars_data as T2 ON T1.Id == T2.Id GROUP BY FullName HAVING Cylinders < 6 AND Year > 1970 OR Country <> "1" OR MPG <> "16" AND Edispl > 140.0 OR Maker <> "opel" AND Weight = 2904


Question: What are the ranks from the match results where "Small_Silver" is greater than 10, "Points" is greater than 66, "Bronze" is greater than 9, "Big_Silver" is 7, and "Gold" is 12, combined with the ranks from players who are not "Self Employed / Consultant" and whose name is not "Ron Strynadka", or whose player ID is greater than 1, or who don't live in "Birtle", or who don't have 14097 votes?

SELECT Rank FROM match_result WHERE "Small_Silver" > 10 AND "Points" > 66 AND "Bronze" > 9 AND "Big_Silver" = 7 AND "Gold" = 12 UNION ALL SELECT Rank FROM player WHERE Occupation != "Self Employed / Consultant" AND Player_name <> "Ron Strynadka" OR "Player_ID" > 1 AND Residence <> "Birtle" OR "Votes" <> 14097


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

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


Question: Which schools have a total budget percentage budgeted greater than 2.0, or have a donator name that is not "San José de Ocoa"?

SELECT School_id FROM budget WHERE "total_budget_percent_budgeted" > 2.0 UNION SELECT School_id FROM endowment WHERE donator_name <> "San José de Ocoa"


Question: Which aircraft have ID 4, or any aircraft ID other than 1?

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: Which driver IDs are not equal to 7, but are not also driver IDs from school buses with IDs of 10 or greater?

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


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

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


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

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


Question: Which districts, excluding those headquartered in Bahawalpur City or with a city area of 147, have a district ID less than 7, a city population less than 314617, and are headquartered in Bahawalnagar City, but are not Hafizabad District? List the district name, city area, city population, and district ID.

SELECT District_name, City_Area, City_Population, District_ID FROM district WHERE "District_ID" < 7 AND "City_Population" < 314617.0 AND Headquartered_City = "Bahawalnagar City" AND District_name != "Hafizabad District" EXCEPT SELECT District_name, City_Area, City_Population, District_ID FROM district WHERE Headquartered_City = "Bahawalpur City" OR "City_Area" = 147.0


Question: What are the vehicle IDs for lessons with customer IDs of 11 or less and a lesson time that isn't "4" and a price of 495 or less, combined with the vehicle IDs for trucks with vehicle IDs of 2 or less?

SELECT vehicle_id FROM Lessons WHERE "customer_id" <= 11 AND lesson_time <> "4" AND "price" <= 495.0 UNION ALL SELECT vehicle_id FROM Vehicles WHERE vehicle_details = "Truck" AND "vehicle_id" <= 2


Question: Which driver IDs are greater than 6 but not equal to 7 in the school bus records?

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


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

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


Question: Give me the district, name, location, manager's name, and shop ID for shops that are not shop ID 7 and not named "FC Lahti", or are located in "Arto Tolsa Areena" and "Jakobstad", excluding those managed by "Job Dragtsma" or not named "FC Inter" and not located in "Jakobstad" and have less than 3500 products.

Arto Tolsa Areena
FC KooTeePee
Kotka
Tommi Kautonen
6

Finnair Stadium
HJK
Helsinki
Antti Muurinen
2

Jakobstads Centralplan
FF Jaro
Jakobstad
Mika Laurikainen
5

Tapiolan Urheilupuisto
FC Honka
Espoo
Mika Lehkosuo
3

Tehtaan kenttä
FC Haka
Valkeakoski
Olli Huttunen
1

SELECT District, Name, Location, Manager_name, Shop_ID FROM shop WHERE "Shop_ID" != 7 AND Name != "FC Lahti" OR District = "Arto Tolsa Areena" AND Location = "Jakobstad" EXCEPT SELECT District, Name, Location, Manager_name, Shop_ID FROM shop WHERE Manager_name = "Job Dragtsma" OR Name != "FC Inter" AND Location <> "Jakobstad" AND "Number_products" < 3500


Question: What are the document IDs from the Documents table that don't have ID 17, or are of type "CD" and were not received on "2008-04-21 20:42:25", or have a status other than "done", or have "q" as other details, or have a receipt number other than "19", but are not document IDs from Draft_Copies where the document ID is less than 2 and the copy number is at least 15, or the draft number is less than or equal to 9?

SELECT document_id FROM Documents WHERE "document_id" != 17 OR document_type_code = "CD" AND receipt_date <> "2008-04-21 20:42:25" OR document_status_code != "done" OR other_details = "q" OR receipt_number <> "19" EXCEPT SELECT document_id FROM Draft_Copies WHERE "document_id" < 2 AND "copy_number" >= 15 OR "draft_number" <= 9


Question: What are the IDs of drivers, excluding driver 11, and the IDs of school bus drivers, excluding driver 3?

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


Question: Which driver IDs are either 12 or less than or equal to 7?

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


Question: Which driver IDs are either less than or equal to 2 in the driver table or greater than or equal to 4 in the school bus table?

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


Question: What is the total number of years worked, and the driver ID, for drivers who meet at least one of the following conditions: their driver ID is greater than 4 and they've worked for 2 or more years, or their school ID is less than 4, or they are full-time? Also, what is the total number of years worked, and the driver ID, for drivers who are full-time, or have worked for 8 or more years, or have a driver ID less than 4, or their school ID is 7 or less?

SELECT SUM(Years_Working), Driver_ID FROM school_bus WHERE "Driver_ID" > 4 AND "Years_Working" >= 2 OR "School_ID" < 4 OR If_full_time = "T" UNION SELECT SUM(Years_Working), Driver_ID FROM school_bus WHERE If_full_time = "T" OR "Years_Working" >= 8 OR "Driver_ID" < 4 OR "School_ID" <= 7


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

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


Question: What are the driver IDs greater than 10 from the driver table, combined with the driver IDs greater than 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: What are the aircraft IDs that are both less than or equal to 5 and also greater than or equal to 3, considering only 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 >= 3


Question: What are the ranks from the coach table where the coach ID is 3 or less, or the club ID is less than 1 and the gender is not male, combined with the ranks from the match results table where the points are not 84 and the rank is not 6, or the club ID is 4 or less?

SELECT Rank FROM coach WHERE "Coach_ID" <= 3 OR "Club_ID" < 1 AND Gender != "M" UNION ALL SELECT Rank FROM match_result WHERE "Points" != 84 AND "Rank" != 6 OR "Club_ID" <= 4


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

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


Question: What are the DPI, color pages per minute, interface, max page size, and product ID for products that either don't have a max page size of 216mm x 356mm, have a color pages per minute of 3.0, a DPI not equal to 600.0, are not the Canon DR-2080C, have a product ID not equal to 6, don't have dimensions of 301 x 160 x 158, or don't have a USB 2.0 interface; or for products that either don't have dimensions of 289 x 51 x 38, have a product ID less than or equal to 4 and are the Xerox Travel Scanner 100, have a USB 2.0 interface, have a DPI not equal to 600.0, or have a max page size of 216mm x 355mm and a color pages per minute not equal to 30.0?

SELECT dpi, pages_per_minute_color, interface, max_page_size, product_id FROM product WHERE max_page_size <> "216mm x 356mm" OR "pages_per_minute_color" = 3.0 OR "dpi" != 600.0 OR product != "Canon DR-2080C" OR "product_id" != 6 OR dimensions != "301 x 160 x 158" OR interface != "USB 2.0" UNION SELECT dpi, pages_per_minute_color, interface, max_page_size, product_id FROM product WHERE dimensions <> "289 x 51 x 38" OR "product_id" <= 4 AND product = "Xerox Travel Scanner 100" OR interface = "USB 2.0" OR "dpi" <> 600.0 OR max_page_size = "216mm x 355mm" AND "pages_per_minute_color" <> 30.0


Question: What are the aircraft IDs, excluding aircraft ID 4, from the aircraft table, combined with aircraft IDs greater than 5 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 > 5


Question: What are the driver IDs that are 6 or greater, but not greater than 9, that are associated with a school bus?

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


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

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: Which customer IDs meet all of these criteria: they don't have the email "myrl.lind@example.net", their last name isn't "Grant", their phone number isn't "00659133944", their birth date is "1996-08-29 00:03:08", and their customer address ID is at least 1, but they did not have a lesson on "2018-03-17 19:02:07"?

SELECT customer_id FROM Customers WHERE email_address != "myrl.lind@example.net" AND last_name <> "Grant" AND cell_mobile_phone_number <> "00659133944" AND date_of_birth = "1996-08-29 00:03:08" AND "customer_address_id" >= 1 EXCEPT SELECT customer_id FROM Lessons WHERE lesson_date = "2018-03-17 19:02:07"


Question: What are the names of employees who are not Jason Hobson or whose employee ID is greater than 4, combined with the names of shops not located in Kotka and not in Tapiolan Urheilupuisto?

SELECT Name FROM employee WHERE Name != "Jason Hobson" OR "Employee_ID" > 4 UNION SELECT Name FROM shop WHERE Location != "Kotka" AND District != "Tapiolan Urheilupuisto"


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

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


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

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


Question: What are the driver IDs that are less than 4, excluding those driver IDs greater than 9?

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


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

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


Question: What are the aircraft IDs, where the ID is 5 from the aircraft table, combined with all other aircraft IDs that are not 5 from the airport_aircraft table?

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


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

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


Question: What are the coach IDs and starting years for players where the player ID is greater than 3 or the starting year isn't 2013, and also for coaches where the coach ID isn't 1 and the starting year isn't 2011?

SELECT Coach_ID, Starting_year FROM player_coach WHERE "Player_ID" > 3 OR "Starting_year" != 2013 UNION ALL SELECT Coach_ID, Starting_year FROM player_coach WHERE "Coach_ID" <> 1 AND "Starting_year" <> 2011


Question: What is the average player ID and the sum of starting years, grouped by coach ID, excluding results where the starting year is 2013 or later and the coach ID is 1 or less, but including results where the coach ID is not 5 or the starting year is 2013 or earlier, from the player_coach table?

SELECT AVG(Player_ID), SUM(Starting_year), Coach_ID FROM player_coach WHERE "Coach_ID" != 5 OR "Starting_year" <= 2013 OR "Player_ID" != 1 EXCEPT SELECT AVG(Player_ID), SUM(Starting_year), Coach_ID FROM player_coach WHERE "Starting_year" >= 2013 AND "Coach_ID" <= 1


Question: For each number of employees, how many departments were created, considering departments where the ranking isn't 13, the budget is 59.7 billion, or the number of employees is less than 71436, excluding those with only one creation date? Also, for each number of employees, how many departments were created, considering departments where the number of employees isn't 36000, the department ID is 9 or less, or the name isn't "Agriculture" and the ranking is greater than 5 and the creation date isn't "1966", including those with one or more creation dates?

SELECT Num_Employees, COUNT(Creation) FROM department WHERE "Ranking" <> 13 OR "Budget_in_Billions" = 59.7 OR "Num_Employees" < 71436.0 GROUP BY Num_Employees HAVING COUNT(Creation) != 1 UNION SELECT Num_Employees, COUNT(Creation) FROM department WHERE "Num_Employees" <> 36000.0 OR "Department_ID" <= 9 OR Name != "Agriculture" AND "Ranking" > 5 AND Creation <> "1966" GROUP BY Num_Employees HAVING COUNT(Creation) >= 1


Question: Which driver IDs appear in both the 'driver' and 'school_bus' tables, grouped by school ID, where the party is not "Dem", or years working is 8, or if full-time is "T"?

SELECT T1.Driver_ID, T2.Driver_ID FROM driver as T1 JOIN school_bus as T2 ON T1.Driver_ID == T2.Driver_ID GROUP BY School_ID HAVING Party <> "Dem" OR Years_Working = 8 OR If_full_time = "T"


Question: Which driver IDs are greater than 7 but not equal to 7, considering only drivers and school buses?

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


Question: What are the template IDs that are both associated with a document named "About Korea" and also have a version number of 2, a template ID less than or equal to 14, and either have non-empty template details, a template type code of "BK", or have different effective dates than "1976-10-28 10:08:50" and "1983-07-16 21:16:16"?

SELECT Template_ID FROM Documents WHERE Document_Name = "About Korea" INTERSECT SELECT Template_ID FROM Templates WHERE "Version_Number" = 2 AND "Template_ID" <= 14 AND Date_Effective_To != "1976-10-28 10:08:50" OR Template_Details <> "" OR Template_Type_Code = "BK" OR Date_Effective_From != "1983-07-16 21:16:16"


Question: Which branch IDs meet at least one of these conditions: opened in 2012 and not named Zytogorski, or the address isn't Valleys Place and the ID is greater than 6, or the city isn't Oxford, or the membership amount is 31; but exclude any branch IDs that were registered in 2016 with a member ID other than 8 and a branch ID of 2?

SELECT Branch_ID FROM branch WHERE Open_year = "2012" AND Name != "Zytogorski" OR Address_road != "Valleys Place" AND "Branch_ID" > 6 OR City != "Oxford" OR membership_amount = "31" EXCEPT SELECT Branch_ID FROM membership_register_branch WHERE Register_Year = "2016" AND "Member_ID" <> 8 AND Branch_ID = "2"


Question: What are the driver IDs that are either 6 or 7 or less, considering both drivers and school buses?

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


Question: What are the driver IDs that are present in both the driver and school bus tables, excluding driver ID 6 from the driver table and driver ID 7 from 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 != 7


Question: What are the aircraft IDs that appear in both the aircraft table and the airport_aircraft table, where the aircraft ID is at least 1 in the aircraft table and is equal to 2 in the airport_aircraft table?

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


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

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: Which driver IDs are less than 7 but not greater than or equal to 9, considering only the driver IDs?

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


Question: What are the driver IDs greater than 10 that are in the driver table but not in the school bus table, where the school bus driver IDs are 7 or greater?

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


Question: What is the maximum aircraft ID and the corresponding aircraft ID from the aircraft and airport aircraft tables, joined by the aircraft ID?

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


Question: Which driver IDs, excluding driver ID 11, are in the driver table, and also which driver IDs, up to and including 10, are in the school bus table?

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


Question: Which driver IDs are equal to 5, or driver IDs less than 9?

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


Question: What car makers are not Hyundai and have an ID other than 6 or are from a country other than 1 and have a full name of Citroen, and also what car maker makes the model capri?

SELECT Maker FROM car_makers WHERE Maker != "hyundai" AND "Id" <> 6 OR Country != "1" AND FullName = "Citroen" UNION SELECT Maker FROM model_list WHERE Model = "capri"


Question: Which driver IDs are greater than 11 in the driver table or not equal to 3 in the school bus table?

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


Question: What are the template IDs from documents named "How to read a book" with other details not "None" and description "y" or any document ID greater than 0, excluding template IDs from templates with version numbers less than 9, effective to dates not "1998-05-12 12:51:29", template details not empty, and template type codes not "BK"?

SELECT Template_ID FROM Documents WHERE Document_Name = "How to read a book" AND Other_Details != "None" AND Document_Description = "y" OR "Document_ID" > 0 EXCEPT SELECT Template_ID FROM Templates WHERE "Version_Number" < 9 AND Date_Effective_To <> "1998-05-12 12:51:29" AND Template_Details != "" AND Template_Type_Code <> "BK"


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

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


Question: What are the aircraft IDs that are not 4 and also appear in the airport_aircraft table with an ID of 1?

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


Question: What are the driver IDs, excluding driver ID 12, from the driver table, and also the driver IDs, up to and including 3, from the school bus table?

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


Question: Which driver IDs are both equal to 9 and associated with a school bus with an ID greater than or equal to 7?

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


Question: What are the aircraft IDs greater than 4, combined with the aircraft IDs from airport_aircraft that are less than or equal to 3?

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


Question: What is the sum of the 'Template_Type_Code' where the code is "PP" or the description is not "Presentation", and also the sum of the 'Template_Type_Code' where the description is "CV"?

SELECT SUM(Template_Type_Code) FROM Ref_Template_Types WHERE Template_Type_Code = "PP" OR Template_Type_Description != "Presentation" UNION ALL SELECT SUM(Template_Type_Code) FROM Ref_Template_Types WHERE Template_Type_Description = "CV"


Question: What are the driver IDs that are 7 or greater, excluding driver ID 9, based on the driver and school bus information?

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


Question: What is the maximum ID and MPG for cars made in or after 1974 with 150 horsepower and an MPG other than 38, or an engine displacement greater than 140.0, or an acceleration of 16.0, or a full name other than Citroen, or a maker that is citroen, grouped by the number of cylinders, but excluding those with a full name of Subaru, a maker that is renault, and a weight less than 3459, or an acceleration of 12.2, or 8 cylinders and an engine displacement other than 351.0, or a horsepower other than 180 and an MPG of 13 and a year of 1974 or later and a country other than 3?

SELECT MAX(T1.Id), T2.MPG FROM car_makers as T1 JOIN cars_data as T2 ON T1.Id = T2.Id WHERE "Year" >= 1974 AND Horsepower = "150" AND MPG <> "38" OR "Edispl" > 140.0 OR "Accelerate" = 16.0 OR FullName <> "Citroen" OR Maker = "citroen" GROUP BY Cylinders HAVING FullName <> "Subaru" AND Maker <> "renault" AND Weight >= 3459 OR Accelerate <> 12.2 OR Cylinders = 8 AND Edispl <> 351.0 OR Horsepower <> "180" AND MPG = "13" AND Year >= 1974 AND Country <> "3"


Question: What are the IDs of drivers, excluding driver 7, and what are the IDs of school buses, excluding bus 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 are the driver IDs, excluding driver ID 6, and also the driver IDs less than or equal to 7, from the driver and school bus tables?

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


Question: Which driver IDs are not equal to 3, but are not also driver ID 7?

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


Question: Find the average sex, minimum last name, advisor, first name, and student ID for students who meet the following conditions: either their advisor is 8723, or their major is not 600, or their age is greater than 18, their sex is not "F", and their city code is not "BOS", or their student ID is greater than or equal to 1021, their last name is not "Pang", and their first name is not "William"; and also meet the following conditions: either their student ID is less than 1023 or their first name is not "Mark".

SELECT AVG(Sex), MIN(LName), Advisor, Fname, StuID FROM Student WHERE "Advisor" = 8723 OR "Major" != 600 OR "Age" > 18 AND Sex <> "F" AND city_code <> "BOS" OR "StuID" >= 1021 AND LName != "Pang" AND Fname <> "William" INTERSECT SELECT AVG(Sex), MIN(LName), Advisor, Fname, StuID FROM Student WHERE "StuID" < 1023 OR Fname <> "Mark"


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

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


Question: Which driver IDs are less than or equal to 8, but not equal to 9, considering only those present in the 'driver' table but not in the 'school_bus' table?

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


Question: What are the driver IDs that are equal to 6, excluding those driver IDs greater than 3 from the school bus records?

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


Question: What are the document IDs that satisfy at least one of the following: the draft number is 17 or less, the document ID is 10, or the draft details are not "w", but are not document IDs where the draft number is less than 20 and the document ID is not 1?

SELECT document_id FROM Document_Drafts WHERE "draft_number" <= 17 OR "document_id" = 10 OR draft_details != "w" EXCEPT SELECT document_id FROM Document_Drafts WHERE "draft_number" < 20 AND "document_id" <> 1


Question: What are the aircraft IDs that are less than 5, and also the 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: What are the location, minimum school name, grade, and minimum school type for schools where the school is "Occidental College" or the school ID is greater than 5 and not located in "New York City", combined with the results for schools where the grade is not "5th-12th grade" or the school ID is not 1?

Honolulu, Hawaii
Columbia University
5th-12th grade
Private

Los Angeles, California
Harvard Law School
Freshman–Sophomore year
Private

SELECT Location, MIN(School), Grade, MIN(Type) FROM school WHERE School = "Occidental College" OR "School_ID" > 5 AND Location != "New York City" UNION SELECT Location, MIN(School), Grade, MIN(Type) FROM school WHERE Grade != "5th-12th grade" OR "School_ID" <> 1


Question: Which driver IDs are in either the driver or school bus tables, excluding driver ID 6 from the driver table and driver ID 10 from the school bus table?

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


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

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


Question: Which driver IDs are not equal to 9 but are not also driver IDs from school buses with IDs greater than 10?

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


Question: What is the smallest club ID that is not 3, and also the smallest club ID of a coach who is not female or has a rank of 4 or less?

SELECT MIN(Club_ID) FROM club WHERE "Club_ID" <> 3 INTERSECT SELECT MIN(Club_ID) FROM coach WHERE Gender <> "F" OR "Rank" <= 4


Question: Which driver IDs are less than 4 but not present in the school bus table with IDs less than 9?

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


Question: What are the driver IDs greater than 6 that are also driver IDs equal to 9, considering information from both the driver and school bus tables?

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


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

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


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

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


Question: What are the feature IDs, descriptions, types, and names of features named "AirCon" that are not "Swimming Pool" and also features that either aren't "Security" or are "Swimming Pool"?

SELECT feature_id, feature_description, feature_type_code, feature_name FROM Other_Available_Features WHERE feature_description != "Swimming Pool." AND feature_name = "AirCon" INTERSECT SELECT feature_id, feature_description, feature_type_code, feature_name FROM Other_Available_Features WHERE feature_type_code <> "Security" OR feature_description = "Swimming Pool."


Question: What are the total city values, names, and opening years for branches in Oxford or not named Cochrane, and also for branches where the address is not Concord Road, the opening year isn't 2009, or the city is London, or the name isn't Alexandre?

SELECT SUM(City), Name, Open_year FROM branch WHERE City = "Oxford" OR Name <> "Cochrane" INTERSECT SELECT SUM(City), Name, Open_year FROM branch WHERE Address_road <> "Concord Road" AND Open_year != "2009" OR City = "London" OR Name <> "Alexandre"


Question: What are the driver IDs that are less than 6 and also appear in the school bus table, excluding driver ID 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 are the aircraft IDs, excluding aircraft ID 3, and also the aircraft IDs from airport-aircraft, excluding aircraft ID 1?

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


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

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


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

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


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

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


Question: What start years are associated with clubs that started in 2001, have a club ID less than 5, or are not named "Djurgårdens IF" and are not in the "USA", but not including the start year 2000?

SELECT Start_year FROM club WHERE "Start_year" = 2001 OR "Club_ID" < 5 OR Club_name != "Djurgårdens IF" AND Region != "USA" EXCEPT SELECT Start_year FROM club WHERE "Start_year" = 2000


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

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


Question: Which driver IDs are less than or equal to 5 in the driver table but not greater than or equal to 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: What is the minimum allergy for allergy types that are not "food" or allergies that are not "Rodent", combined with the minimum allergy for students with an ID of 1027 or higher?

SELECT MIN(Allergy) FROM Allergy_Type WHERE AllergyType <> "food" OR Allergy <> "Rodent" UNION SELECT MIN(Allergy) FROM Has_Allergy WHERE "StuID" >= 1027


Question: What is the maximum allergy type and the allergy for all allergy types except "animal", and also what is the maximum allergy type and the allergy for all allergies except "Ragweed"?

SELECT MAX(AllergyType), Allergy FROM Allergy_Type WHERE AllergyType != "animal" UNION SELECT MAX(AllergyType), Allergy FROM Allergy_Type WHERE Allergy <> "Ragweed"


Question: Which employees, excluding Haley, have "b" in their other details and also either have other details not equal to "f" or a role code that is not "ED"?

SELECT employee_id, employee_name, other_details FROM Employees WHERE other_details = "b" AND employee_name != "Haley" INTERSECT SELECT employee_id, employee_name, other_details FROM Employees WHERE other_details <> "f" OR role_code != "ED" AND employee_name != "Haley"


Question: What are the driver IDs that are not 7 and are in the driver table, but not in the school bus table with 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: What are the driver IDs that are both greater than or equal to 4 and less than or equal to 10, considering only those drivers who are in the driver table and also in the school bus table?

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


Question: Which aircraft have ID 5, and which aircraft have an ID greater than 3, considering both the aircraft and airport_aircraft tables?

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


Question: Which driver IDs are less than or equal to 6, excluding driver ID 9, considering only the driver table and the school bus table?

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


Question: What are the makers and the earliest model for each, excluding BMW models and models where the maker is 22, or where the ModelId is greater than 20? Also, what are the makers and the earliest model for each, where the maker is 16 or the model is not a Peugeot?

SELECT Maker, MIN(Model) FROM model_list WHERE Model <> "bmw" AND "Maker" <> 22 OR "ModelId" > 20 UNION ALL SELECT Maker, MIN(Model) FROM model_list WHERE "Maker" = 16 OR Model != "peugeot"


Question: What are the driver IDs that are either less than or equal to 2 or greater than or equal to 9?

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


Question: What are the employee IDs of employees named Andrew Sheridan who don't live in Bath, combined with the employee IDs of those who work at shop 1 or started before 2003?

SELECT Employee_ID FROM employee WHERE Name = "Andrew Sheridan" AND City != "Bath" UNION SELECT Employee_ID FROM hiring WHERE "Shop_ID" = 1 OR Start_from != "2003"


Question: What are the last names and dates of birth of customers with an address ID greater than 1, combined with the last names and dates of birth of staff who are not nicknamed "norma73" and don't have "Mayra" as a middle name, and were not hired on "2017-04-27 03:21:26", or have a staff address ID of 1, or have a date of birth of "2015-08-10 11:37:39", or have a first name of "Simeon"?

SELECT last_name, date_of_birth FROM Customers WHERE "customer_address_id" > 1 UNION SELECT last_name, date_of_birth FROM Staff WHERE nickname != "norma73" AND middle_name <> "Mayra" AND date_joined_staff != "2017-04-27 03:21:26" OR "staff_address_id" = 1 OR date_of_birth = "2015-08-10 11:37:39" OR first_name = "Simeon"


Question: Which driver IDs are not equal to 11 but are in the driver table and not in the school bus table where the driver ID is 9?

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


Question: What are the document IDs where the copy number is 4 or less, or the document IDs from mailed documents that were not mailed on April 1st, 1977?

SELECT document_id FROM Circulation_History WHERE "copy_number" <= 4 OR "document_id" >= 2 UNION SELECT document_id FROM Documents_Mailed WHERE mailing_date != "1977-04-01 17:03:50"


Question: What are the car maker IDs and countries, along with the counts of full names and makers, for car makers where the ID is not 23 and the country is not "6", combined with the same information for car makers where the maker is not "triumph" and the ID is 5 or less?

SELECT Id, Country, COUNT(FullName), COUNT(Maker) FROM car_makers WHERE "Id" <> 23 AND Country <> "6" UNION ALL SELECT Id, Country, COUNT(FullName), COUNT(Maker) FROM car_makers WHERE Maker != "triumph" AND "Id" <= 5


Question: Which aircraft IDs are equal to 1, or are less than or equal to 3?

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


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

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


Question: What are the property type codes that are either "Field" or not described as "Field, Meadow.", but are not described as "Shop, Retail Outlet."?

SELECT property_type_code FROM Ref_Property_Types WHERE property_type_code = "Field" OR property_type_description != "Field, Meadow." EXCEPT SELECT property_type_code FROM Ref_Property_Types WHERE property_type_description = "Shop, Retail Outlet."


Question: What are the aircraft IDs that are not 3 and are in the aircraft table, but not in the airport_aircraft table with IDs greater than or equal to 2?

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


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

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


Question: How many aircraft names have a distance greater than or equal to 2128 and an aid less than 1, and how does that compare to the number of aircraft names with a distance less than or equal to 4103 and an aid greater than or equal to 14?

SELECT COUNT(name) FROM aircraft WHERE "aid" < 1 AND "distance" >= 2128 IN (SELECT COUNT(name) FROM aircraft WHERE "distance" <= 4103 AND "aid" >= 14)


Question: What are the aircraft IDs that are not 4 and also appear in the airport aircraft table with IDs less than 5?

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


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

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


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

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


Question: Which car makers have an ID less than or equal to 12 or a full name that isn't Chrysler, and also which makers have a model that isn't triumph and a model ID greater than 24 or a maker ID of 13?

SELECT Maker FROM car_makers WHERE "Id" <= 12 OR FullName != "Chrysler" UNION SELECT Maker FROM model_list WHERE Model <> "triumph" AND "ModelId" > 24 OR "Maker" = 13


Question: What are the branch IDs of branches located in London that are not on Glebe Street, or have a name different from Brooke Greville, or have a membership amount of 31, or opened in 2001? Also, what are the branch IDs from purchase records where the total pounds is greater than 321.13 and the member ID is not 4, or the branch ID is 3, or the year is 2018?

SELECT Branch_ID FROM branch WHERE Address_road <> "Glebe Street" AND City = "London" OR Name != "Brooke Greville" OR membership_amount = "31" OR Open_year = "2001" UNION ALL SELECT Branch_ID FROM purchase WHERE "Total_pounds" > 321.13 AND "Member_ID" != 4 OR Branch_ID = "3" OR Year = "2018"


Question: What are the titles and IDs of albums with IDs less than or equal to 25, excluding those titles and IDs found in the employees table where the employee's reports_to value is not 2, and the ID is greater than or equal to 7, and the city is not Lethbridge, and the phone number is not "+1 (780) 428-9482", or the birth date is December 8, 1958, or the postal code is T1H 1Y8 and the address is not "11120 Jasper Ave NW"?

Alcohol Fueled Brewtality Live! [Disc 1]

Alcohol Fueled Brewtality Live! [Disc 2]

The Best Of Buddy Guy - The Millenium Collection

SELECT title, id FROM albums WHERE "id" <= 25 EXCEPT SELECT title, id FROM employees WHERE "reports_to" <> 2.0 AND "id" >= 7 AND city != "Lethbridge" AND phone != "+1 (780) 428-9482" OR birth_date = "1958-12-08 00:00:00" OR postal_code = "T1H 1Y8" AND address <> "11120 Jasper Ave NW"


Question: Give me the student ID, the count of each sex, the average first name, the last name, the age, and the city code for students where the first name is Michael, or the sex is not male and the age is at least 19, or the last name is not Schmidt. Also, include the same information for students where the student ID is 1008, or the last name is not Prater, or the age is less than 17 and the advisor is greater than 2192, or the sex is male and the major is greater than 50.

StuID COUNT(Sex) AVG(Fname) LName Age city_code

SELECT StuID, COUNT(Sex), AVG(Fname), LName, Age, city_code FROM Student WHERE Fname = "Michael" OR Sex <> "M" AND "Age" >= 19 OR LName != "Schmidt" UNION ALL SELECT StuID, COUNT(Sex), AVG(Fname), LName, Age, city_code FROM Student WHERE "StuID" = 1008 OR LName != "Prater" OR "Age" < 17 AND "Advisor" > 2192 OR Sex = "M" AND "Major" > 50


Question: What are the driver IDs that are both at least 2 and less than 10, considering only those present in 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 < 10


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

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


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

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


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

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


Question: What are the aircraft IDs where the distance is not 1502, or the employee ID is less than 269734834, or the aircraft ID is greater than 2?

SELECT aid FROM aircraft WHERE "distance" != 1502 UNION ALL SELECT aid FROM certificate WHERE "eid" < 269734834 OR "aid" > 2


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

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


Question: What is the sum of employee IDs less than 248965255, excluding the sum of employee IDs greater than 619023588?

SELECT SUM(eid) FROM employee WHERE "eid" < 248965255 EXCEPT SELECT SUM(eid) FROM employee WHERE "eid" > 619023588


Question: What are the aircraft IDs that are either less than or equal to 1, or not equal to 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: What are the road addresses and cities of branches that either opened in a year other than 2001, have a branch ID of 2, have a membership amount of 7 and are located in London and are not named Cochrane, or have a road address other than Glebe Street? Also, what are the road addresses and cities of branches with a membership amount that is not 31?

SELECT Address_road, City FROM branch WHERE Open_year != "2001" OR "Branch_ID" = 2 OR membership_amount = "7" AND City = "London" AND Name <> "Cochrane" OR Address_road <> "Glebe Street" UNION SELECT Address_road, City FROM branch WHERE membership_amount != "31"


Question: What are the driver IDs that are either 7 or greater from the driver table, or less than 10 from the school bus table?

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


Question: What are the driver IDs, excluding ID 9, from the driver table, combined with the driver IDs 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: Which employee IDs are associated with circulation history entries that don't have draft number 20 and copy number less than 5 or document ID greater than 20, and also which employee IDs have other details not equal to "b" and the employee name is "Kenyon"?

SELECT employee_id FROM Circulation_History WHERE "draft_number" != 20 AND "copy_number" < 5 OR "document_id" > 20 UNION SELECT employee_id FROM Employees WHERE other_details <> "b" AND employee_name = "Kenyon"


Question: What driver IDs are present in both the driver table, excluding driver ID 3, and the school bus table, specifically with driver ID 4?

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


Question: What are the driver IDs that are both less than or equal to 12 and also appear in the school bus table with driver IDs less 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: What is the average item ID and the rank, considering conditions related to user IDs, ranks, activity IDs, and titles, with a title of "comb" and a rating count less than or equal to 6?

SELECT AVG(T1.i_id), T2.rank FROM item as T1 JOIN review as T2 ON T1.i_id = T2.i_id WHERE COUNT(u_id) > 2 OR rank < 3 OR SUM(a_id) > 1 OR title = "comb" AND COUNT(rating) <= 6


Question: Which driver IDs are present in both the driver and school bus tables, excluding driver ID 4 from the driver table and including only driver IDs greater than 9 from the school bus table?

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


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

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


Question: What are the driver IDs, excluding driver ID 5, from the driver table, combined with the driver IDs, excluding driver ID 7, from the school bus table?

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


Question: What are the aircraft IDs that are both less than or equal to 5 and not equal to 1, considering only the aircraft IDs 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 <> 1


Question: What are the player ID, residence, sponsor name, and player name for players who have 12285 votes, or a player ID of 4 or greater, or a gender other than "M", but not for players sponsored by "Kildonan—St. Paul" with a player ID of 4, or players with 5490 or more votes from Winnipeg?

4
Birtle
Dauphin—Swan River—Marquette
Ron Strynadka

10
Selkirk
Selkirk—Interlake
Patricia Cordner

SELECT Player_ID, Residence, Sponsor_name, Player_name FROM player WHERE "Votes" = 12285 OR "Player_ID" >= 4 OR Gender <> "M" EXCEPT SELECT Player_ID, Residence, Sponsor_name, Player_name FROM player WHERE Sponsor_name = "Kildonan—St. Paul" AND "Player_ID" = 4 OR "Votes" >= 5490 AND Residence = "Winnipeg"


Question: Which driver IDs, excluding ID 12, are present in both the driver and school bus tables, excluding ID 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: Which driver IDs are in the driver table but not in the school bus table, considering only driver IDs up to 5 in the driver table and up to 9 in the school bus table?

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


Question: What are the document status codes for document ID 7 that are not shipped by FE or are not paper documents, and also the document status code for "mailed" documents that are in "working" status?

SELECT document_status_code FROM Documents WHERE "document_id" = 7 AND shipping_agent_code <> "FE" OR document_type_code != "Paper" UNION SELECT document_status_code FROM Ref_Document_Status WHERE document_status_description = "mailed" AND document_status_code = "working"


Question: What are the IDs of properties that either have a feature ID not equal to 3 and a description other than "cumque" or have a property ID greater than or equal to 6 in the Other_Property_Features table, combined with the IDs of houses from the Properties table that meet various criteria including property type, shp_feature_1, oth_feature_3, date_on_market, oth_feature_2, fld_feature_2, date_sold, property_name, hse_feature_3, hse_feature_2, property_address, and fld_feature_1?

SELECT property_id FROM Other_Property_Features WHERE "property_id" >= 6 OR "feature_id" <> 3 AND property_feature_description <> "cumque" UNION ALL SELECT property_id FROM Properties WHERE property_type_code = "House" AND "property_id" >= 1 AND shp_feature_1 <> "None" OR oth_feature_3 = "None" AND date_on_market <> "2017-09-14 15:49:23" OR oth_feature_2 <> "None" AND fld_feature_2 <> "None" AND date_sold != "1984-02-01 19:54:54" OR property_name <> "wall street" OR hse_feature_3 <> "None" OR hse_feature_2 != "None" OR property_address = "092 Paucek Highway Apt. 772 East Erika, IA 61358" OR fld_feature_1 = "None"


Question: What are the aircraft IDs that are equal to 5, considering both the aircraft and airport_aircraft tables?

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


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

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

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


Question: What are the aircraft IDs that are both less than or equal to 4 and also present in the airport aircraft table with IDs less than or equal to 1?

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


Question: What are the driver IDs that are less than 1, and also the driver IDs from school buses that are not 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: What is the smallest employee ID from the circulation history for documents other than document ID 1, combined with the smallest employee ID from the employee table where the employee ID is 7 or less, or the role code is not ED, or the employee name is Erling, or other details are u?

SELECT MIN(employee_id) FROM Circulation_History WHERE "document_id" <> 1 UNION SELECT MIN(employee_id) FROM Employees WHERE "employee_id" <= 7 OR role_code <> "ED" OR employee_name = "Erling" OR other_details = "u"


Question: What is the maximum enrollment and the amount invested for schools, considering conditions related to the year, investment amount, IHSAA class and football class, budget percentage, enrollment size, location, and then filtering the results based on enrollment, school name, budget percentage, and county?

SELECT MAX(T1.Enrollment), T2.Invested FROM School as T1 JOIN budget as T2 ON T1.School_id = T2.School_id WHERE "Year" <= 2005 OR "Invested" < 5840 AND IHSAA_Class = "AAA" AND IHSAA_Football_Class <> "A" AND "total_budget_percent_budgeted" < 2.0 OR "Enrollment" <= 620 OR Location <> "Culver" GROUP BY IHSAA_Class HAVING Enrollment < 495 AND School_name = "Glenn" OR Budget_invested_percent <> "42.9" OR County = "71 St. Joseph"


Question: What are the aircraft IDs that are greater than or equal to 3, but not aircraft IDs less than 5 that are associated with any airport?

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


Question: What are the IDs of pets that either belong to student 1002 or are not pet ID 2001, combined with the IDs of pets that are not pet ID 2001?

SELECT PetID FROM Has_Pet WHERE "StuID" = 1002 OR "PetID" != 2001 UNION SELECT PetID FROM Has_Pet WHERE "PetID" <> 2001


Question: Which club IDs satisfy all of these conditions: they started before the year 2000 and are not named AIK, or their ID is not 5, or they are not in the USA, and also have either 7 or fewer "Big_Silver" medals, or do not have 10 "Bronze" medals, and their ID is not 4, and they have at least 66 points and a rank of at least 2?

SELECT Club_ID FROM club WHERE "Start_year" < 2000 AND Club_name <> "AIK" OR "Club_ID" <> 5 OR Region != "USA" INTERSECT SELECT Club_ID FROM match_result WHERE "Big_Silver" <= 7 OR "Bronze" <> 10 AND "Club_ID" != 4 AND "Points" >= 66 AND "Rank" >= 2


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

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


Question: What are the item IDs that are greater than or equal to 3, excluding the item ID 4 if its title is "orange"?

SELECT i_id FROM item WHERE "i_id" >= 3 EXCEPT SELECT i_id FROM item WHERE "i_id" = 4 AND title = "orange"


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

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


Question: What are the aircraft IDs that are not 4, and also the aircraft IDs that are 3 or greater, considering both the aircraft and airport_aircraft tables?

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


Question: What is the total sales in billions and the year of work for companies, considering conditions related to headquarters, sales, people, profits, year working, market value, company name, and assets?

SELECT SUM(T1.Sales_in_Billion), T2.Year_working FROM company as T1 JOIN employment as T2 ON T1.Company_ID = T2.Company_ID WHERE Headquarters <> "USA" OR "Sales_in_Billion" <= 447.0 AND "People_ID" > 7 OR "Profits_in_Billion" <> 25.7 AND "Year_working" > 1 OR "Market_Value_in_Billion" > 237.4 OR Name = "ExxonMobil" OR "Assets_in_Billion" <= 1873.9


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

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


Question: Which driver IDs are less than or equal to 9 and are in the driver table but not in the school bus table, where the driver IDs in the school bus table are less than 10?

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


Question: What are the driver IDs that are less than or equal to 9, and also the driver IDs from the school bus table that are not 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: What are the IDs of heads born in Connecticut who are age 68 or older and have an ID of 6 or less, or whose name is Jeff Maggert? Also, what are the IDs of people in management who are not in department 11 or are not temporarily acting?

SELECT head_ID FROM head WHERE born_state = "Connecticut" AND "head_ID" <= 6 AND "age" > 68.0 OR name = "Jeff Maggert" UNION SELECT head_ID FROM management WHERE "department_ID" <> 11 OR temporary_acting != "Yes"


Question: Which driver IDs are less than 11, and also which driver IDs are 7 or greater, considering both drivers and school buses?

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


Question: What is the sum of the publisher, the publication ID, the price, and the average book ID for publications where the book ID is not 9, or the price is less than 3,000,000, or the publisher is not Bertelsmann, or the publication ID is less than 6, or the publication date is October 2005? Also, what is the sum of the publisher, the publication ID, the price, and the average book ID for publications where the book ID is not 5, the publication ID is 6 or greater, the publication date is not October 2005, and the price is 6,000,000 or greater?

SELECT SUM(Publisher), Publication_ID, Price, AVG(Book_ID) FROM publication WHERE "Book_ID" != 9 OR "Price" < 3000000.0 OR Publisher != "Bertelsmann" OR "Publication_ID" < 6 OR Publication_Date = "October 2005" UNION ALL SELECT SUM(Publisher), Publication_ID, Price, AVG(Book_ID) FROM publication WHERE "Book_ID" <> 5 AND "Publication_ID" >= 6 AND Publication_Date != "October 2005" AND "Price" >= 6000000.0


Question: Which driver IDs are greater than or equal to 8, excluding those driver IDs that are not equal to 7?

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


Question: Which driver IDs are in the driver table but not in the school bus table, excluding driver ID 1 and any driver IDs less than or equal to 10?

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


Question: Which coach IDs belong to female coaches with a rank other than 4 and club ID 1, or have a coach ID greater than or equal to 1 and a name that is not James Wong? Also, include any coach IDs from the player_coach table that are greater than 3.

SELECT Coach_ID FROM coach WHERE "Rank" != 4 AND Gender = "F" AND "Club_ID" = 1 OR "Coach_ID" >= 1 AND Coach_name <> "James Wong" UNION SELECT Coach_ID FROM player_coach WHERE "Coach_ID" > 3


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

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


Question: Which driver IDs are greater than 1, excluding those with ID 10, considering driver information from the driver table and school bus information from the school_bus table?

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


Question: What are the aircraft IDs that are present in both the aircraft and airport_aircraft tables, excluding aircraft ID 1 from the aircraft table and including only aircraft IDs greater than or equal to 2 from the airport_aircraft table?

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


Question: What are the aircraft IDs that are both aircraft ID 3 and not aircraft ID 2?

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


Question: What are the driver IDs, excluding driver ID 12, and also the driver IDs that are less than or equal to 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: What are the aircraft IDs greater than 2 that are not present in the airport_aircraft table with aircraft IDs greater than or 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: What are the heights and poker player IDs of people, grouped by their birth date, where they are Bulgarian, have made the final table more than 10 times, and their best finish is at least 2.0, and their money rank is at least 154.0, or whose birth date is August 16, 1982, or whose name is Sergey Grankin?

SELECT T1.Height, T2.Poker_Player_ID FROM people as T1 JOIN poker_player as T2 ON T1.People_ID == T2.People_ID GROUP BY Birth_Date HAVING Final_Table_Made > 10.0 AND Nationality = "Bulgaria" AND Best_Finish >= 2.0 AND Money_Rank >= 154.0 OR Birth_Date = "August 16, 1982" OR Name = "Sergey Grankin"


Question: What are the aircraft IDs greater than 3 that are not present in the airport aircraft table with IDs less than 5?

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


Question: What are the club IDs from the club and coach tables where the club name is not "Halmstads BK", or the coach is "Joe Fabbri" and the start year is before 2009, or the region is "USA", or the rank is less than 3, or the coach ID is less than or equal to 2, or the gender is "M", grouped by start year?

SELECT T1.Club_ID, T2.Club_ID FROM club as T1 JOIN coach as T2 ON T1.Club_ID == T2.Club_ID GROUP BY Start_year HAVING Club_name <> "Halmstads BK" OR Coach_name = "Joe Fabbri" AND Start_year < 2009 OR Region = "USA" OR Rank < 3 OR Coach_ID <= 2 OR Gender = "M"


Question: What are all the effective end dates from the Templates table where either the version number is not 5 or the template details are empty and the effective end date is "1999-07-08 03:31:04", or where the effective start date is "1983-07-16 21:16:16", or where the effective end date is not "1979-11-04 08:58:39" and the template details are not empty and the template type code is not "PPT" and the version number is 0, or where the template ID is less than or equal to 8?

SELECT Date_Effective_To FROM Templates WHERE "Version_Number" != 5 OR Template_Details = "" AND Date_Effective_To = "1999-07-08 03:31:04" UNION ALL SELECT Date_Effective_To FROM Templates WHERE Date_Effective_From = "1983-07-16 21:16:16" OR Date_Effective_To != "1979-11-04 08:58:39" AND Template_Details != "" AND Template_Type_Code <> "PPT" AND "Version_Number" = 0 OR "Template_ID" <= 8


Question: Which company IDs meet either of these conditions: their assets are less than 328.7 billion or they are not headquartered in the USA and are not in the Banking industry, or they have 4 or fewer people employed and a company ID of 17 or greater?

SELECT Company_ID FROM company WHERE "Assets_in_Billion" < 328.7 OR Headquarters != "USA" AND Industry <> "Banking" UNION ALL SELECT Company_ID FROM employment WHERE "People_ID" <= 4 AND "Company_ID" >= 17


Question: Give me the amount outstanding, customer address ID, customer ID, cell mobile phone number, phone number, customer status code, date became customer, date of birth, and email address for all customers where the amount outstanding is less than or equal to 8144 and the customer ID is greater than or equal to 5, or the phone number is 206-054-0689x05861 and the customer status code is not "Good Customer", or the date of birth is not 1991-12-05 02:50:15, or the cell mobile phone number is 200.830.8723, or the date became customer is not 2015-11-16 22:52:14. Also, give me the same information for customers where the email address is not myrl.lind@example.net, or the customer status code is "Bad Customer" and the customer address ID is not 1, or the date of birth is 1996-05-23 01:21:54.

SELECT amount_outstanding, customer_address_id, customer_id, cell_mobile_phone_number, phone_number, customer_status_code, date_became_customer, date_of_birth, email_address FROM Customers WHERE "amount_outstanding" <= 8144.0 AND "customer_id" >= 5 OR phone_number = "206-054-0689x05861" AND customer_status_code != "Good Customer" OR date_of_birth != "1991-12-05 02:50:15" OR cell_mobile_phone_number = "200.830.8723" OR date_became_customer != "2015-11-16 22:52:14" UNION SELECT amount_outstanding, customer_address_id, customer_id, cell_mobile_phone_number, phone_number, customer_status_code, date_became_customer, date_of_birth, email_address FROM Customers WHERE email_address != "myrl.lind@example.net" OR customer_status_code = "Bad Customer" AND "customer_address_id" != 1 OR date_of_birth = "1996-05-23 01:21:54"


Question: What are the driver IDs, excluding driver ID 6, and also the driver IDs less than 3, from the driver and school bus tables?

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


Question: What are the descriptions, property IDs, and feature IDs from the 'Other_Property_Features' table where the description isn't "corrupti" and the feature ID is at least 2 and the property ID is at least 13, combined with the descriptions, property IDs, and feature IDs where the description isn't "illo" or the property ID is 6 or less?

SELECT property_feature_description, property_id, feature_id FROM Other_Property_Features WHERE property_feature_description != "corrupti" AND "feature_id" >= 2 AND "property_id" >= 13 UNION SELECT property_feature_description, property_id, feature_id FROM Other_Property_Features WHERE property_feature_description <> "illo" OR "property_id" <= 6


Question: What are the aircraft IDs, excluding aircraft ID 5, and also the aircraft IDs greater than 5, considering both the aircraft and airport_aircraft tables?

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


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

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


Question: What are the IDs of drivers, excluding driver ID 6, and also the IDs of school bus drivers, excluding driver ID 4?

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


Question: What are the driver IDs that are both greater than or equal to 8 and also not equal to 9, considering only drivers and school buses?

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


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

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


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

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


Question: What are the IDs of drivers who have an ID greater than 2 and are also assigned to a school bus, excluding drivers with ID 4?

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


Question: What parties are there in the election table where the party is not 7 and the delegate is not Guzzone, Guy Guy Guzzone, or where the election ID is not 7 and the district is less than 2, or where the first elected year is before 1994 and the counties represented is not 12.1 12A and the committee is not Appropriations? Also, what parties are there in the party table where the party ID is less than 1, the US Senate is not Hillary Rodham Clinton, the Lieutenant Governor is not David Paterson, and the Comptroller is Alan Hevesi?

SELECT Party FROM election WHERE "Party" <> 7 AND Delegate != "Guzzone, Guy Guy Guzzone" OR "Election_ID" <> 7 AND "District" < 2 OR "First_Elected" < 1994.0 AND Counties_Represented <> "12.1 12A" AND Committee != "Appropriations" UNION ALL SELECT Party FROM party WHERE "Party_ID" < 1 AND US_Senate != "Hillary Rodham Clinton" AND Lieutenant_Governor != "David Paterson" AND Comptroller = "Alan Hevesi"


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


Question: What are the ranks of coaches who are not James Wong or whose club ID is not 3, excluding the ranks of players with more than 6055 votes?

SELECT Rank FROM coach WHERE Coach_name <> "James Wong" OR "Club_ID" <> 3 EXCEPT SELECT Rank FROM player WHERE "Votes" > 6055


Question: What bonus amounts are both at least 2900 and not awarded in 2011, or given to employee 2 but not equal to 3200?

SELECT Bonus FROM evaluation WHERE "Bonus" >= 2900.0 INTERSECT SELECT Bonus FROM evaluation WHERE Year_awarded <> "2011" OR Employee_ID = "2" AND "Bonus" <> 3200.0


Question: What are the driver IDs, excluding driver ID 8, that are also present in the school bus table with driver IDs no greater than 10?

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: Which driver IDs are less than 11 but not present in the school bus table with driver IDs greater 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 are equal to 10 in the driver table 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: What are the driver IDs that are greater than or equal to 7, excluding those driver IDs that are not equal to 7 in the school bus records?

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


Question: Find the average first name, maximum advisor, maximum sex, maximum major, student ID, average age, and the count of last names for students, considering either male students, or students whose first name is not Eric, or students whose major is not 600, or students with an advisor greater than or equal to 7712, or students from NYC. Also, find the same information for students whose first name is not Lisa, or whose major is greater than 600, or who are not from WAS and have a student ID greater than or equal to 1029 and are not female, or whose advisor is less than or equal to 1121 and whose last name is Adams and are 26 years old.

AVG(Fname) MAX(Advisor) MAX(Sex) MAX(Major) StuID AVG(Age) COUNT(LName)

SELECT AVG(Fname), MAX(Advisor), MAX(Sex), MAX(Major), StuID, AVG(Age), COUNT(LName) FROM Student WHERE Sex = "M" OR Fname <> "Eric" AND "Major" != 600 OR "Advisor" >= 7712 OR city_code = "NYC" UNION ALL SELECT AVG(Fname), MAX(Advisor), MAX(Sex), MAX(Major), StuID, AVG(Age), COUNT(LName) FROM Student WHERE Fname <> "Lisa" OR "Major" > 600 OR city_code != "WAS" AND "StuID" >= 1029 AND Sex <> "F" OR "Advisor" <= 1121 AND LName = "Adams" AND "Age" = 26


Question: Which driver IDs are less than 3, or are not equal to 4, considering driver and school bus information?

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


Question: What are the document IDs for documents mailed to address IDs of 7 or greater, and also the document IDs for draft copies where the copy number is 5 or more and the document ID is 1 or greater, or the draft number is not 2?

SELECT document_id FROM Documents_Mailed WHERE "mailed_to_address_id" >= 7 UNION ALL SELECT document_id FROM Draft_Copies WHERE "copy_number" >= 5 AND "document_id" >= 1 OR "draft_number" != 2


Question: What are the driver IDs that are both greater than or equal to 4 and less than or equal to 10, considering only those IDs present in 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 <= 10


Question: For clubs, give me the count of locations, the club name, the sum of club IDs, and the count of descriptions.  Include clubs where the description isn't "A competitive tennis club." and the name isn't "Pen and Paper Gaming", or the location isn't "HHH", and group the results by club name, showing only those with more than one location and a sum of club IDs less than or equal to 2. Also, give me the same information for clubs where the description isn't "Venture capital fund for student business.", the name isn't "Bootup Baltimore", and the location isn't "AKW", grouped by club name, showing only those with less than one location or at least one description. Combine the results from both sets of criteria.

COUNT(ClubLocation) ClubName SUM(ClubID) COUNT(ClubDesc)

SELECT COUNT(ClubLocation), ClubName, SUM(ClubID), COUNT(ClubDesc) FROM Club WHERE ClubDesc != "A competitive tennis club." AND ClubName <> "Pen and Paper Gaming" OR ClubLocation <> "HHH" GROUP BY ClubName HAVING COUNT(ClubLocation) > 1 AND SUM(ClubID) <= 2 UNION SELECT COUNT(ClubLocation), ClubName, SUM(ClubID), COUNT(ClubDesc) FROM Club WHERE ClubDesc != "Venture capital fund for student business." AND ClubName != "Bootup Baltimore" AND ClubLocation != "AKW" GROUP BY ClubName HAVING COUNT(ClubLocation) < 1 OR COUNT(ClubDesc) >= 1


Question: What are the aircraft IDs that are not 3, and what is the aircraft ID that is 1, considering both the aircraft and airport_aircraft tables?

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


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

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


Question: What are the aircraft IDs that are both less than or equal to 2 in the aircraft table and less than 2 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 < 2


Question: What is the smallest company ID from companies that don't have 213 billion in assets, and also what is the smallest company ID from the employment table for company 13?

SELECT MIN(Company_ID) FROM company WHERE "Assets_in_Billion" <> 213.0 UNION SELECT MIN(Company_ID) FROM employment WHERE "Company_ID" = 13


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

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


Question: Which driver IDs are greater than 5 but not equal to 10, considering only those present in the driver table but not 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 != 10


Question: What are the aircraft IDs that are not equal to 2 and also have an ID greater than or equal to 5, considering both the aircraft and airport_aircraft tables?

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


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

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


Question: What are the hometowns of members with card number SLB51, a member ID greater than 8, and a name that is not Matt Lentz, as well as the hometowns of any member who does not live in Simpsonville, South Carolina?

SELECT Hometown FROM member WHERE Card_Number = "SLB51" AND "Member_ID" > 8 AND Name != "Matt Lentz" UNION SELECT Hometown FROM member WHERE Hometown <> "Simpsonville, South Carolina"


Question: What is the minimum airport ID and the company ID, grouped by ICAO, where the airport's IATA code is not "BLL" or the date is January 29, 1964, or the altitude is less than or equal to 3650.0, and the ICAO code is not "EBBR", and the airport ID is greater than 2, and the airport name is "Billund Airport", and the city is "Akureyri", and the company ID is less than 2, and the airport name is not "Ted Stevens Airport", and the IATA code is "BCN", and the vehicle flight number is "M2-F1 #61", or the velocity is greater than or equal to 240.0, and the airport ID is not 3, or the pilot is "Thompson" and the altitude is less than or equal to 3650.0, or the country is "Netherlands" and the ICAO code is "LEBL"?

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" GROUP BY ICAO HAVING City = "Akureyri" AND company_id < 2 AND name <> "Ted Stevens Airport" AND IATA = "BCN" AND Vehicle_Flight_number = "M2-F1 #61" OR Velocity >= 240.0 AND airport_id <> 3 OR Pilot = "Thompson" AND Altitude <= 3650.0 OR Country = "Netherlands" AND ICAO = "LEBL"


Question: What are the continent names and IDs, excluding those from America, and also the continent names and IDs for Europe where the ID is greater than 2?

SELECT Continent, ContId FROM continents WHERE Continent != "america" UNION ALL SELECT Continent, ContId FROM continents WHERE "ContId" > 2 AND Continent = "europe"


Question: Which driver IDs are present in both the driver and school bus tables, and are less than or equal to 9?

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


Question: What are the driver IDs less than 8 that are not also driver IDs greater than 10, considering only the driver and school bus tables?

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


Question: What are the aircraft IDs that are less than 3, or any aircraft IDs that are not equal to 1, considering both the aircraft and airport_aircraft tables?

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


Question: What are the driver IDs greater than 5 that are in the driver table but not in the school bus table, excluding any driver ID that is not equal to 3?

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


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

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


Question: What are the vehicle details, excluding "Van", and also the vehicle details for vehicles with an ID greater than 2?

SELECT vehicle_details FROM Vehicles WHERE vehicle_details <> "Van" UNION SELECT vehicle_details FROM Vehicles WHERE "vehicle_id" > 2


Question: Which driver IDs are either 6 or 9 or greater?

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


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

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


Question: Which driver IDs are present in both the driver and school bus tables, excluding driver ID 10, and where the driver ID is greater than or equal to 1?

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


Question: Which driver IDs are both greater than or equal to 5 and also not equal to 7, considering only those IDs present in both the driver and school bus tables?

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


Question: What are the driver IDs that are less than 3, excluding those driver IDs that are greater than 3?

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


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

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


Question: Which driver IDs are either less than or equal to 4, or greater than 4, considering driver and school bus information?

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


Question: What driver IDs are both equal to 4 and less than 7, considering 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: What are the aircraft IDs that are not 3 and also have an ID greater than or equal to 1 in the airport aircraft table?

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


Question: Which store IDs are not store ID 2 or in district ID greater than 11, and also which store IDs are less than or equal to 5?

SELECT Store_ID FROM store_district WHERE "Store_ID" != 2 OR "District_ID" > 11 UNION ALL SELECT Store_ID FROM store_district WHERE "Store_ID" <= 5


Question: Which driver IDs, excluding driver ID 9, are in the driver table, and which driver IDs, up to and including 3, are in the school bus table?

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


Question: What are the driver IDs that are either at least 5 in the driver table or at least 10 in the school bus table?

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


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

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: What is the total count of feature IDs, and what are those feature IDs, for burglar alarms that are not amenities?

SELECT SUM(T1.feature_id), T2.feature_id FROM Other_Available_Features as T1 JOIN Other_Property_Features as T2 ON T1.feature_id = T2.feature_id WHERE feature_type_code <> "Amenity" AND feature_description = "Burglar Alarm"


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

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


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

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


Question: What are the IDs of airports where the IATA code is BOS or the ICAO code is not KBOS and the name is Ted Stevens Airport, combined with the IDs of flights with an altitude of 3650?

SELECT id FROM airport WHERE IATA = "BOS" OR ICAO <> "KBOS" AND name = "Ted Stevens Airport" UNION SELECT id FROM flight WHERE "Altitude" = 3650.0


Question: What is the maximum value of 'other_details' in the 'Documents' table where the document type is "Hard Drive", 'other_details' is not "n", and the document status is not "working", or the receipt number is "61", or the shipping agent is "UP" and the document ID is less than or equal to 2, excluding the maximum value of 'other_details' from the 'Employees' table where the role code is not "PT", the employee ID is greater than 3, and the employee name is not "Erling", or 'other_details' is not "b"?

SELECT MAX(other_details) FROM Documents WHERE document_type_code = "Hard Drive" AND other_details <> "n" AND document_status_code <> "working" OR receipt_number = "61" OR shipping_agent_code = "UP" AND "document_id" <= 2 EXCEPT SELECT MAX(other_details) FROM Employees WHERE role_code <> "PT" AND "employee_id" > 3 AND employee_name <> "Erling" OR other_details != "b"


Question: What are the driver IDs that are greater than or equal to 2 and also appear in the school bus table, excluding driver ID 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: What are the aircraft IDs that are either less than or equal to 3 in the aircraft table, or not equal to 5 in the airport_aircraft table?

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


Question: What are the aircraft IDs that appear in the aircraft table with an ID of 1 or greater, but not in the airport_aircraft table with an ID less than 2?

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


Question: What are the descriptions of shipping agents that are not named "UPS" or have a code other than "UP"?

SELECT shipping_agent_description FROM Ref_Shipping_Agents WHERE shipping_agent_name <> "UPS" UNION SELECT shipping_agent_description FROM Ref_Shipping_Agents WHERE shipping_agent_code <> "UP"


Question: What are the aircraft IDs that are greater than or equal to 1 in the aircraft table, combined with the aircraft IDs that are less than or equal to 2 in the airport_aircraft table?

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


Question: What are the other details and average employee ID for employees who are not named Jordyn, have the role code "PT", have an employee ID less than 3, or have other details not equal to "b", combined with the other details and average employee ID for employees with other details equal to "h"?

SELECT other_details, AVG(employee_id) FROM Employees WHERE employee_name != "Jordyn" OR role_code = "PT" OR "employee_id" < 3 OR other_details != "b" UNION ALL SELECT other_details, AVG(employee_id) FROM Employees WHERE other_details = "h"


Question: Give me the mobile phone number, date of birth, date they became a customer, customer address ID, and first name for customers with ID 15 or a mobile phone number that isn't "1-197-686-2849x8761". Also, give me the same information for customers where the customer address ID is 13 or greater, or whose customer status code isn't "Bad Customer" and whose date of birth is "1998-09-18 04:45:01" and phone number is "1-875-045-0806" and amount outstanding is 9443.0, or whose email address isn't "asha.kilback@example.org", or whose first name isn't "Genevieve" and mobile phone number isn't "848-099-2095x785", or whose last name isn't "Tromp".

SELECT cell_mobile_phone_number, date_of_birth, date_became_customer, customer_address_id, first_name FROM Customers WHERE "customer_id" = 15 OR cell_mobile_phone_number != "1-197-686-2849x8761" UNION ALL SELECT cell_mobile_phone_number, date_of_birth, date_became_customer, customer_address_id, first_name FROM Customers WHERE "customer_address_id" >= 13 OR customer_status_code <> "Bad Customer" AND date_of_birth = "1998-09-18 04:45:01" AND phone_number = "1-875-045-0806" AND "amount_outstanding" = 9443.0 OR email_address <> "asha.kilback@example.org" OR first_name != "Genevieve" AND cell_mobile_phone_number != "848-099-2095x785" OR last_name != "Tromp"


Question: Which store IDs are not 1, and also which store IDs are 5 or greater?

SELECT Store_ID FROM store_district WHERE "Store_ID" != 1 UNION ALL SELECT Store_ID FROM store_product WHERE "Store_ID" >= 5


Question: What are the feature descriptions, average feature IDs, and counts of feature type codes, grouped by feature description, where the count of feature type codes is at least 1, or where the average feature ID is at least 3.0 or the count of feature type codes is greater than 1?

SELECT feature_description, AVG(feature_id), COUNT(feature_type_code) FROM Other_Available_Features GROUP BY feature_description HAVING COUNT(feature_type_code) >= 1 UNION ALL SELECT feature_description, AVG(feature_id), COUNT(feature_type_code) FROM Other_Available_Features GROUP BY feature_description HAVING AVG(feature_id) >= 3.0 OR COUNT(feature_type_code) > 1


Question: What are the advisor and student ID for students where the student ID is less than or equal to 1023 or the advisor is less than 1148 and not from NYC, combined with the advisor and student ID for students who are not from HKG and are 18 years old, or have an advisor greater than 8741 and are not male, or have a major of 600, or have a student ID not equal to 1014, or a last name that isn't Smith?

SELECT Advisor, StuID FROM Student WHERE "StuID" <= 1023 OR "Advisor" < 1148 AND city_code != "NYC" UNION SELECT Advisor, StuID FROM Student WHERE city_code <> "HKG" AND "Age" = 18 OR "Advisor" > 8741 AND Sex != "M" OR "Major" = 600 OR "StuID" != 1014 OR LName <> "Smith"