Question: What are the driver IDs that are less than or equal to 7, excluding those driver IDs that are not equal to 7 and are found in the school bus table?

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


Question: Which driver IDs are in the driver table but not in the school bus table, excluding driver ID 6 in the driver table and driver IDs less than 7 in the school bus table?

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


Question: What are the driver IDs that appear in either the driver table with IDs no greater than 2 or the school bus table with IDs less than 3?

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


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

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


Question: What are the price, book ID, publication ID, publication date, and publisher for publications that cost less than 3,000,000, are not published by Pearson, have a publication ID other than 1, and a book ID greater than 4, and also for publications that are not published by Springer Nature or were not published in March 2008?

SELECT Price, Book_ID, Publication_ID, Publication_Date, Publisher FROM publication WHERE "Price" < 3000000.0 AND Publisher != "Pearson" AND "Publication_ID" <> 1 AND "Book_ID" > 4 INTERSECT SELECT Price, Book_ID, Publication_ID, Publication_Date, Publisher FROM publication WHERE Publisher <> "Springer Nature" OR Publication_Date <> "March 2008"


Question: Which driver IDs are in either the driver table (excluding ID 10) or the school bus table (with IDs less than 7)?

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


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

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


Question: What are the driver IDs, excluding driver ID 5, and also the driver IDs up to and including 7, from the driver and school bus tables?

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: How many roles are there and what's the lowest role code, excluding roles that aren't "ED" and aren't "Proof Manager", combined with the count and lowest code for roles that are "MG" or aren't "Manager"?

SELECT COUNT(role_description), MIN(role_code) FROM Roles WHERE role_code != "ED" AND role_description != "Proof Manager" UNION SELECT COUNT(role_description), MIN(role_code) FROM Roles WHERE role_code = "MG" OR role_description <> "Manager"


Question: What are the IDs of drivers, excluding driver 11, who are also assigned to school buses and have a driver ID greater than 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: What are the aircraft IDs that appear in the aircraft table with an ID of 5 or greater, but not in the airport_aircraft table with an ID of 3 or less?

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


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

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


Question: What are the school IDs of schools that are not in "75 Starke" county, have an enrollment of 379 or less, are not in IHSAA Football Class "AAA", and are not in IHSAA Class "A", combined with the school IDs from the endowment table where the donor name is not "Com. Dom. En Estados Unidos", the school ID is not 7, and the donation amount is at least 9.83?

SELECT School_id FROM School WHERE County != "75 Starke" AND "Enrollment" <= 379 AND IHSAA_Football_Class != "AAA" AND IHSAA_Class <> "A" UNION ALL SELECT School_id FROM endowment WHERE donator_name <> "Com. Dom. En Estados Unidos" AND "School_id" != 7 AND "amount" >= 9.83


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

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


Question: What are the store and district IDs for stores with IDs less than 1, combined with the store and district IDs for stores that don't have an ID of 4?

SELECT Store_ID, District_ID FROM store_district WHERE "Store_ID" < 1 UNION SELECT Store_ID, District_ID FROM store_district WHERE "Store_ID" != 4


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


Question: What are the driver IDs that are either less than or equal to 10 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 <= 10 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 4


Question: For students, give me the sum of advisors, city codes, sum of student IDs, maximum major, average age, last names, count of first names, and sexes, either where the major is 600, the city code isn't NYC, the first name is George, or the advisor is less than 8721, or where the student ID is greater than 1015 or the age is 21 or older.

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

SELECT SUM(Advisor), city_code, SUM(StuID), MAX(Major), AVG(Age), LName, COUNT(Fname), Sex FROM Student WHERE "Major" = 600 OR city_code != "NYC" OR Fname = "George" OR "Advisor" < 8721 UNION ALL SELECT SUM(Advisor), city_code, SUM(StuID), MAX(Major), AVG(Age), LName, COUNT(Fname), Sex FROM Student WHERE "StuID" > 1015 OR "Age" >= 21


Question: Which driver IDs are either 5 or greater than 10, considering both driver and school bus records?

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


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

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


Question: What are the IDs of pets that are not pet ID 2002, excluding those with pet IDs greater than or equal to 2003 and student IDs greater than 1001?

SELECT PetID FROM Has_Pet WHERE "PetID" != 2002 EXCEPT SELECT PetID FROM Has_Pet WHERE "PetID" >= 2003 AND "StuID" > 1001


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

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


Question: What are the student IDs greater than 1001 who have pets, combined with the student IDs of students whose major is 600 or less, or whose sex is not male?

SELECT StuID FROM Has_Pet WHERE "StuID" > 1001 UNION SELECT StuID FROM Student WHERE "Major" <= 600 OR Sex != "M"


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

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


Question: What are the aircraft IDs that are present in both the aircraft and airport_aircraft tables, grouped by maximum gross weight, where the description is "Tandem rotor helicopter" and the aircraft is not "CH-47D Chinook" and the maximum disk loading is not "14.5 lb/ft² (71 kg/m²)" or the airport ID is less than 9?

SELECT T1.Aircraft_ID, T2.Aircraft_ID FROM aircraft as T1 JOIN airport_aircraft as T2 ON T1.Aircraft_ID == T2.Aircraft_ID GROUP BY Max_Gross_Weight HAVING Description = "Tandem rotor helicopter" AND Aircraft <> "CH-47D Chinook" AND Max_disk_Loading <> "14.5 lb/ft² (71 kg/m²)" OR Airport_ID < 9


Question: What are the building numbers, address IDs, and countries for addresses that are not in West Virginia and also for addresses that are not in Washington, or are in Lake Rafaela, not in zip code 22194, have an address ID less than 14, and are not in the USA?

SELECT line_1_number_building, address_id, country FROM Addresses WHERE state_province_county <> "WestVirginia" INTERSECT SELECT line_1_number_building, address_id, country FROM Addresses WHERE state_province_county <> "Washington" OR city = "Lake Rafaela" AND zip_postcode != "22194" AND "address_id" < 14 AND country != "USA"


Question: Which driver IDs are less than or equal to 1, but not greater than 3?

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


Question: Which driver IDs are 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: What are the aircraft IDs that are not 2 and also appear in the airport aircraft table with IDs less than or equal to 5?

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


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

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


Question: Which driver IDs are either less than or equal to 10 from the driver table, 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 driver IDs that are either less than or equal to 9 from the driver table or not equal to 9 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 <> 9


Question: What are the gold values for matches where Small_Silver is not 4, Points is not 89, and Big_Silver is greater than 7 and Gold is less than or equal to 5, or where Rank is 1 and Club_ID is at least 1? Also, what are the gold values for matches where Rank is less than or equal to 4, or where Small_Silver is not 10 and Big_Silver is greater than 9?

SELECT Gold FROM match_result WHERE "Small_Silver" <> 4 AND "Points" <> 89 AND "Big_Silver" > 7 AND "Gold" <= 5 OR "Rank" = 1 AND "Club_ID" >= 1 UNION SELECT Gold FROM match_result WHERE "Rank" <= 4 OR "Small_Silver" <> 10 AND "Big_Silver" > 9


Question: What are the driver IDs that are both greater than or equal to 1 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 >= 1 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 10


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

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


Question: What are the aircraft IDs greater than 3 that are present in both the aircraft and airport_aircraft tables?

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


Question: What states are in the AREA_CODE_STATE table but not in area code 724 or Florida, and also what states in the VOTES table have NY as the state and contestant number 5, but not phone number 5112677315, or a creation time other than "2018-03-09 19:03:21", or a vote ID that is not 3?

SELECT state FROM AREA_CODE_STATE WHERE "area_code" != 724 AND state <> "FL" UNION ALL SELECT state FROM VOTES WHERE state = "NY" AND "contestant_number" = 5 AND "phone_number" != 5112677315 OR created != "2018-03-09 19:03:21" OR "vote_id" <> 3


Question: What are the album IDs that are less than or equal to 136, and also the IDs of the "Metal" genre?

SELECT id FROM albums WHERE "id" <= 136 UNION ALL SELECT id FROM genres WHERE "id" = 11 AND name = "Metal"


Question: What are the driver IDs, excluding driver ID 6, and also the driver IDs from school buses that are 10 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 >= 10


Question: What are the driver IDs, excluding driver ID 2, 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 != 2 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 3


Question: How many companies have a market value less than or equal to 213.7 billion, or are named "Industrial and Commercial Bank of China", or have profits not equal to 20.1 billion and are not in the "Conglomerate" industry, or have assets of 1563.9 billion and have been working for a year or less, or have a people ID greater than 3, or have sales of 447.0 billion, or have headquarters not in China? Group these companies by their profits and show the count and people ID, but only include groups where sales are greater than or equal to 433.5 billion, or the year worked is greater than or equal to 1 and profits are greater than 21.5 billion, or the people ID is less than 4.

SELECT COUNT(T1.Market_Value_in_Billion), T2.People_ID FROM company as T1 JOIN employment as T2 ON T1.Company_ID = T2.Company_ID WHERE "Market_Value_in_Billion" <= 213.7 OR Name = "Industrial and Commercial Bank of China" OR "Profits_in_Billion" <> 20.1 AND Industry <> "Conglomerate" OR "Assets_in_Billion" = 1563.9 AND "Year_working" <= 1 OR "People_ID" > 3 OR "Sales_in_Billion" = 447.0 OR Headquarters <> "China" GROUP BY Profits_in_Billion HAVING Sales_in_Billion >= 433.5 OR Year_working >= 1 AND Profits_in_Billion > 21.5 OR People_ID < 4


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

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: Which driver IDs are either 6 or greater than or equal to 3, considering driver and school bus information?

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


Question: Which driver IDs are greater than 9, excluding those driver IDs equal to 9?

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


Question: What are the driver IDs, excluding driver ID 5, and also driver ID 7?

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


Question: What are the aircraft IDs that are less than or equal to 1, but not equal to 3, considering only the aircraft IDs present in the aircraft table and excluding those in the airport_aircraft table?

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


Question: Which branch IDs meet either of the following criteria: their membership amount is 7, or their opening year is not 2009 and their ID is greater than 6, or their name is not Alexandre and their city is not London; and also include all branch IDs from the membership register except for branch ID 1?

SELECT Branch_ID FROM branch WHERE membership_amount = "7" OR Open_year <> "2009" AND "Branch_ID" > 6 OR Name <> "Alexandre" AND City != "London" UNION ALL SELECT Branch_ID FROM membership_register_branch WHERE Branch_ID <> "1"


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

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: Which driver IDs are either less than or equal to 10 in the driver table, or equal to 3 in the school bus table?

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


Question: Show me the name, ID, age, and city of employees who are not named Tim Payne and are at least 30 years old, excluding those named Steve Borthwick who are 40 or younger, have an ID less than 3, and don't live in Wasps.

SELECT Name, Employee_ID, Age, City FROM employee WHERE Name <> "Tim Payne" AND "Age" >= 30 EXCEPT SELECT Name, Employee_ID, Age, City FROM employee WHERE Name = "Steve Borthwick" AND "Age" <= 40 AND "Employee_ID" < 3 AND City <> "Wasps"


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

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


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

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


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

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


Question: What are the template IDs and version numbers for templates where the effective date is not June 5, 2003, or the version number is 7 and the template ID is 15? Also, what are the template IDs and version numbers for templates where the template type code is not BK or the template details are empty? Combine both sets of results.

SELECT Template_ID, Version_Number FROM Templates WHERE Date_Effective_From != "2003-06-05 04:03:45" OR "Version_Number" = 7 AND "Template_ID" = 15 UNION ALL SELECT Template_ID, Version_Number FROM Templates WHERE Template_Type_Code != "BK" OR Template_Details = ""


Question: Which driver IDs are less than or equal to 8, or which driver IDs are greater than or equal to 9?

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


Question: 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: Which driver IDs are not equal to 4 and are not present in the school bus table with driver 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 document status codes for documents that are not shipped by FE and have other details marked as "y", or are of type "Paper" and not marked as "done"? Also, include the document status code "done" from the document status reference table.

SELECT document_status_code FROM Documents WHERE shipping_agent_code <> "FE" AND other_details = "y" OR document_type_code = "Paper" AND document_status_code != "done" UNION ALL SELECT document_status_code FROM Ref_Document_Status WHERE document_status_code = "done"


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 4 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 6, excluding driver ID 10?

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


Question: What are the driver IDs greater than 2, and also any driver IDs from school buses that are not 10?

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


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

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


Question: Show me the lesson details (status, ID, customer, price, time, staff, vehicle, and date) for lessons that were either cancelled and not at time 2 or had a staff ID greater than 8 or a lesson ID not equal to 2, combined with lessons that had a staff ID of 15 or more, or a lesson time of 9, or a lesson ID of 11 or more, or a status not completed, or a date of March 4, 2018, at 6:55:46, or a vehicle ID of 3 or more, or a price less than 184 and a customer ID greater than 9.

SELECT lesson_status_code, lesson_id, customer_id, price, lesson_time, staff_id, vehicle_id, lesson_date FROM Lessons WHERE lesson_status_code = "Cancelled" AND lesson_time != "2" OR "staff_id" > 8 OR "lesson_id" <> 2 UNION SELECT lesson_status_code, lesson_id, customer_id, price, lesson_time, staff_id, vehicle_id, lesson_date FROM Lessons WHERE "staff_id" >= 15 OR lesson_time = "9" AND "lesson_id" >= 11 OR lesson_status_code != "Completed" OR lesson_date = "2018-03-04 06:55:46" OR "vehicle_id" >= 3 OR "price" < 184.0 AND "customer_id" > 9


Question: Which driver IDs are not equal to 9, and which driver IDs are greater than or equal to 9, considering both drivers and school buses?

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


Question: What are the driver IDs that are both 4 or greater and also less than 9, 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 < 9


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

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


Question: What is the average rank and club ID for coaches where the rank is 5, the club ID is less than or equal to 1, or the coach name is not Smith Brown, combined with the average rank and club ID from match results where Big_Silver is less than or equal to 11 and Bronze is not 8?

SELECT AVG(Rank), Club_ID FROM coach WHERE "Rank" = 5 OR "Club_ID" <= 1 OR Coach_name <> "Smith Brown" UNION SELECT AVG(Rank), Club_ID FROM match_result WHERE "Big_Silver" <= 11 AND "Bronze" <> 8


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

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


Question: What is the sum of car IDs and the horsepower, grouped by car maker, for cars with more than 4 cylinders and horsepower not equal to 105 or acceleration greater than or equal to 18.0, further filtered to include only those with fewer than 6 cylinders and a year after 1970 or a country not equal to 1 or MPG not equal to 16 and engine displacement greater than 140.0 or a maker not equal to opel and a weight of 2904?

SELECT SUM(T1.Id), T2.Horsepower FROM car_makers as T1 JOIN cars_data as T2 ON T1.Id = T2.Id WHERE "Cylinders" > 4 AND Horsepower <> "105" OR "Accelerate" >= 18.0 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 driver IDs that are either greater than or equal to 6 from the driver table, or not equal to 4 from the school bus table?

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


Question: Which branch IDs meet at least one of these conditions: the branch ID is 7 or greater, the branch name is Taverner, the opening year is not 2014 and the address road is not Abbey Rise, or the branch ID is 6?

SELECT Branch_ID FROM branch WHERE "Branch_ID" >= 7 OR Name = "Taverner" OR Open_year <> "2014" AND Address_road != "Abbey Rise" UNION SELECT Branch_ID FROM purchase WHERE Branch_ID = "6"


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

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


Question: What are the aircraft IDs that are not 4, but are not present in the airport aircraft table with IDs less than 2?

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


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

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


Question: What are the school IDs of schools with ID "1" that are not associated with endowments where the endowment ID is not 1, or the school ID is 8 or greater, the donor is "Com. Dom. En Estados Unidos", and the amount is greater than 8.43?

SELECT School_id FROM School WHERE School_id = "1" EXCEPT SELECT School_id FROM endowment WHERE "endowment_id" != 1 OR "School_id" >= 8 AND donator_name = "Com. Dom. En Estados Unidos" AND "amount" > 8.43


Question: What is the average of the airport names that are "Bergen Airport" in Brussels or have IATA code "BGO" and not ICAO code "KBOS" or are in the United States and have an ID other than 4, intersecting with the average of operate company names that are not "Cathay Pacific Cargo"?

SELECT AVG(name) FROM airport WHERE name = "Bergen Airport" AND City = "Brussels" OR ICAO != "KBOS" AND IATA = "BGO" OR Country = "United States" AND "id" <> 4 INTERSECT SELECT AVG(name) FROM operate_company WHERE name != "Cathay Pacific Cargo"


Question: What are the aircraft IDs that are either greater than or equal to 3 in the aircraft table, or not equal to 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, that are at least 5, are in the driver table but not in the school bus table where driver IDs are at least 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 both greater than or equal to 6 and present in the driver table, and also less than 10 and present in the school_bus table?

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


Question: What is the sum of document IDs from document drafts where the ID is 20 or greater and the draft details are not "m", combined with the sum of document IDs from documents where the other details are not "w" and either the document status is not "done" or the receipt date is not "2015-04-03 09:36:19" and the shipping agent code is "FE"?

SELECT SUM(document_id) FROM Document_Drafts WHERE "document_id" >= 20 AND draft_details != "m" UNION SELECT SUM(document_id) FROM Documents WHERE other_details <> "w" AND document_status_code != "done" OR receipt_date <> "2015-04-03 09:36:19" AND shipping_agent_code = "FE"


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

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: Can you give me the driver IDs that appear exactly once in the driver table, specifically driver ID 1, but are not driver IDs less than or equal to 3 that appear exactly once in the school bus table?

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


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

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


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

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


Question: What is the smallest store ID that satisfies either an area size of 7.23 or less, a ranking of 9 or less and a store ID greater than 1, or a number of product categories not equal to 793, and also has a product ID that is not 1 and a store ID that is not 5?

SELECT MIN(Store_ID) FROM store WHERE "Area_size" <= 7.23 OR "Ranking" <= 9 AND "Store_ID" > 1 OR "Number_of_product_category" <> 793.0 INTERSECT SELECT MIN(Store_ID) FROM store_product WHERE "Product_ID" != 1 AND "Store_ID" != 5


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

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


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

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


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

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


Question: Can you give me the draft numbers from the circulation history where the draft number is 17 or higher, or the employee ID is not 2 and the document ID is 20, or the copy number is not 10, but excluding any draft numbers from the document drafts that have draft details of "e" or a draft number of 14?

SELECT draft_number FROM Circulation_History WHERE "draft_number" >= 17 OR "employee_id" <> 2 AND "document_id" = 20 OR "copy_number" != 10 EXCEPT SELECT draft_number FROM Document_Drafts WHERE draft_details = "e" OR "draft_number" = 14


Question: Can you give me a list of branch names from branches that either don't have a membership amount of 11 and aren't in London, or don't have the name Taverner, or have a Branch ID of 8 or greater, or aren't on Oaks Crescent, combined with a list of member names that are David Jones, or are not from Columbia, South Carolina and don't have a card number of MLB4, or don't have a Member ID of 10?

SELECT Name FROM branch WHERE membership_amount <> "11" AND City != "London" OR Name != "Taverner" OR "Branch_ID" >= 8 OR Address_road <> "Oaks Crescent" UNION SELECT Name FROM member WHERE Name = "David Jones" OR Hometown <> "Columbia, South Carolina" AND Card_Number <> "MLB4" OR "Member_ID" != 10


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

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


Question: Can you give me a list of driver IDs, including driver ID 5 from the driver table, and any driver IDs greater than or equal to 10 from the school_bus table?

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


Question: Can you list the driver IDs that are less than or equal to 4 from the driver table, and also include driver ID 10 from the school bus table?

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


Question: Which driver IDs, excluding driver ID 7, are in the driver table but not in the school_bus table, excluding driver ID 10?

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


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

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


Question: Can you give me a list of country IDs, including those from countries that are not on continent 1 or that have a country ID other than 5 and aren't named "italy", along with those from countries that are on continent 1 and have a country ID other than 14?

SELECT CountryId FROM countries WHERE "Continent" <> 1 OR "CountryId" != 5 AND CountryName <> "italy" UNION ALL SELECT CountryId FROM countries WHERE "Continent" = 1 AND "CountryId" <> 14


Question: Can you give me the airport ID, pilot, and ID from the flight table, combining two sets of results: the first set includes flights where the company ID is less than or equal to 9, or the airport ID is less than 9, or the flight number is "M2-F1 #64" and the pilot is "Thompson", or the ID is less than 12, the date is March 1, 1963, and the velocity is less than 240; and the second set includes flights where the altitude is less than or equal to 3650.0 and the date is July 16, 1965, or the ID is not equal to 10 and the company ID is not equal to 7, or the airport ID is greater than or equal to 4?

SELECT airport_id, Pilot, id FROM flight WHERE "company_id" <= 9 OR "airport_id" < 9 OR Vehicle_Flight_number = "M2-F1 #64" AND Pilot = "Thompson" OR "id" < 12 AND Date = "March 1, 1963" AND "Velocity" < 240.0 UNION ALL SELECT airport_id, Pilot, id FROM flight WHERE "Altitude" <= 3650.0 AND Date = "July 16, 1965" OR "id" != 10 AND "company_id" <> 7 OR "airport_id" >= 4


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

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


Question: Can you give me a list of driver IDs that are not 10 and are also greater than 7, considering only drivers and school buses?

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


Question: Can you give me a list of driver IDs, including those with the ID 5 from the driver table, and those with IDs up to 4 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 <= 4


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

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


Question: Can you give me the address details and IDs from the Addresses table that are not in the US and have an ID of 6 or less, but also are not in Italy and don't have an ID of 8?

SELECT address_details, address_id FROM Addresses WHERE address_details <> "US" AND "address_id" <= 6 INTERSECT SELECT address_details, address_id FROM Addresses WHERE address_details <> "IT" AND "address_id" != 8


Question: Could you give me the birth dates that appear in both of the following groups: people with an ID greater than 3 and a name that isn't "Roman Bragin", and people with a height that isn't 196 cm, or a name that is "Semen Poltavskiy" and an ID of 6 or greater, or a nationality that isn't "Russia", or a birth date of "August 8, 1986"?

SELECT Birth_Date FROM people WHERE "People_ID" > 3 AND Name != "Roman Bragin" INTERSECT SELECT Birth_Date FROM people WHERE "Height" != 196.0 OR Name = "Semen Poltavskiy" AND "People_ID" >= 6 OR Nationality != "Russia" OR Birth_Date = "August 8, 1986"


Question: Can you give me a list of aircraft IDs that are less than 3 when looking at the aircraft table, but also not equal to 2 when looking at the airport_aircraft table?

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


Question: Could you list the aircraft IDs, excluding aircraft ID 5, that appear in the aircraft table but not in the airport_aircraft table, also excluding aircraft ID 2 from the airport_aircraft table?

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


Question: Which aircraft IDs are both greater than or equal to 2 and present with an ID of 3?

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


Question: Can you give me a list of driver IDs that are greater than 2, and also include driver IDs from the school bus list that are 10 or higher?

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


Question: How many Boeing 767-400ER aircraft with a distance greater than 4103 have certificate ID 90873519, and what is that certificate ID?

SELECT COUNT(T1.aid), T2.eid FROM aircraft as T1 JOIN certificate as T2 ON T1.aid = T2.aid WHERE "distance" > 4103 AND "eid" = 90873519 AND name = "Boeing 767-400ER"


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

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


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

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


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

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


Question: Could you list all the Model IDs from the model list where the Model ID is less than 13, and also list all the Model IDs from the model list where the Maker is greater than 4?

SELECT ModelId FROM model_list WHERE "ModelId" < 13 UNION ALL SELECT ModelId FROM model_list WHERE "Maker" > 4


Question: Can you give me the IDs of aircraft that meet certain criteria, specifically, those from the aircraft table that either have an ID less than 5 and are heavy-lift helicopters with a total disk area not equal to "5,655 ft² (526 m²)", or have a max disk loading not equal to "8.8 lb/ft² (43 kg/m²)", or are not a "Robinson R-22", or have a max gross weight not equal to "73,500 lb (33,300 kg)", and also are present in the airport_aircraft table where the airport ID is not 6 and either the ID is greater than or equal to 3 or the aircraft ID is less than 1?

SELECT Aircraft_ID FROM aircraft WHERE "Aircraft_ID" < 5 AND Description = "Heavy-lift helicopter" AND Total_disk_area != "5,655 ft² (526 m²)" OR Max_disk_Loading != "8.8 lb/ft² (43 kg/m²)" OR Aircraft != "Robinson R-22" OR Max_Gross_Weight <> "73,500 lb (33,300 kg)" INTERSECT SELECT Aircraft_ID FROM airport_aircraft WHERE "Airport_ID" <> 6 AND "ID" >= 3 OR "Aircraft_ID" < 1


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

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


Question: What aircraft IDs are greater than or equal to 3, excluding those that are also greater than or equal to 1 in the airport aircraft table?

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


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

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


Question: Can you give me the departure date, airline ID, total distance, and destination for flights that either have an airline ID of 10 or greater, or depart on a date other than 04/12/2005 05:30, have a flight number of 346, originate in Chicago, arrive on a date other than 04/12/2005 03:18, and are destined for Boston, but exclude any flights where the distance is 5478 or greater, the origin is not Los Angeles, the airline ID is 3 or greater, or the departure date is not 04/12/2005 11:50, the arrival date is 04/12/2005 09:40, the destination is not Dallas, and the price is greater than 425.98?

departure_date aid SUM(distance) destination

SELECT departure_date, aid, SUM(distance), destination FROM flight WHERE "aid" >= 10 OR departure_date <> "04/12/2005 05:30" AND "flno" = 346 AND origin = "Chicago" AND arrival_date <> "04/12/2005 03:18" AND destination = "Boston" EXCEPT SELECT departure_date, aid, SUM(distance), destination FROM flight WHERE "distance" >= 5478 AND origin <> "Los Angeles" AND "aid" >= 3 OR departure_date != "04/12/2005 11:50" AND arrival_date = "04/12/2005 09:40" AND destination <> "Dallas" AND "price" > 425.98


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

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


Question: Which driver IDs are both not equal to 6 and less than or equal to 10?

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


Question: Can you give me a list of property IDs from the Other_Property_Features table where the property ID is not 7, the feature ID is greater than 3, and the property feature description is not "vitae", combined with a list of property IDs from the Properties table where either the date sold is not November 7th, 1997 at 8:22 PM, the vendor requested price is greater than 372652.2909, or a combination of other conditions related to buyer offered price, apartment features, field features, house features, property name, other property details, shop features, agreed selling price, room count, and property ID are met?

SELECT property_id FROM Other_Property_Features WHERE "property_id" <> 7 AND "feature_id" > 3 AND property_feature_description <> "vitae" UNION ALL SELECT property_id FROM Properties WHERE date_sold != "1997-11-07 20:22:05" AND "vendor_requested_price" > 372652.2909 OR "buyer_offered_price" <> 1.68 AND apt_feature_2 = "est" AND fld_feature_2 <> "None" AND hse_feature_1 = "None" OR property_name = "riverside" OR apt_feature_3 <> "None" OR other_property_details <> "None" OR shp_feature_3 <> "None" OR "agreed_selling_price" > 244353758.1824 OR hse_feature_2 != "None" OR "room_count" > 9 AND "property_id" <> 4 OR shp_feature_1 != "None" AND hse_feature_3 <> "None" OR fld_feature_1 <> "None" OR fld_feature_3 != "None"


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

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


Question: Can you list the address details and address IDs for all addresses, including those with "IE" as the address detail and those with any other address detail besides "DE"?

SELECT address_details, address_id FROM Addresses WHERE address_details = "IE" UNION SELECT address_details, address_id FROM Addresses WHERE address_details <> "DE"


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

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


Question: Can you list all the driver IDs, combining those from the driver table that aren't 4 with those from the school bus table that are 4 or less, removing any duplicates?

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: Which driver has an ID of 8, but does not have an ID of 7 in the school bus list?

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


Question: Could you give me a list of employee role codes, excluding those that are also role codes for "Proof Manager" roles, but only considering employees whose other details are not "f" or whose employee ID is less than 3 and whose name is Jordyn?

SELECT role_code FROM Employees WHERE other_details != "f" OR "employee_id" < 3 AND employee_name = "Jordyn" EXCEPT SELECT role_code FROM Roles WHERE role_description = "Proof Manager"


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

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


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

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


Question: Could you give me a list of document IDs from the circulation history where either the draft number is 2 or higher, the document ID is greater than 20, the employee ID is not 8, or the copy number is 4, combined with a list of document IDs from the documents table where the document status is overdue and the receipt date is September 15, 1976, at 7:24 PM, or where the other details are "r", the receipt number is not "8", the shipping agent code is "UP", the document type is not "Paper", or the document ID is less than 23?

SELECT document_id FROM Circulation_History WHERE "draft_number" >= 2 AND "document_id" > 20 OR "employee_id" != 8 OR "copy_number" = 4 UNION SELECT document_id FROM Documents WHERE document_status_code = "overdue" AND receipt_date = "1976-09-15 19:24:17" OR other_details = "r" AND receipt_number <> "8" AND shipping_agent_code = "UP" AND document_type_code != "Paper" OR "document_id" < 23


Question: Which driver IDs appear in both the driver list (excluding driver ID 6) and the school bus list (only including driver IDs greater than 7)?

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


Question: Can you give me a list of driver IDs from the driver table where the driver ID is 3 or greater, combined with a list of driver IDs from the school_bus table where the driver ID is exactly 3?

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


Question: What aircraft IDs, excluding ID 4, are present in the aircraft table but not in the airport_aircraft table, also excluding ID 3 from the airport_aircraft table?

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


Question: What is the total PetID and corresponding PetType for pets where either the StuID is less than or equal to 1001 or the pet's age is 3?

SELECT SUM(T1.PetID), T2.PetType FROM Has_Pet as T1 JOIN Pets as T2 ON T1.PetID = T2.PetID WHERE "StuID" <= 1001 OR "pet_age" = 3


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

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


Question: Which driver IDs are greater than 5 and also not equal to 9, considering drivers and school buses separately?

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


Question: Can you give me the occupation, residence, player ID, rank, and gender of players who either live in Thompson, or don't have a rank of 3rd, and whose Player ID is not 12, and whose sponsor is not Saint Boniface, or whose name is not Ross C. Martin, but only for those players whose Player ID is greater than 2?

Occupation Residence Player_ID Rank Gender

SELECT Occupation, Residence, Player_ID, Rank, Gender FROM player WHERE Residence = "Thompson" OR Rank != "3rd" AND "Player_ID" != 12 AND Sponsor_name <> "Saint Boniface" OR Player_name != "Ross C. Martin" INTERSECT SELECT Occupation, Residence, Player_ID, Rank, Gender FROM player WHERE "Player_ID" > 2


Question: Can you give me a list of driver IDs, excluding those equal to 4, that are greater than 6 and appear more than once in the driver table?

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


Question: Can you give me a list of aircraft IDs, up to and including 4, that exist in the aircraft table but not in the airport_aircraft table, excluding aircraft ID 2 from the airport_aircraft table?

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


Question: Can you give me the smallest People ID from the employment table where either the Company ID is not 15 or the Year working is 2 or more, combined with the smallest People ID from the people table where the name is not Tom Sheehey and the People ID is less than 4, or the age is less than 37?

SELECT MIN(People_ID) FROM employment WHERE "Company_ID" != 15 OR "Year_working" >= 2 UNION SELECT MIN(People_ID) FROM people WHERE Name != "Tom Sheehey" AND "People_ID" < 4 OR "Age" < 37


Question: Which driver IDs, excluding driver ID 9, are also driver IDs excluding driver ID 3, that are present in the school bus table?

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


Question: Could you list all the draft numbers from the Draft Copies table, including those where the document ID is greater than 23, the draft number is greater than 2, or the copy number is less than or equal to 15, and also including those where the document ID is not equal to 2 or the copy number is greater than or equal to 6?

SELECT draft_number FROM Draft_Copies WHERE "document_id" > 23 OR "draft_number" > 2 OR "copy_number" <= 15 UNION ALL SELECT draft_number FROM Draft_Copies WHERE "document_id" <> 2 OR "copy_number" >= 6


Question: Which driver IDs are greater than or equal to 4, but not greater than 4 and also present in the school bus driver list?

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


Question: Can you list all the aircraft IDs that are greater than or equal to 4 from the aircraft table, and also list all aircraft IDs that are greater than 2 from the airport_aircraft table, combining the two lists into one?

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


Question: Can you give me a list of driver IDs, where each ID is 11 or greater, but excluding any driver IDs that are also in the school bus table, unless that 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: Which driver has an ID of 9 and also drives a school bus, but not school bus number 3?

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


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

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


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

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


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

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


Question: Can you list the aircraft IDs that are greater than 3 when grouped in the aircraft table, and also list the aircraft IDs that are less than or equal to 2 when grouped in the airport_aircraft table?

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


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

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


Question: Which aircraft with ID 4 are not associated with any airport except those associated with aircraft ID 3?

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


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

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


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

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


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

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


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

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


Question: What aircraft IDs are greater than 1 and appear in the aircraft table, but not in the airport_aircraft table?

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


Question: How many customers made payments that weren't for $7440.34 and weren't made with a credit card, excluding customer ID 7, plus how many lessons were taught by staff other than staff ID 11 using vehicles other than vehicle ID 2 on dates other than March 6, 2018 at 9:48:51 PM with lesson IDs greater than 13, or at 9 AM?

SELECT COUNT(customer_id) FROM Customer_Payments WHERE "amount_payment" != 7440.34 AND payment_method_code != "Credit Card" AND "customer_id" <> 7 UNION SELECT COUNT(customer_id) FROM Lessons WHERE "staff_id" <> 11 AND "vehicle_id" <> 2 AND lesson_date != "2018-03-06 21:48:51" AND "lesson_id" > 13 OR lesson_time = "9"


Question: Can you give me a list of employee IDs, including those who have worked with document IDs greater than 1 and copy number 4 or higher, as well as those employees whose other details are "v" or whose role code is "PR"?

SELECT employee_id FROM Circulation_History WHERE "document_id" > 1 AND "copy_number" >= 4 UNION SELECT employee_id FROM Employees WHERE other_details = "v" OR role_code = "PR"


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

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


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

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


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

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


Question: Can you give me a list of aircraft IDs that are both greater than or equal to 4 in the aircraft table and not equal to 2 in the airport_aircraft table?

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


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

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


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

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


Question: Can you give me a list of driver IDs, first from the driver table excluding driver ID 2, and then from the school bus table including only driver IDs less than 3, removing any duplicates?

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


Question: Could you give me the IDs of books that have more than 4 issues and an ID of 1 or greater, excluding those book IDs that are in publications with a publication ID of 6 or greater?

SELECT Book_ID FROM book WHERE "Issues" > 4.0 AND "Book_ID" >= 1 EXCEPT SELECT Book_ID FROM publication WHERE "Publication_ID" >= 6


Question: Can you find the aircraft ID, name, and shortest distance for aircraft, first including those that aren't Boeing 757-300s with an ID up to 7 or a distance not equal to 2605, and then only showing the results that also include aircraft that aren't Boeing 737-800s or have an ID of 13 or greater?

SELECT aid, name, MIN(distance) FROM aircraft WHERE name <> "Boeing 757-300" AND "aid" <= 7 OR "distance" != 2605 INTERSECT SELECT aid, name, MIN(distance) FROM aircraft WHERE name != "Boeing 737-800" OR "aid" >= 13


Question: Which aircraft IDs, excluding aircraft ID 3, are also aircraft IDs, excluding aircraft ID 5, found at airports?

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


Question: Can you give me a list of driver IDs, including all driver IDs from the driver table that are not 6, and driver ID 4 from the school bus table?

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


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

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


Question: Can you give me the Club IDs for clubs that are either named "Pen and Paper Gaming" and have an ID greater than 4 and are not located in "AKW", or have a description different from "Refurbish computers; teach kids and adults about computer basics.", excluding the Club IDs of clubs where there's a member who isn't a Vice-President?

SELECT ClubID FROM Club WHERE "ClubID" > 4 AND ClubLocation <> "AKW" AND ClubName = "Pen and Paper Gaming" OR ClubDesc != "Refurbish computers; teach kids and adults about computer basics." EXCEPT SELECT ClubID FROM Member_of_club WHERE Position <> "Vice-President"


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

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


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

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


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

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


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

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


Question: Can you give me the ID of the driver who appears exactly once in the driver table, specifically with the ID 1, but is not a driver with any ID other than 9 in the school bus table?

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


Question: Can you find the common minimum district number, election ID, party, committee, and average counties represented from the election table where either the district is not 1, the committee is not "Ways and Means", the first elected year is not 2002, the counties represented is not "12.1 12A", and the election ID is less than or equal to 2, or the party is 1, or the delegate is not "Bobo, Elizabeth Elizabeth Bobo", and where either the district is not 2, the counties represented is not "12.1 12A", or the party is greater than 2 and the delegate is "Pendergrass, Shane E. Shane Pendergrass", or the committee is "Appropriations"?

SELECT MIN(District), Election_ID, Party, Committee, AVG(Counties_Represented) FROM election WHERE "District" <> 1 OR Committee != "Ways and Means" AND "First_Elected" != 2002.0 AND Counties_Represented != "12.1 12A" AND "Election_ID" <= 2 OR "Party" = 1 OR Delegate <> "Bobo, Elizabeth Elizabeth Bobo" INTERSECT SELECT MIN(District), Election_ID, Party, Committee, AVG(Counties_Represented) FROM election WHERE "District" <> 2 OR Counties_Represented != "12.1 12A" OR "Party" > 2 AND Delegate = "Pendergrass, Shane E. Shane Pendergrass" OR Committee = "Appropriations"


Question: Can you list all the driver IDs, including those from the driver table excluding ID 12 and those from the school bus table with IDs greater 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: Can you give me a list of road addresses for branches that either opened in 2014, or have a branch ID that is not 7 and are not located in London, along with a list of all branches located on Brampton Road?

SELECT Address_road FROM branch WHERE Open_year = "2014" OR "Branch_ID" != 7 AND City <> "London" UNION ALL SELECT Address_road FROM branch WHERE Address_road = "Brampton Road"


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

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


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

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


Question: Can you give me a list of all People IDs from the employment table, excluding ID 3, combined with a list of People IDs from the people table where the ID is greater than 2 and the person is either from the United States or their name isn't Reggie Lewis?

SELECT People_ID FROM employment WHERE "People_ID" != 3 UNION ALL SELECT People_ID FROM people WHERE "People_ID" > 2 AND Nationality = "United States" OR Name <> "Reggie Lewis"


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

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


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

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


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

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


Question: Which aircraft IDs are both greater than or equal to 1 and present in the aircraft table, and less than or equal to 3 and present 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 <= 3


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

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


Question: Could you list the Coach IDs from the coach table for all coaches who are not male or whose name is Joe Fabbri, and also include the Coach IDs from the player_coach table where the Coach ID is less than or equal to 3?

SELECT Coach_ID FROM coach WHERE Gender <> "M" OR Coach_name = "Joe Fabbri" UNION ALL SELECT Coach_ID FROM player_coach WHERE "Coach_ID" <= 3


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

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


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

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


Question: What are the aircraft IDs, starting from 1, that are present in the aircraft table but not in the airport_aircraft table, where only aircraft IDs starting from 3 are considered in the airport_aircraft table?

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


Question: Can you give me the age, home city, and name of drivers who meet both of these conditions: first, they must have a Driver ID less than 2 and belong to the "Dem" party, or be 30 years old, or have a name other than "Henry Genga" and a home city other than "Hartford"; and second, they must not be 46 years old, must live in "Bethel", must not belong to the "Dem" party, and must not be named "Timothy Ackert"?

SELECT Age, Home_city, Name FROM driver WHERE "Driver_ID" < 2 AND Party = "Dem" OR "Age" = 30 OR Name <> "Henry Genga" AND Home_city <> "Hartford" INTERSECT SELECT Age, Home_city, Name FROM driver WHERE "Age" != 46 AND Home_city = "Bethel" AND Party <> "Dem" AND Name <> "Timothy Ackert"


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

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


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

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

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


Question: Can you list the sponsor name, player ID, residence, occupation, votes, and gender for all players, combining those with a Player ID greater than 7, a rank other than 2nd, a gender other than male, and a name other than Jean Luc Bouché, with those who are ranked 2nd and are not named Pat Martin?

Sponsor_name Player_ID Residence Occupation Votes Gender

Brandon—Souris
1
Brandon
Locomotive Engineer
6055
M

Dauphin—Swan River—Marquette
4
Birtle
Retired
4914
M

Kildonan—St. Paul
6
Winnipeg
Self Employed / Consultant
12093
M

Provencher
8
Oakbank
Design Coordinator
4947
M

Selkirk—Interlake 10 Selkirk Retired 9506 F

Winnipeg North
12
Winnipeg
Parliamentarian
14097
F

Winnipeg South Centre
14
Winnipeg
Student
5490
F

SELECT Sponsor_name, Player_ID, Residence, Occupation, Votes, Gender FROM player WHERE "Player_ID" > 7 AND Rank != "2nd" AND Gender != "M" AND Player_name != "Jean Luc Bouché" UNION SELECT Sponsor_name, Player_ID, Residence, Occupation, Votes, Gender FROM player WHERE Rank = "2nd" AND Player_name <> "Pat Martin"


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

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


Question: What allergies are not of the environmental type and are also either not nuts or associated with student IDs less than or equal to 1030?

SELECT Allergy FROM Allergy_Type WHERE AllergyType <> "environmental" INTERSECT SELECT Allergy FROM Has_Allergy WHERE Allergy != "Nuts" OR "StuID" <= 1030


Question: What is the average employee ID and the employee ID for employees whose bonus is not $3000, considering both employee and evaluation information?

SELECT AVG(T1.Employee_ID), T2.Employee_ID FROM employee as T1 JOIN evaluation as T2 ON T1.Employee_ID = T2.Employee_ID WHERE "Bonus" <> 3000.0


Question: Can you give me a list of store IDs that are either in district 11 or sell products other than product 6, or are store ID 5?

SELECT Store_ID FROM store_district WHERE "District_ID" = 11 UNION SELECT Store_ID FROM store_product WHERE "Product_ID" <> 6 OR "Store_ID" = 5


Question: Can you give me a list of driver IDs that are less than 6, excluding any driver IDs that are also in the school bus list and are greater 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: What is the average district ID for districts where the city area is 75 and the district name is not Bhakkar District, or the headquarters city is not Bahawalnagar City, combined with the average district ID for store districts where the district ID is 3 or greater?

SELECT AVG(District_ID) FROM district WHERE "City_Area" = 75.0 AND District_name != "Bhakkar District" OR Headquartered_City <> "Bahawalnagar City" UNION SELECT AVG(District_ID) FROM store_district WHERE "District_ID" >= 3


Question: Can you give me a list of airport ICAO codes, including those from airports that are not in Baltimore, have an ID of 6 or less, or are not in Spain, as well as those that don't have the ICAO code LEBL or the IATA code BCN, combined with ICAO codes from airports in the Netherlands, or with the IATA code BLL, or with a name other than Schiphol Airport, or with an ID of 9 or more, or that don't have the ICAO code KBWI?

SELECT ICAO FROM airport WHERE City <> "Baltimore" AND "id" <= 6 AND Country != "Spain" OR ICAO != "LEBL" OR IATA <> "BCN" UNION SELECT ICAO FROM airport WHERE Country = "Netherlands" OR IATA = "BLL" OR name != "Schiphol Airport" OR "id" >= 9 OR ICAO != "KBWI"


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

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


Question: Which driver IDs are greater than 3 and also greater than or equal to 7, considering only unique driver IDs from both the driver and school_bus lists?

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


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

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: Can you give me a list of member IDs, including those of members who don't live in Jacksonville, Florida and have a level greater than 4, as well as those who made a purchase in 2018 or whose member ID is not 3?

SELECT Member_ID FROM member WHERE Hometown <> "Jacksonville, Florida" AND "Level" > 4 UNION SELECT Member_ID FROM purchase WHERE Year = "2018" OR "Member_ID" != 3


Question: Can you give me a list of driver IDs from the driver table that are less than 2, and also include driver ID 9 from the school bus table?

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


Question: Can you list the Aircraft IDs that are greater than 4 in the aircraft table, and also list the Aircraft IDs that equal 3 in the airport_aircraft table?

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


Question: Can you give me a list of aircraft IDs that appear in the aircraft table, excluding aircraft ID 5, but only if they don't also appear in the airport_aircraft table with an aircraft ID of 1 or less?

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


Question: Can you list all the aircraft IDs, including those from the aircraft table where the ID is less than or equal to 4, and those from the airport_aircraft table where the ID is not equal to 3?

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


Question: What aircraft IDs, excluding aircraft ID 2, are also aircraft IDs excluding aircraft ID 3 in the airport aircraft list?

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


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


Question: Could you list the store IDs from the store table, excluding Miramichi stores and including those with an area size greater than 179.84, a store ID less than 4, or a number of product categories not equal to 990, but then remove any store IDs that appear in the store_district table where the store ID is greater than 2 or the district ID is not 15?

SELECT Store_ID FROM store WHERE Store_Name <> "Miramichi" OR "Area_size" > 179.84 OR "Store_ID" < 4 OR "Number_of_product_category" <> 990.0 EXCEPT SELECT Store_ID FROM store_district WHERE "Store_ID" > 2 OR "District_ID" <> 15


Question: What aircraft IDs are both greater than or equal to 5 when grouped in the aircraft table, and greater than 3 when grouped in the airport_aircraft table?

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


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

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


Question: Can you tell me the name and the alphabetically last city for employees with IDs of 6 or higher, excluding those in Bath and named George Chuter, combined with the name and alphabetically last city for all employees not in Bath?

SELECT Name, MAX(City) FROM employee WHERE "Employee_ID" >= 6 AND City <> "Bath" AND Name <> "George Chuter" UNION SELECT Name, MAX(City) FROM employee WHERE City != "Bath"


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

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


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


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

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


Question: What is the sum of document IDs from the circulation history, excluding records where the draft number is 20 and employee ID is 8, or the document ID is not 1, or the copy number is less than 10, but not including the sum of document IDs from paper documents?

SELECT SUM(document_id) FROM Circulation_History WHERE "draft_number" <> 20 AND "employee_id" <> 8 OR "document_id" <> 1 OR "copy_number" < 10 EXCEPT SELECT SUM(document_id) FROM Documents WHERE document_type_code = "Paper"


Question: What are the home cities, driver IDs, parties, and ages of drivers with driver IDs of 10 or greater, combined with the home cities, driver IDs, parties, and ages of drivers who are not Democrats and live in Manchester, or whose names are not Matthew Ritter and are not 38 years old?

SELECT Home_city, Driver_ID, Party, Age FROM driver WHERE "Driver_ID" >= 10 UNION ALL SELECT Home_city, Driver_ID, Party, Age FROM driver WHERE Party <> "Dem" AND Home_city = "Manchester" OR Name <> "Matthew Ritter" AND "Age" != 38


Question: What are the driver IDs that are either less than or equal to 6 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 <= 6 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 4


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

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


Question: What are the IDs of endowments where the donor is not "San Cristóbal" and the endowment ID is not 1, combined with the IDs of endowments where the donor is "Valverde" or the school ID is greater than 8, the endowment ID is less than or equal to 3, and the amount is less than or equal to 8.53?

SELECT endowment_id FROM endowment WHERE donator_name != "San Cristóbal" AND "endowment_id" != 1 UNION SELECT endowment_id FROM endowment WHERE donator_name = "Valverde" OR "School_id" > 8 AND "endowment_id" <= 3 AND "amount" <= 8.53


Question: How many customers are there in total, considering those who didn't pay by Direct Debit or whose payment amount wasn't 9414.74 or with customer ID 14, and also those who didn't become customers on November 12, 2017 at 4:34:44 AM?

SELECT COUNT(customer_id) FROM Customer_Payments WHERE payment_method_code != "Direct Debit" OR "amount_payment" != 9414.74 OR "customer_id" = 14 UNION ALL SELECT COUNT(customer_id) FROM Customers WHERE date_became_customer <> "2017-11-12 04:34:44"


Question: What are the paragraph and document IDs for paragraphs where the document ID is less than or equal to 80 and the paragraph ID is less than or equal to 510442723, or the other details are "None"? Also, what are the paragraph and document IDs for paragraphs where the other details are "None" and the document ID is not 80, or the paragraph text is "Senegal"?

SELECT Paragraph_ID, Document_ID FROM Paragraphs WHERE "Document_ID" <= 80 AND "Paragraph_ID" <= 510442723 OR Other_Details = "None" UNION ALL SELECT Paragraph_ID, Document_ID FROM Paragraphs WHERE Other_Details = "None" AND "Document_ID" <> 80 OR Paragraph_Text = "Senegal"


Question: What are the driver IDs, excluding driver ID 10, from the driver table, and also the driver IDs greater than 7 from the school bus table?

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


Question: What are the driver IDs that are both greater than or equal to 9 and also not 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 >= 9 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 10


Question: Which driver IDs are less than 5 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 < 5 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 9


Question: Give me the details like features, price, address, and dates for properties that either have certain features not equal to "None" or meet specific price and type criteria, and also include properties where certain features are "None" or have specific sale dates or agreed prices, combining the results.

084 Lakin Vista Apt. 394
Fishertown, MA 16876

098 Tremaine Highway Suite 569
South Wilford, NJ 46587-3537

2088 Bashirian Fork Suite 337
Faustinoport, MT 16771-9320

092 Paucek Highway Apt. 772
East Erika, IA 61358

SELECT apt_feature_1, fld_feature_2, agreed_selling_price, property_name, shp_feature_1, hse_feature_2, property_address, date_sold, shp_feature_3, apt_feature_2, property_id, hse_feature_1, fld_feature_3, other_property_details, fld_feature_1, apt_feature_3, oth_feature_2, shp_feature_2, date_on_market, vendor_requested_price FROM Properties WHERE fld_feature_1 != "None" AND hse_feature_1 != "None" AND fld_feature_2 != "None" AND oth_feature_3 != "None" OR "vendor_requested_price" >= 305.0 AND apt_feature_2 <> "et" AND property_type_code = "House" AND apt_feature_3 != "None" OR fld_feature_3 != "None" UNION SELECT apt_feature_1, fld_feature_2, agreed_selling_price, property_name, shp_feature_1, hse_feature_2, property_address, date_sold, shp_feature_3, apt_feature_2, property_id, hse_feature_1, fld_feature_3, other_property_details, fld_feature_1, apt_feature_3, oth_feature_2, shp_feature_2, date_on_market, vendor_requested_price FROM Properties WHERE hse_feature_1 = "None" OR date_sold = "1997-01-07 19:52:45" OR "agreed_selling_price" != 3344706.5755 AND apt_feature_2 = "est"


Question: What are the player's name, sponsor name, occupation, votes, residence, and gender for players who live in Winnipeg, are not ranked 1st, are not male, are named Ross C. Martin, don't have 14355 votes, are not Locomotive Engineers, and have a Player ID of 10, and also for players who don't live in Birtle or are not sponsored by Winnipeg North, and have a Player ID less than or equal to 11?

Player_name Sponsor_name Occupation Votes Residence Gender

Fiona Shiells
Charleswood—St. James—Assiniboia
Ministerial Assistant
7190
Winnipeg
F

Jim Maloway
Elmwood—Transcona
Small Businessman
14355
Winnipeg
M

Judy Wasylycia-Leis
Winnipeg North
Parliamentarian
14097
Winnipeg
F

Matt Schaubroeck
Saint Boniface
Student
5502
Winnipeg
M

Mohamed Alli
Portage—Lisgar
Distribution Centre Associate
2353
Winnipeg
M

Pat Martin
Winnipeg Centre
Parliamentarian
12285
Winnipeg
M

Rachel Heinrichs
Winnipeg South Centre
Student
5490
Winnipeg
F

Ross Eadie
Kildonan—St. Paul
Self Employed / Consultant
12093
Winnipeg
M

Sean Robert
Winnipeg South
Product Consultant - MLCC
4673
Winnipeg
M

SELECT Player_name, Sponsor_name, Occupation, Votes, Residence, Gender FROM player WHERE Residence = "Winnipeg" OR Rank <> "1st" AND Gender != "M" AND Player_name = "Ross C. Martin" AND "Votes" != 14355 AND Occupation != "Locomotive Engineer" AND "Player_ID" = 10 INTERSECT SELECT Player_name, Sponsor_name, Occupation, Votes, Residence, Gender FROM player WHERE Residence <> "Birtle" OR Sponsor_name != "Winnipeg North" AND "Player_ID" <= 11


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 less than 10?

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


Question: What are the driver IDs that are greater than or equal to 1 and are not driver IDs from school buses that are not equal to 4?

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


Question: Which driver IDs are either 1 or 4 and above?

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


Question: What are the template type descriptions and codes, excluding those with code "BK" or description "Paper", but not including the template type with code "PP"?

SELECT Template_Type_Description, Template_Type_Code FROM Ref_Template_Types WHERE Template_Type_Code != "BK" AND Template_Type_Description <> "Paper" EXCEPT SELECT Template_Type_Description, Template_Type_Code FROM Ref_Template_Types WHERE Template_Type_Code = "PP"


Question: What are the driver IDs, excluding driver ID 6, and also the driver IDs that are less than or equal to 9, 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 <= 9


Question: What is the average city population and the district ID, considering districts where the sum of city area is 25, or the store ID is less than or equal to 4, or the headquartered city is not Chiniot City, or the district name is not Gujrat District, or the maximum city population is less than or equal to 1526168?

SELECT AVG(T1.City_Population), T2.District_ID FROM district as T1 JOIN store_district as T2 ON T1.District_ID = T2.District_ID WHERE SUM(City_Area) = 25.0 OR Store_ID <= 4 OR Headquartered_City <> "Chiniot City" OR District_name <> "Gujrat District" OR MAX(City_Population) <= 1526168.0


Question: Which driver IDs are less than 5 but not greater than 10, considering only those IDs present in the 'driver' table and excluding those in the 'school_bus' table?

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


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

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


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 5 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 9 and also not equal to 3, considering only the driver IDs present in both the driver and school bus tables?

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


Question: What are the club IDs, including club ID 2 and club IDs from members who are not in club 1, or have a student ID less than or equal to 1008, or are not Teaching Coordinators?

SELECT ClubID FROM Club WHERE "ClubID" = 2 UNION ALL SELECT ClubID FROM Member_of_club WHERE "ClubID" <> 1 OR "StuID" <= 1008 OR Position != "Teaching Coordinator"


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

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


Question: What are the driver IDs, excluding driver ID 5, and also any driver IDs that are 9 or greater, considering both driver and school bus information?

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


Question: What are the driver IDs greater than 8 that are present in both the driver and school bus tables, excluding driver ID 3 from the school bus table?

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


Question: What is the minimum club location, excluding clubs that refurbish computers and teach computer basics, and also excluding clubs that are not "Hopkins Student Enterprises" or are located in "AKW" or have a ClubID less than 2?

SELECT MIN(ClubLocation) FROM Club WHERE ClubDesc != "Refurbish computers; teach kids and adults about computer basics." IN (SELECT MIN(ClubLocation) FROM Club WHERE ClubDesc != "Refurbish computers; teach kids and adults about computer basics." AND ClubName != "Hopkins Student Enterprises" AND "ClubID" >= 2 OR ClubLocation <> "AKW")


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

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


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

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


Question: What are the document status codes for documents with an ID of 14 or higher, or a receipt number that isn't "19" and a status of "working", that are also not "overdue"?

SELECT document_status_code FROM Documents WHERE "document_id" >= 14 OR receipt_number != "19" AND document_status_code = "working" INTERSECT SELECT document_status_code FROM Ref_Document_Status WHERE document_status_code <> "overdue"


Question: Which aircraft are not a Mil Mi-26, or have a maximum gross weight different from 123,500 lb (56,000 kg), or have an Aircraft_ID of 3 but are not aircraft with a total disk area of 4,900 ft² (460 m²) and a maximum disk loading of 8.8 lb/ft² (43 kg/m²)?

SELECT Aircraft FROM aircraft WHERE Aircraft <> "Mil Mi-26" OR Max_Gross_Weight != "123,500 lb (56,000 kg)" OR "Aircraft_ID" = 3 NOT IN (SELECT Aircraft FROM aircraft WHERE Total_disk_area <> "4,900 ft² (460 m²)" AND Max_disk_Loading <> "8.8 lb/ft² (43 kg/m²)")


Question: What are the freight metric tonnes and aircraft IDs for each airport?

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


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

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


Question: What allergy types and allergies are neither soy nor animal allergies, and also have nuts as an allergy but are not environmental allergies?

SELECT AllergyType, Allergy FROM Allergy_Type WHERE Allergy != "Soy" AND AllergyType != "animal" INTERSECT SELECT AllergyType, Allergy FROM Allergy_Type WHERE Allergy = "Nuts" AND AllergyType <> "environmental"