Question: Can you give me a list of driver IDs, where one group includes all driver IDs from the driver table that are not equal to 2, and the other group includes all driver IDs from the school bus table that are less than or equal to 4?

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


Question: What are the average ModelId and the Model name from the model list, both for models with a ModelId greater than 12, and also for models that are not an "audi" or have a ModelId of 35 or greater and a Maker of 6 or greater?

SELECT AVG(ModelId), Model FROM model_list WHERE "ModelId" > 12 UNION SELECT AVG(ModelId), Model FROM model_list WHERE Model != "audi" OR "ModelId" >= 35 AND "Maker" >= 6


Question: Can you give me a list of driver IDs, combining those from the driver table, excluding driver ID 9, with those from the school bus table that are less 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 list the aircraft IDs that are greater than 3, and also list aircraft IDs from the airport aircraft that are less than or equal to 5?

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


Question: What is the highest allergy type and corresponding allergy for all allergies that are not food or are not milk, and also, separately, what is the highest allergy type and corresponding allergy for all allergies that are not food but are grass pollen?

SELECT MAX(AllergyType), Allergy FROM Allergy_Type WHERE AllergyType != "food" OR Allergy <> "Milk" UNION ALL SELECT MAX(AllergyType), Allergy FROM Allergy_Type WHERE AllergyType != "food" AND Allergy = "Grass Pollen"


Question: Can you list all the template type codes from the template types table where the description is not "Presentation" or the code is not "PP", and also list all the template type codes from the templates table where the effective end date is not "2006-02-06 23:52:04" or the template details are not empty, or where the effective start date is not "1975-10-20 02:28:58" and the template type code is "BK"?

SELECT Template_Type_Code FROM Ref_Template_Types WHERE Template_Type_Description <> "Presentation" OR Template_Type_Code != "PP" UNION ALL SELECT Template_Type_Code FROM Templates WHERE Date_Effective_To != "2006-02-06 23:52:04" OR Template_Details <> "" OR Date_Effective_From <> "1975-10-20 02:28:58" AND Template_Type_Code = "BK"


Question: Which driver IDs are both greater than 2 and also less than or equal to 7, appearing in both the driver and school_bus tables?

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


Question: What are the highest feature ID, the latest property feature description, and the property ID for properties that either aren't property ID 7 or have a property feature description of "quo" and a feature ID of 3, but only if those properties also have a property ID of 12 or less?

SELECT MAX(feature_id), MAX(property_feature_description), property_id FROM Other_Property_Features WHERE "property_id" != 7 OR property_feature_description = "quo" AND "feature_id" = 3 INTERSECT SELECT MAX(feature_id), MAX(property_feature_description), property_id FROM Other_Property_Features WHERE "property_id" <= 12


Question: Can you give me the total number of employees and their bonuses, grouped by name, excluding those who are 28 years old, and only including groups where the award year was 2016, the age is under 30, or the city isn't Bristol?

SELECT SUM(T1.Employee_ID), T2.Bonus FROM employee as T1 JOIN evaluation as T2 ON T1.Employee_ID = T2.Employee_ID WHERE "Age" <> 28 GROUP BY Name HAVING Year_awarded = "2016" OR Age < 30 OR City <> "Bristol"


Question: Can you give me the names of companies and their average sales in billions, considering companies where either the profits are not 26.9 billion or they are in the oil and gas industry and their ID is less than 9, but only if their average sales are exactly 82.6 billion? Also, include companies and their average sales where the company ID is 6, or they are not in the automotive industry, or their assets are 1873.9 billion, or their profits are not 21.5 billion, or their sales are at least 82.6 billion, but only if their average sales are less than 375.5 billion?

SELECT Name, AVG(Sales_in_Billion) FROM company WHERE "Profits_in_Billion" != 26.9 OR Industry = "Oil and gas" AND "Company_ID" < 9.0 GROUP BY Name HAVING AVG(Sales_in_Billion) = 82.6 UNION SELECT Name, AVG(Sales_in_Billion) FROM company WHERE "Company_ID" = 6.0 OR Industry != "Automotive" OR "Assets_in_Billion" = 1873.9 OR "Profits_in_Billion" <> 21.5 OR "Sales_in_Billion" >= 82.6 GROUP BY Name HAVING AVG(Sales_in_Billion) < 375.5


Question: Can you give me a list of driver IDs, where each ID is greater than 11, but excluding driver ID 9 if it's on the school bus list?

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: Can you give me a list of driver IDs less than 9 that are in the driver table but not in the school_bus table?

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


Question: Can you give me a list of aircraft IDs less than 4 that appear in the aircraft table, excluding those aircraft IDs less than 1 that appear in the airport_aircraft table?

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


Question: Which driver IDs, excluding driver ID 6, are not also driver ID 10 in the school bus list?

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


Question: Can you list all driver IDs less than 7 from both the driver and school bus tables, removing any duplicates?

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


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

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


Question: Can you list all the aircraft IDs, combining those from the aircraft table that aren't 1 with those from the airport_aircraft table that are 1 or greater?

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


Question: Can you give me the other details that are both from documents shipped by agent FE, not of type CD, and with document ID greater than 15, or with a status other than 'done', other details not equal to 'n', and a receipt date other than 2008-04-21 20:42:25, and also from employees who don't have the role 'MG' and whose name is Koby, or whose employee ID is greater than 1, or whose other details are not 'h'?

SELECT other_details FROM Documents WHERE shipping_agent_code = "FE" AND document_type_code <> "CD" AND "document_id" > 15 OR document_status_code != "done" AND other_details != "n" AND receipt_date != "2008-04-21 20:42:25" INTERSECT SELECT other_details FROM Employees WHERE role_code != "MG" AND employee_name = "Koby" OR "employee_id" > 1 OR other_details <> "h"


Question: Which driver has an ID of 4, but does not have an ID of 9 in the school bus list?

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


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

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


Question: What is the sum of role descriptions for roles that don't have the role code "ED", combined with the sum of role descriptions for roles that aren't "Photo"?

SELECT SUM(role_description) FROM Roles WHERE role_code <> "ED" UNION ALL SELECT SUM(role_description) FROM Roles WHERE role_description <> "Photo"


Question: Can you show me the phone number, highest contestant number, creation date, and earliest state from the votes, considering two sets of votes: first, where the contestant number is greater than 5, the vote ID is not 1, the state is NJ and the phone number is less than 5112677315, or the creation date is not March 9th, 2018 at 7:03 PM; and second, where the vote ID is at least 3, the phone number is less than 7148407040, or the state is not NY, combining the results of both sets?

SELECT phone_number, MAX(contestant_number), created, MIN(state) FROM VOTES WHERE "contestant_number" > 5 OR "vote_id" <> 1 OR state = "NJ " AND "phone_number" < 5112677315 OR created != "2018-03-09 19:03:21" UNION SELECT phone_number, MAX(contestant_number), created, MIN(state) FROM VOTES WHERE "vote_id" >= 3 OR "phone_number" < 7148407040 OR state != "NY"


Question: What are the smallest continent ID and the total continent value for continents with continent IDs less than 4, combined with the smallest continent ID and total continent value for continents with continent IDs greater than or equal to 5 or continents that are not 'asia'?

SELECT MIN(ContId), SUM(Continent) FROM continents WHERE "ContId" < 4 UNION SELECT MIN(ContId), SUM(Continent) FROM continents WHERE "ContId" >= 5 OR Continent <> "asia"


Question: Can you list the aircraft IDs, excluding aircraft ID 5, that are present in the aircraft table but not in the airport_aircraft table where the aircraft ID is less than 2?

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


Question: What is the total count of document IDs from document drafts that don't have draft details of "l", combined with the total count of document IDs from documents that are either "Paper" documents or are not "working" and also don't have a receipt number of "83" and a shipping agent code of "US"?

SELECT COUNT(document_id) FROM Document_Drafts WHERE draft_details <> "l" UNION SELECT COUNT(document_id) FROM Documents WHERE document_type_code = "Paper" OR document_status_code <> "working" AND receipt_number <> "83" AND shipping_agent_code <> "US"


Question: Can you give me the Club ID, location, and name for all clubs that are not located in AKW, or are named "Bootup Baltimore", and also have a Club ID that's not 2 and a description of "Refurbish computers; teach kids and adults about computer basics.", along with the Club ID, location, and name for all clubs located in HHH?

SELECT ClubID, ClubLocation, ClubName FROM Club WHERE ClubLocation <> "AKW" OR ClubName = "Bootup Baltimore" AND "ClubID" != 2 AND ClubDesc = "Refurbish computers; teach kids and adults about computer basics." UNION ALL SELECT ClubID, ClubLocation, ClubName FROM Club WHERE ClubLocation = "HHH"


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

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


Question: Can you give me a list of member IDs, including those from members with a level of 6 or higher, excluding member ID 7, and also including member IDs from the purchase table, excluding member ID 2?

SELECT Member_ID FROM member WHERE "Level" >= 6 AND "Member_ID" <> 7 UNION ALL SELECT Member_ID FROM purchase WHERE "Member_ID" <> 2


Question: Could you give me a list of contestant numbers and names, excluding contestant number 3 and Edwina Burnam, but then remove anyone from that list who isn't Ericka Dieter?

SELECT contestant_number, contestant_name FROM CONTESTANTS WHERE "contestant_number" <> 3 AND contestant_name <> "Edwina Burnam" EXCEPT SELECT contestant_number, contestant_name FROM CONTESTANTS WHERE contestant_name <> "Ericka Dieter"


Question: Can you give me a list of driver IDs, first from the driver table excluding driver ID 9, and then from the school bus table excluding driver ID 4?

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


Question: What aircraft IDs, excluding ID 3, are also aircraft IDs less than 5 that are associated with 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 that are less than 10 and also appear as driver IDs in the school bus table, excluding driver ID 9?

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


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


Question: Can you give me a list of all the driver IDs, excluding driver ID 10 from the driver table and excluding driver ID 4 from the school bus table, making sure to combine the two lists and remove any duplicates?

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


Question: Can you give me the IDs of drivers that are less than or equal to 9, excluding those driver IDs less than 9 that are also associated with school buses?

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


Question: Can you give me a list of driver IDs that are less than 11 from the driver table, excluding any driver IDs less than 7 that are also 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 from the driver table where each ID is less than or equal to 1, combined with a list of driver IDs from the school_bus table where each ID is not equal to 9?

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


Question: Could you give me the IDs of car makers named "Volkswagen" with an ID of 16, combined with the IDs of cars that have an ID of 46 but a horsepower that is not 180?

SELECT Id FROM car_makers WHERE FullName = "Volkswagen" AND "Id" = 16 UNION SELECT Id FROM cars_data WHERE "Id" = 46 AND Horsepower <> "180"


Question: Can you give me a list of aircraft IDs that are less than 4 and also appear in the list of aircraft IDs from the airport, excluding aircraft ID 3?

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


Question: Can you give me the Club ID, Rank, Gold, Small Silver, and Big Silver for match results where the Small Silver is greater than 10, but only if those same values also appear in match results where Bronze is 6, Points are at least 89, Rank is 1, Club ID is at least 1, and either Gold is not 13 or Small Silver is not 4?

SELECT Club_ID, Rank, Gold, Small_Silver, Big_Silver FROM match_result WHERE "Small_Silver" > 10 INTERSECT SELECT Club_ID, Rank, Gold, Small_Silver, Big_Silver FROM match_result WHERE "Bronze" = 6 AND "Points" >= 89 AND "Rank" = 1 AND "Club_ID" >= 1 AND "Gold" <> 13 OR "Small_Silver" <> 4


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

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


Question: Can you give me the sum of city codes, the minimum sex, the age, and the average student ID for students, combining two sets of results: one set where the advisor number is 1121 or higher, the sex is not male, the first name is not Linda, the major is 520 and the last name is not Brown and the city code is not CHI, or the student ID is greater than 1006; and another set where the major is 600, the city code is not PHL, the last name is Epp, the advisor number is 1148 or lower, and the age is not 20?

SELECT SUM(city_code), MIN(Sex), Age, AVG(StuID) FROM Student WHERE "Advisor" >= 1121 OR Sex <> "M" OR Fname != "Linda" OR "Major" = 520 AND LName != "Brown" AND city_code <> "CHI" OR "StuID" > 1006 UNION SELECT SUM(city_code), MIN(Sex), Age, AVG(StuID) FROM Student WHERE "Major" = 600 AND city_code != "PHL" AND LName = "Epp" AND "Advisor" <= 1148 AND "Age" <> 20


Question: Which aircraft IDs are not equal to 5 and are also equal to 2 in the airport aircraft table?

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


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

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


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

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


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

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


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

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


Question: How many continents are not continent ID 1 or named "america", plus how many countries are not named "italy" and are on continent ID 1?

SELECT COUNT(Continent) FROM continents WHERE "ContId" != 1 OR Continent <> "america" UNION SELECT COUNT(Continent) FROM countries WHERE CountryName <> "italy" AND "Continent" = 1


Question: Can you give me a list of branch IDs that either have a membership amount not equal to 56 or opened in 2009 or have a branch ID of 1, combined with a list of branch IDs from the membership register that have a member ID of 4 or a branch ID of 5 and a register year not equal to 2016?

SELECT Branch_ID FROM branch WHERE membership_amount <> "56" OR Open_year = "2009" OR "Branch_ID" = 1 UNION SELECT Branch_ID FROM membership_register_branch WHERE "Member_ID" = 4 OR Branch_ID = "5" AND Register_Year <> "2016"


Question: Can you show me the Club ID, Small Silver, Gold, Big Silver, Bronze, Rank, and Points from the match results for clubs where Big Silver is 12 or less, the Club ID is 1 or greater, Points are not 66, Bronze is 8 or greater, and Small Silver is not 9, combined with the same information for clubs where Small Silver is not 6, or Bronze is 6 or less and the Club ID is greater than 1, or Rank is not 5 and Big Silver is 9 or less, or Gold is 5, or Points are 168?

SELECT Club_ID, Small_Silver, Gold, Big_Silver, Bronze, Rank, Points FROM match_result WHERE "Big_Silver" <= 12 AND "Club_ID" >= 1 AND "Points" != 66 AND "Bronze" >= 8 AND "Small_Silver" <> 9 UNION SELECT Club_ID, Small_Silver, Gold, Big_Silver, Bronze, Rank, Points FROM match_result WHERE "Small_Silver" <> 6 OR "Bronze" <= 6 AND "Club_ID" > 1 OR "Rank" != 5 AND "Big_Silver" <= 9 OR "Gold" = 5 OR "Points" = 168


Question: Can you list all the role descriptions, including those that aren't "Editor" and don't have the role code "ED", combined with those that have the role code "MG" or aren't "Photo"?

SELECT role_description FROM Roles WHERE role_description != "Editor" AND role_code <> "ED" UNION SELECT role_description FROM Roles WHERE role_code = "MG" OR role_description <> "Photo"


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

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


Question: Can you list all the aircraft IDs, first from the aircraft table excluding aircraft ID 3, and then from the airport_aircraft table including only aircraft IDs greater than or equal to 1?

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


Question: Can you give me the IDs of players named Ron Strynadka, or those who are not retired, or those who don't live in Winnipeg and didn't receive 5490 votes, excluding the IDs of players who were coached by someone with an ID less than 1 starting after 2012?

SELECT Player_ID FROM player WHERE "Player_ID" <> 11 AND Player_name = "Ron Strynadka" OR Occupation != "Retired" OR Residence != "Winnipeg" AND "Votes" != 5490 EXCEPT SELECT Player_ID FROM player_coach WHERE "Coach_ID" < 1 AND "Starting_year" > 2012


Question: What is the average album ID for albums with an artist ID greater than 22, and what is the average genre ID for genres with an ID less than 11?

SELECT AVG(id) FROM albums WHERE "artist_id" > 22 UNION ALL SELECT AVG(id) FROM genres WHERE "id" < 11


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

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


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

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 the vote ID, phone number, and earliest state for votes where the contestant number is 5 or less, or the vote ID is 5 or greater and the state isn't California and the phone number isn't 7148407040, or the vote was created on March 9, 2018 at 7:03:40 PM, but exclude any votes where the phone number is 6209222712 or less and the state isn't California, or the vote ID is greater than 5?

SELECT vote_id, phone_number, MIN(state) FROM VOTES WHERE "contestant_number" <= 5 OR "vote_id" >= 5 AND state != "CA" AND "phone_number" != 7148407040 OR created = "2018-03-09 19:03:40" EXCEPT SELECT vote_id, phone_number, MIN(state) FROM VOTES WHERE "phone_number" <= 6209222712 AND state != "CA" OR "vote_id" > 5


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

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


Question: Can you give me the total maker value, ID, and country for car makers that are either American Motor Company and from country 1 with an ID less than or equal to 1, or not Triumph and not from country 4?

SELECT SUM(Maker), Id, Country FROM car_makers WHERE Country = "1" AND "Id" <= 1 AND FullName = "American Motor Company" UNION SELECT SUM(Maker), Id, Country FROM car_makers WHERE FullName <> "Triumph" OR Country != "4"


Question: Could you give me the maximum maker name, the sum of full names, the count of countries, and the ID for car makers that are Chrysler, not Volkswagen, with an ID of 3 or greater and a country that isn't "3", excluding those that are Renault or have an ID of 13?

MAX(Maker) SUM(FullName) COUNT(Country) Id

SELECT MAX(Maker), SUM(FullName), COUNT(Country), Id FROM car_makers WHERE "Id" >= 3 AND Country != "3" AND Maker = "chrysler" AND FullName != "Volkswagen" EXCEPT SELECT MAX(Maker), SUM(FullName), COUNT(Country), Id FROM car_makers WHERE Maker = "renault" OR "Id" = 13


Question: Could you give me a list of airport and flight IDs, including airports with the IATA code "ANC", those located in Spain, airports that aren't named "Akureyri Airport", airports with the ICAO code "ENBR", or airports whose ID is not 3, as well as flights with the vehicle flight number "M2-F1 #64", flights with a velocity of 240 or greater, flights where the pilot isn't "Peterson" and the company ID is less than 5, or flights with an altitude of 3650 or greater?

SELECT id FROM airport WHERE IATA = "ANC" OR Country = "Spain" OR name != "Akureyri Airport" OR ICAO = "ENBR" OR "id" <> 3 UNION SELECT id FROM flight WHERE Vehicle_Flight_number = "M2-F1 #64" OR "Velocity" >= 240.0 OR Pilot <> "Peterson" AND "company_id" < 5 OR "Altitude" >= 3650.0


Question: Can you give me a list of driver IDs from the driver table that are 8 or greater, excluding any driver IDs that also appear in the school_bus table, unless that driver ID is 10?

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


Question: Can you give me a list of member IDs, including those from the member table who are not level 6 or are not member ID 4, and also those from the purchase table who made purchases at branch 1 or whose total pounds spent was not 343.76 and are not member ID 6?

SELECT Member_ID FROM member WHERE "Level" != 6 OR "Member_ID" != 4 UNION SELECT Member_ID FROM purchase WHERE Branch_ID = "1" OR "Total_pounds" != 343.76 AND "Member_ID" != 6


Question: Could you give me the Incorporated_in location, ID, type, principal activities, group equity shareholding, and name for operating companies that meet two sets of criteria: first, they are not incorporated in Hong Kong and their principal activities are not cargo airline, or their ID is not 11, their group equity shareholding is less than 49%, and their type is not subsidiary; and second, they are not incorporated in Hong Kong and their name is not Vogue Laundry Service Limited?

Canada
14
Joint Venture
Catering services
30.0
CLS Catering Services Limited

China
1
Corporate
Airline
18.77
Air China

Taiwan
12
Joint Venture
Laundry
45.0
China Pacific Laundry Services

Vietnam
13
Joint Venture
Catering services
40.0
VN/CX Catering Services Limited

SELECT Incorporated_in, id, Type, Principal_activities, Group_Equity_Shareholding, name FROM operate_company WHERE Incorporated_in <> "Hong Kong" AND Principal_activities != "Cargo airline" OR "id" <> 11 AND "Group_Equity_Shareholding" < 49.0 AND Type <> "Subsidiary" INTERSECT SELECT Incorporated_in, id, Type, Principal_activities, Group_Equity_Shareholding, name FROM operate_company WHERE Incorporated_in <> "Hong Kong" AND name != "Vogue Laundry Service Limited"


Question: Could you list the district IDs that meet two conditions: first, they are from districts that are not named "Chakwal District" and are not headquartered in "Kasur City", or have a District ID less than 14 and a city population of 113524 or less; and second, they are also district IDs in the store district table that are not equal to 11 and have a store ID greater than 2?

SELECT District_ID FROM district WHERE District_name != "Chakwal District" AND Headquartered_City != "Kasur City" OR "District_ID" < 14 AND "City_Population" <= 113524.0 INTERSECT SELECT District_ID FROM store_district WHERE "District_ID" <> 11 AND "Store_ID" > 2


Question: Can you list the aircraft IDs that appear in the aircraft table, excluding aircraft ID 3, but then remove any of those IDs that also appear in the airport_aircraft table with an aircraft ID of 5 or greater?

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


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

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


Question: Can you give me a list of driver IDs, including those from the driver table excluding driver ID 9, and those from the school_bus table with driver IDs less 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: Could you list the name, group equity shareholding, type, place of incorporation, and principal activities for all companies except Air Hong Kong, where the company name is Cathay Pacific Catering Services (HK) Limited and its type is Subsidiary, or it's not incorporated in China, or its principal activities aren't Cargo, and the ID is less than 7, and the Group Equity Shareholding isn't 40.0, excluding those where the name is Air Hong Kong, the ID isn't 4, and the Group Equity Shareholding is 45.0?

Air China Cargo
49.0
Joint Venture
China
Cargo airline

Air Hong Kong
60.0
Joint Venture
Hong Kong
Cargo airline

CLS Catering Services Limited
30.0
Joint Venture
Canada
Catering services

Cathay Pacific Cargo
100.0
Subsidiary
Hong Kong
Cargo airline

Cathay Pacific Catering Services (HK) Limited

Cathay Pacific Holidays
100.0
Subsidiary
Hong Kong
Travel agency

Cathay Pacific Services Limited
100.0
Subsidiary
Hong Kong
Cargo

China Pacific Laundry Services
45.0
Joint Venture
Taiwan
Laundry

Dragonair
100.0
Subsidiary
Hong Kong
Airline

Dragonair Holidays
100.0
Subsidiary
Hong Kong
Travel agency

Hong Kong Airport Services
100.0
Subsidiary
Hong Kong
Ground handling

VN/CX Catering Services Limited
40.0
Joint Venture
Vietnam
Catering services

Vogue Laundry Service Limited
100.0
Subsidiary
Hong Kong
Laundry

SELECT name, Group_Equity_Shareholding, Type, Incorporated_in, Principal_activities FROM operate_company WHERE name = "Cathay Pacific Catering Services (HK) Limited" AND Type = "Subsidiary" OR Incorporated_in <> "China" OR Principal_activities != "Cargo" AND "id" < 7 AND "Group_Equity_Shareholding" <> 40.0 EXCEPT SELECT name, Group_Equity_Shareholding, Type, Incorporated_in, Principal_activities FROM operate_company WHERE name = "Air Hong Kong" AND "id" != 4 AND "Group_Equity_Shareholding" = 45.0


Question: Can you give me a list of aircraft IDs, excluding aircraft ID 1, that appear more than once, and then remove any aircraft IDs from that list that also appear in the airport aircraft table with an ID greater than 3?

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 a list of document IDs from the Documents table where the document type is not "CD", the shipping agent is not "UP", and the receipt number is "189", or where the other details are not "h", combined with a list of document IDs from the Documents_Mailed table where the mailing date is not "1973-02-21 10:17:01" and the document ID is 12, or the mailed to address ID is greater than 0?

SELECT document_id FROM Documents WHERE document_type_code <> "CD" AND shipping_agent_code != "UP" AND receipt_number = "189" OR other_details != "h" UNION SELECT document_id FROM Documents_Mailed WHERE mailing_date <> "1973-02-21 10:17:01" AND "document_id" = 12 OR "mailed_to_address_id" > 0


Question: Can you show me the budget invested percentage, year, school ID, invested amount, total budgeted percentage, budgeted amount, and total invested percentage from the budget table, including all records where either the budgeted amount is greater than 3666 and the total budgeted percentage is not 2.0, or the budget invested percentage is not 228.6 and the total invested percentage is greater than or equal to 2.0, combined with all records where the year is not 1999, or the invested amount is less than or equal to 5840, or the budget invested percentage is not 42.9, or the total budgeted percentage is less than 1.3?

SELECT Budget_invested_percent, Year, School_id, Invested, total_budget_percent_budgeted, Budgeted, total_budget_percent_invested FROM budget WHERE "Budgeted" > 3666 AND "total_budget_percent_budgeted" != 2.0 OR Budget_invested_percent != "228.6" AND "total_budget_percent_invested" >= 2.0 UNION ALL SELECT Budget_invested_percent, Year, School_id, Invested, total_budget_percent_budgeted, Budgeted, total_budget_percent_invested FROM budget WHERE "Year" <> 1999 OR "Invested" <= 5840 OR Budget_invested_percent <> "42.9" OR "total_budget_percent_budgeted" < 1.3


Question: Can you tell me the average interface, pages per minute in color, and product name for products where the maximum page size is A4, or the product isn't ScanShell 3000DN and the DPI isn't 600, or the product ID isn't 4 and the dimensions are 300 x 50 x 45, or the interface isn't USB 2.0 and the pages per minute in color isn't 28, combined with the average interface, pages per minute in color, and product name for products where the product isn't Xerox Travel Scanner 100 and the pages per minute in color is greater than 3, or the interface is USB 2.0 and the maximum page size is 216mm x 355mm, or the dimensions are 303 x 94 x 60 and the product ID is less than or equal to 4 and the DPI is greater than or equal to 600?

SELECT pages_per_minute_color, AVG(interface), product FROM product WHERE max_page_size = "A4" OR product != "ScanShell 3000DN" AND "dpi" != 600.0 OR "product_id" <> 4 AND dimensions = "300 x 50 x 45" OR interface <> "USB 2.0" AND "pages_per_minute_color" != 28.0 UNION ALL SELECT pages_per_minute_color, AVG(interface), product FROM product WHERE product != "Xerox Travel Scanner 100" AND "pages_per_minute_color" > 3.0 OR interface = "USB 2.0" AND max_page_size = "216mm x 355mm" OR dimensions = "303 x 94 x 60" AND "product_id" <= 4 AND "dpi" >= 600.0


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


Question: Can you list the driver IDs from the driver table that are less than or equal to 5, and combine that with a list of driver IDs from the school_bus table that are greater than 4, removing any duplicates?

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


Question: Can you give me the Member ID, Card Number, and Level for all members who either live in Simpsonville, South Carolina and have a Member ID less than 1, or whose Level is not 6, or whose Card Number is not RT91, combined with the Member ID, Card Number, and Level for members named Micah Johnson who have a Card Number of LT98?

SELECT Member_ID, Card_Number, Level FROM member WHERE Hometown = "Simpsonville, South Carolina" AND "Member_ID" < 1 OR "Level" != 6 OR Card_Number <> "RT91" UNION SELECT Member_ID, Card_Number, Level FROM member WHERE Name = "Micah Johnson" AND Card_Number = "LT98"


Question: Can you list all the political parties from the election table, excluding those where the delegate is Warren E. Miller, and including only those with a first election year of 1994 or later, a party value of 1 or less, counties represented as "12.2 12B", or membership on the Appropriations committee, combined with all parties from the party table that are not "Independence" and have a year of 1998 or earlier?

SELECT Party FROM election WHERE Delegate != "Miller, Warren E. Warren E. Miller" AND "First_Elected" >= 1994.0 AND "Party" <= 1 OR Counties_Represented = "12.2 12B" OR Committee = "Appropriations" UNION ALL SELECT Party FROM party WHERE Party <> "Independence" AND "Year" <= 1998.0


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

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


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

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


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 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 appear in the driver table, excluding driver ID 4, but also excluding any driver IDs that appear in the school_bus table with an ID of 4 or less?

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 the aircraft IDs that are both greater than or equal to 2 and not equal to 3, considering 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 <> 3


Question: Can you give me the IDs of drivers that are less than or equal to 1, excluding the IDs of school bus drivers that are greater than or 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: Can you list the aircraft IDs, first from the aircraft table excluding aircraft ID 5, and then from the airport_aircraft table including only aircraft IDs that are 5 or greater?

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


Question: Can you give me a list of driver IDs that appear in both the driver table and the school bus table, where the driver ID is not 10 in the driver table and is less than or equal to 3 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 <= 3


Question: Can you give me the driver IDs that are both less than or equal to 10 and appear in the driver table, and also less than 4 and appear in the school bus table?

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


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

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


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

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


Question: Can you give me a list of driver IDs from the driver table where the driver ID is greater than 3, combined with a list of driver IDs from the school bus table where the driver ID is greater than or equal to 10?

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


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

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: Could you give me the total ClubID and individual ClubID for clubs, considering only clubs that are not located in HHH or are named "Tennis Club" and where the position is not "Teaching Coordinator"?

SELECT SUM(T1.ClubID), T2.ClubID FROM Club as T1 JOIN Member_of_club as T2 ON T1.ClubID = T2.ClubID WHERE ClubLocation <> "HHH" OR ClubName = "Tennis Club" AND Position <> "Teaching Coordinator"


Question: Can you give me a list of driver IDs, combining those from the driver table excluding ID 5, with those from the school bus table that are 3 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 >= 3


Question: Can you show me a combined list of property details, including fld_feature_1 and fld_feature_3, the minimum apt_feature_2 and shp_feature_2, the property address and name, shp_feature_3, counts of hse_feature_3 and buyer_offered_price, sums of agreed_selling_price and date_sold, oth_feature_3, other_property_details, oth_feature_1, hse_feature_1, the average date_on_market and shp_feature_1, and the minimum vendor_requested_price, from the Properties table, first for properties where the agreed selling price isn't 2794972.2495, the vendor requested price isn't 2573.0, fld_feature_2 and fld_feature_3 are not "None", or shp_feature_1 is "None", and then for properties where oth_feature_2 and oth_feature_3 are not "None", apt_feature_3 is "None" and the property name is not "high line", shp_feature_3 is "None", apt_feature_1 is "fuga", or oth_feature_1 is "None"?

24365 Ulices Run
Homenicktown, MD 88485-6198

24365 Ulices Run
Homenicktown, MD 88485-6198

SELECT fld_feature_1, MIN(apt_feature_2), property_address, property_name, shp_feature_3, COUNT(hse_feature_3), SUM(agreed_selling_price), SUM(date_sold), oth_feature_3, other_property_details, oth_feature_1, hse_feature_1, MIN(shp_feature_2), AVG(date_on_market), COUNT(buyer_offered_price), AVG(shp_feature_1), MIN(vendor_requested_price), fld_feature_3 FROM Properties WHERE "agreed_selling_price" <> 2794972.2495 OR "vendor_requested_price" != 2573.0 OR fld_feature_2 != "None" AND fld_feature_3 != "None" OR shp_feature_1 = "None" UNION ALL SELECT fld_feature_1, MIN(apt_feature_2), property_address, property_name, shp_feature_3, COUNT(hse_feature_3), SUM(agreed_selling_price), SUM(date_sold), oth_feature_3, other_property_details, oth_feature_1, hse_feature_1, MIN(shp_feature_2), AVG(date_on_market), COUNT(buyer_offered_price), AVG(shp_feature_1), MIN(vendor_requested_price), fld_feature_3 FROM Properties WHERE oth_feature_2 != "None" AND oth_feature_3 != "None" OR apt_feature_3 = "None" AND property_name != "high line" OR shp_feature_3 = "None" OR apt_feature_1 = "fuga" OR oth_feature_1 = "None"


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

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


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

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


Question: Can you give me the minimum school ID, years working, count of full-time status, and driver ID for school bus drivers who have worked more than 6 years and have a driver ID of 7 or less, excluding those where the school ID is less than 1, or the driver ID is not 10 and they are not full-time, or they have worked 8 or more years?

SELECT MIN(School_ID), Years_Working, COUNT(If_full_time), Driver_ID FROM school_bus WHERE "Years_Working" > 6 AND "Driver_ID" <= 7 EXCEPT SELECT MIN(School_ID), Years_Working, COUNT(If_full_time), Driver_ID FROM school_bus WHERE "School_ID" < 1 OR "Driver_ID" <> 10 AND If_full_time <> "F" OR "Years_Working" >= 8


Question: Can you give me a list of driver IDs, where each ID is greater than 7, but not equal to 9, and the driver ID is present in the driver table but not in the school_bus table?

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


Question: Can you list all allergies that are not animal-related or are specifically rodent allergies, and also include cat allergies from a separate list?

SELECT Allergy FROM Allergy_Type WHERE AllergyType <> "animal" OR Allergy = "Rodent" UNION ALL SELECT Allergy FROM Has_Allergy WHERE Allergy = "Cat"


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

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


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

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


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

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


Question: Can you give me a list of driver IDs that are greater than 9, but not including any driver IDs that are greater than or equal to 3 and also appear in the school bus list?

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


Question: Which student IDs, that are less than 1002 and have pets, are also student IDs of students who don't live in Hong Kong?

SELECT StuID FROM Has_Pet WHERE "StuID" < 1002 INTERSECT SELECT StuID FROM Student WHERE city_code <> "HKG"


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

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


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

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


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

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


Question: Could you give me a list of player IDs, including those of female players with ID 14 who aren't named Fiona Shiells, and also those from the player_coach table with ID 2 who didn't start in 2010?

SELECT Player_ID FROM player WHERE Gender = "F" AND "Player_ID" = 14 AND Player_name != "Fiona Shiells" UNION SELECT Player_ID FROM player_coach WHERE "Player_ID" = 2 AND "Starting_year" <> 2010


Question: Can you give me the IDs of drivers with an ID of 1 or less, excluding those drivers who also have an ID of 9 or greater 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 show me the Book ID, number of Issues, Title, and Writer for all books, excluding those titled "Sheva's War" with more than 4 issues or those not written by Dave Gibbons, but including books with a Book ID other than 6, or a title other than "Michael Moorcock's Multiverse" where the writer is not Timothy Truman, or those with 9 or more issues?

SELECT Book_ID, Issues, Title, Writer FROM book WHERE "Book_ID" <> 6 OR Title <> "Michael Moorcock's Multiverse" AND Writer <> "Timothy Truman" OR "Issues" >= 9.0 EXCEPT SELECT Book_ID, Issues, Title, Writer FROM book WHERE Title = "Sheva's War" AND "Issues" > 4.0 OR Writer != "Dave Gibbons"


Question: Can you give me the names of companies that either have a Company ID greater than 18, or are not headquartered in the UK and have profits over 21.5 billion, a market value of 227.6 billion or less, are not in the banking industry, are named Berkshire Hathaway, and have sales of 110.8 billion, or have assets of at least 213 billion, along with the names of people who have a People ID of 1 or greater, did not graduate from Iowa, and are not United States citizens?

SELECT Name FROM company WHERE "Company_ID" > 18.0 OR Headquarters <> "UK" AND "Profits_in_Billion" > 21.5 AND "Market_Value_in_Billion" <= 227.6 AND Industry <> "Banking" AND Name = "Berkshire Hathaway" AND "Sales_in_Billion" = 110.8 OR "Assets_in_Billion" >= 213.0 UNION ALL SELECT Name FROM people WHERE "People_ID" >= 1 AND Graduation_College != "Iowa" AND Nationality != "United States"


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

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


Question: Which aircraft IDs are both greater than 3 and present in the aircraft table, and also greater than 1 and present in the airport_aircraft table?

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


Question: Can you give me a list of all the driver IDs, combining those from the driver table excluding driver ID 8, and those from the school bus table that are less than 10?

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


Question: Could you list the Election IDs from the election table where either the Election ID is 8 or the Counties Represented is not "12.1 12A", and also list the Election IDs where the District is not 2, or the First Elected year is after 2003 and Counties Represented is "09.1 9A", or the Party is less than 1?

SELECT Election_ID FROM election WHERE "Election_ID" = 8 OR Counties_Represented <> "12.1 12A" UNION ALL SELECT Election_ID FROM election WHERE "District" != 2 OR "First_Elected" > 2003.0 AND Counties_Represented = "09.1 9A" OR "Party" < 1


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

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


Question: Could you list the driver IDs that are both less than or equal to 12 in the driver table and less than or equal to 7 in the school_bus table?

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


Question: What are the average total pounds and member IDs for purchases, considering two scenarios: first, purchases from branch 1 excluding the year 2017 where the member ID is greater than 2 and the total pounds is exactly 232.09; and second, purchases where either the total pounds is not 20.99 or the member ID is 2?

SELECT AVG(Total_pounds), Member_ID FROM purchase WHERE Year <> "2017" AND Branch_ID = "1" AND "Member_ID" > 2 AND "Total_pounds" = 232.09 UNION SELECT AVG(Total_pounds), Member_ID FROM purchase WHERE "Total_pounds" != 20.99 OR "Member_ID" = 2


Question: Can you give me a list of member IDs from the member table where the level is greater than 6, or the member ID is less than or equal to 7 and the name is not Micah Johnson and the card number is not MLB4, or the hometown is not Fort Campbell, Kentucky, combined with a list of member IDs from the membership_register_branch table where the member ID is 3?

SELECT Member_ID FROM member WHERE "Level" > 6 OR "Member_ID" <= 7 AND Name != "Micah Johnson" AND Card_Number <> "MLB4" OR Hometown <> "Fort Campbell, Kentucky" UNION ALL SELECT Member_ID FROM membership_register_branch WHERE "Member_ID" = 3


Question: Which aircraft have an ID of 2 and are also associated with airports, but not with an airport that has an ID of 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: Can you list the driver IDs that are less than 6 from the driver table, combined with the driver IDs that are greater than 9 from the school bus table, removing any duplicates?

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


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

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


Question: Can you list the draft number, document ID, and copy number for all circulation history entries where the document ID is 20 or greater and the copy number is less than 10, combined with the draft number, document ID, and copy number for all draft copies where the document ID is 2 or less and the copy number is 5 or greater?

SELECT draft_number, document_id, copy_number FROM Circulation_History WHERE "document_id" >= 20 AND "copy_number" < 10 UNION SELECT draft_number, document_id, copy_number FROM Draft_Copies WHERE "document_id" <= 2 AND "copy_number" >= 5


Question: Can you give me a list of driver IDs that are not 12 and are also driver IDs of school buses where those IDs are at least 3?

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


Question: Can you give me the driver ID that appears exactly once with the value 8 in the driver table, but does not appear with any value other than 4 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 != 4


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

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


Question: Can you give me the payment amount, date and time, and payment method for all customer payments, excluding those payments where the payment method is not "Direct Debit" or the customer ID is not 14, but including payments that either didn't happen on "2018-03-20 21:38:41" or were for customer ID 3?

SELECT amount_payment, datetime_payment, payment_method_code FROM Customer_Payments WHERE datetime_payment <> "2018-03-20 21:38:41" OR "customer_id" = 3 EXCEPT SELECT amount_payment, datetime_payment, payment_method_code FROM Customer_Payments WHERE payment_method_code != "Direct Debit" OR "customer_id" <> 14


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

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


Question: Can you list the other details and document IDs for documents where the description is not "u" or the other details are not "None", combined with the other details and document IDs for paragraphs where the document ID is less than 2394 or the paragraph text is not "Jersey"?

SELECT Other_Details, Document_ID FROM Documents WHERE Document_Description != "u" OR Other_Details != "None" UNION SELECT Other_Details, Document_ID FROM Paragraphs WHERE "Document_ID" < 2394 OR Paragraph_Text != "Jersey"


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

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


Question: Which aircraft IDs are both greater than 4 in the aircraft table and greater than 1 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 > 1


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

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


Question: Can you give me a list of document IDs from the Document_Drafts table where the ID is less than or equal to 2, combined with a list of document IDs where the ID is greater than 13?

SELECT document_id FROM Document_Drafts WHERE "document_id" <= 2 UNION SELECT document_id FROM Document_Drafts WHERE "document_id" > 13


Question: Can you list the aircraft IDs from the aircraft table, but only those less than or equal to 4, along with the aircraft IDs from the airport_aircraft table, excluding those that are equal to 2?

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


Question: 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, excluding driver ID 3, that are not also driver IDs greater than 4 found in the school bus table?

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


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

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


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


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

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


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

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


Question: Can you give me a list of driver IDs, excluding driver ID 1, and combine it with a list of school bus driver IDs, excluding driver ID 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 give me a list of driver IDs that are both greater than or equal to 8 and not equal to 7, considering only the driver IDs that appear in both the driver and school_bus tables?

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


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

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


Question: Can you give me the country, zip code, city, state, largest address ID, and building number for all addresses that are both in the USA and either in the USA or have the building number "535 Ariel Brook"?

USA
43988
West Edmondview
Kentucky
15
9260 Streich Mountain

SELECT country, zip_postcode, city, state_province_county, MAX(address_id), line_1_number_building FROM Addresses WHERE country = "USA" INTERSECT SELECT country, zip_postcode, city, state_province_county, MAX(address_id), line_1_number_building FROM Addresses WHERE country = "USA" OR line_1_number_building = "535 Ariel Brook"


Question: Can you give me a list of all aircraft IDs from the certificate table where the ID is less than or equal to 5 and not equal to 142519864, combined with a list of aircraft IDs from the flight table where the arrival date is not "04/12/2005 09:40"?

SELECT aid FROM certificate WHERE "aid" <= 5 AND "eid" <> 142519864 UNION SELECT aid FROM flight WHERE arrival_date != "04/12/2005 09:40"


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

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 give me a list of all Driver IDs, combining those from the driver table excluding ID 11 with those from the school_bus table excluding ID 3?

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


Question: Can you give me the other details, employee name, and employee ID for all employees, excluding those with a role code other than "PT" or other details equal to "b", but including those with a role code other than "MG", or whose name is "Erling" and other details are not "b", or whose employee ID is less than or equal to 8?

SELECT other_details, employee_name, employee_id FROM Employees WHERE role_code <> "MG" OR employee_name = "Erling" AND other_details != "b" OR "employee_id" <= 8 EXCEPT SELECT other_details, employee_name, employee_id FROM Employees WHERE role_code <> "PT" OR other_details = "b"


Question: What is the highest customer ID and corresponding customer status code for customers who either paid with direct debit on "2018-02-15 16:38:49", have the phone number "1-875-045-0806" and email address "myrl.lind@example.net", became a customer on "2015-06-24 03:50:04" and paid an amount less than or equal to 1708.18, have the first name "Estelle", cell phone number "(630)964-2426" and a customer address ID not equal to 13, or have a date of birth of "1996-11-07 05:30:55"?

SELECT MAX(T1.customer_id), T2.customer_status_code FROM Customer_Payments as T1 JOIN Customers as T2 ON T1.customer_id = T2.customer_id WHERE payment_method_code = "Direct Debit" AND datetime_payment = "2018-02-15 16:38:49" OR phone_number = "1-875-045-0806" AND email_address = "myrl.lind@example.net" OR date_became_customer = "2015-06-24 03:50:04" AND amount_payment <= 1708.18 OR first_name = "Estelle" AND cell_mobile_phone_number = "(630)964-2426" AND customer_address_id <> 13 OR date_of_birth = "1996-11-07 05:30:55"


Question: What are the aircraft IDs that are not equal to 1 and 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: Can you give me a list of driver IDs, combining those from the driver table excluding driver ID 10 with those from the school bus table excluding driver ID 7, removing any duplicates?

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


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

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


Question: Can you list all the aircraft IDs from the aircraft table, excluding aircraft ID 2, and combine that with a list of aircraft IDs from the airport_aircraft table that are less than 2, removing any duplicates?

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


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

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


Question: Which clubs named "Gefle IF" do not have coaches other than Robert Chen, or coaches with a rank greater than 3?

SELECT Club_ID FROM club WHERE Club_name = "Gefle IF" EXCEPT SELECT Club_ID FROM coach WHERE Coach_name != "Robert Chen" OR "Rank" <= 3


Question: Can you give me a list of driver IDs, up to and including 6, that are in the driver table but not in the school_bus table, where only driver IDs less than 3 are considered in the school_bus table?

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


Question: Can you list all the aircraft IDs, excluding aircraft ID 4, and also list all aircraft IDs less than 2 from the airport aircraft list?

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 employee IDs from the employee table, excluding those employees who either have an ID of 9 or don't live in Sale, but then remove any IDs that also appear in the hiring table where the ID is 4 or the start date isn't 2008 and they aren't full-time?

SELECT Employee_ID FROM employee WHERE "Employee_ID" != 9 OR City <> "Sale" EXCEPT SELECT Employee_ID FROM hiring WHERE "Employee_ID" = 4 OR Start_from != "2008" AND Is_full_time != "T"


Question: Can you give me a list of driver IDs that are greater than 11 from the driver table, combined with a list of driver IDs that are greater than 9 from the school bus table, removing any duplicates?

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


Question: Could you list the vehicle IDs from lessons that either cost something other than $495, have a vehicle ID less than 1, a lesson time other than "5", and a cancelled status, or have a customer ID other than 2 and a lesson ID greater than 3, combined with the vehicle IDs from vehicles that have an ID of 3 or greater and are not trucks?

SELECT vehicle_id FROM Lessons WHERE "price" != 495.0 AND "vehicle_id" < 1 AND lesson_time <> "5" AND lesson_status_code = "Cancelled" AND "staff_id" <> 1 OR "customer_id" != 2 AND "lesson_id" > 3 UNION ALL SELECT vehicle_id FROM Vehicles WHERE "vehicle_id" >= 3 AND vehicle_details != "Truck"


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

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


Question: Could you give me the text, document ID, paragraph ID, and other details from paragraphs that either don't contain the text "Fiji" and have a document ID less than or equal to 651512, or have a paragraph ID greater than or equal to 16615, or have other details that are not "None", but only for those paragraphs that also have a paragraph ID greater than 9946?

SELECT Paragraph_Text, Document_ID, Paragraph_ID, Other_Details FROM Paragraphs WHERE Paragraph_Text <> "Fiji" AND "Document_ID" <= 651512 OR "Paragraph_ID" >= 16615 OR Other_Details <> "None" INTERSECT SELECT Paragraph_Text, Document_ID, Paragraph_ID, Other_Details FROM Paragraphs WHERE "Paragraph_ID" > 9946


Question: Can you give me the maximum Company ID, the average Industry value, the count of Sales in Billion, the count of company names, the minimum Headquarters value, the Profits in Billion, the average Assets in Billion, and the count of Market Value in Billion for companies meeting certain criteria, but excluding those that meet another set of criteria? The first set of criteria includes companies with Profits in Billion greater than or equal to 15.9 and Company ID greater than or equal to 15.0, where the Industry is not Banking, or Headquarters is in the USA and the name is not Petrobras, and Sales in Billion is less than or equal to 87.6, or Market Value in Billion is less than or equal to 178.7, or Assets in Billion equals 2039.1. The second set of criteria includes companies where the Industry is Conglomerate and Assets in Billion is less than 292.5, and Sales in Billion is not 102.0, or Headquarters is not in the UK, or Company ID is greater than 19.0, or Profits in Billion is less than 19.0.

SELECT MAX(Company_ID), AVG(Industry), COUNT(Sales_in_Billion), COUNT(Name), MIN(Headquarters), Profits_in_Billion, AVG(Assets_in_Billion), COUNT(Market_Value_in_Billion) FROM company WHERE "Profits_in_Billion" >= 15.9 AND "Company_ID" >= 15.0 AND Industry != "Banking" OR Headquarters = "USA" AND Name <> "Petrobras" AND "Sales_in_Billion" <= 87.6 OR "Market_Value_in_Billion" <= 178.7 OR "Assets_in_Billion" = 2039.1 EXCEPT SELECT MAX(Company_ID), AVG(Industry), COUNT(Sales_in_Billion), COUNT(Name), MIN(Headquarters), Profits_in_Billion, AVG(Assets_in_Billion), COUNT(Market_Value_in_Billion) FROM company WHERE Industry = "Conglomerate" AND "Assets_in_Billion" < 292.5 AND "Sales_in_Billion" != 102.0 OR Headquarters <> "UK" OR "Company_ID" > 19.0 OR "Profits_in_Billion" < 19.0


Question: Can you give me a list of all the driver IDs, including those from the driver table where the ID is 1 or greater, and those from the school bus table where the ID is not 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 give me the average decor score, the lowest bed type, and the base price for rooms that either have fewer than one bed and aren't decorated in a modern style, or have a queen bed, or are named "Mendicant with cryptic", or have a base price not equal to 175, combined with the average decor score, the lowest bed type, and the base price for rooms that either have a RoomId other than "AOB", or aren't decorated in a rustic style and don't have a max occupancy of 2, or are named "Abscond or bolster" and don't have a King bed type?

SELECT AVG(decor), MIN(bedType), basePrice FROM Rooms WHERE "beds" < 1 AND decor <> "modern" OR bedType = "Queen" OR roomName = "Mendicant with cryptic" OR "basePrice" != 175 UNION SELECT AVG(decor), MIN(bedType), basePrice FROM Rooms WHERE RoomId <> "AOB" OR decor <> "rustic" AND "maxOccupancy" != 2 OR roomName = "Abscond or bolster" AND bedType != "King"


Question: Can you list the Club IDs, the lowest Gold value, and the Small Silver value for match results where the Points are 139 or less, the Rank is 1 or less, or the Big Silver is not 6, but exclude any results where the Club ID is 5 or less, the Big Silver is not 12, and the Bronze is 7 or less?

SELECT Club_ID, MIN(Gold), Small_Silver FROM match_result WHERE "Points" <= 139 OR "Rank" <= 1 OR "Big_Silver" != 6 EXCEPT SELECT Club_ID, MIN(Gold), Small_Silver FROM match_result WHERE "Club_ID" <= 5 AND "Big_Silver" <> 12 AND "Bronze" <= 7


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

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


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 that appear in the school bus table with a driver ID 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 both greater than 9 and present in the driver table, and also greater than or equal to 9 and 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 >= 9


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

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


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

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


Question: Can you give me a list of aircraft IDs that are greater than 1, excluding any aircraft IDs that are also equal to 2 in the airport aircraft list?

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


Question: Can you give me a list of driver IDs, excluding driver ID 12 from the driver table and excluding driver ID 3 from the school bus table, combining the results into a single list?

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


Question: Can you give me a list of employee IDs for employees who are not named Dorthy Lewis or whose employee ID is 390487451, combined with a list of employee IDs for employees whose employee ID is less than or equal to 356187925 or whose name is Robert Brown?

SELECT eid FROM employee WHERE name != "Dorthy Lewis" OR "eid" = 390487451 UNION SELECT eid FROM employee WHERE "eid" <= 356187925 OR name = "Robert Brown"


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

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


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

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


Question: Can you give me the Club IDs for clubs that are not located in AKW, or don't have the description "Play pen and paper games on campus.", or are named "Bootup Baltimore" and have a ClubID of 3 or greater, but excluding the Club IDs of clubs where the CTO is a member, or where the ClubID is not 2 and the StuID is 1007 or less?

SELECT ClubID FROM Club WHERE ClubLocation <> "AKW" OR ClubDesc <> "Play pen and paper games on campus." OR ClubName = "Bootup Baltimore" AND "ClubID" >= 3 EXCEPT SELECT ClubID FROM Member_of_club WHERE Position = "CTO" OR "ClubID" != 2 AND "StuID" <= 1007


Question: Could you give me the sum of customer IDs from the Customer_Payments table, including those where the payment method isn't Direct Debit, or the customer ID is 14 and the payment amount isn't 1708.18, or the payment datetime isn't "2018-02-19 09:06:29", combined with the sum of customer IDs from the Customers table, including those where the customer address ID is less than 10, or the amount outstanding is greater than or equal to 255.0, or the date of birth is "1996-11-07 05:30:55" and the date they became a customer isn't "2016-05-11 17:03:48", or the customer ID is less than 9 and the last name isn't Bernhard and the cell phone number is "1-197-686-2849x8761" and the customer status code is "Bad Customer", or the phone number isn't "1-673-962-8158x7646" and the first name is Rylan and the email address isn't "karina.carroll@example.net"?

SELECT SUM(customer_id) FROM Customer_Payments WHERE payment_method_code <> "Direct Debit" OR "customer_id" = 14 AND "amount_payment" <> 1708.18 OR datetime_payment <> "2018-02-19 09:06:29" UNION SELECT SUM(customer_id) FROM Customers WHERE "customer_address_id" < 10 OR "amount_outstanding" >= 255.0 OR date_of_birth = "1996-11-07 05:30:55" AND date_became_customer <> "2016-05-11 17:03:48" OR "customer_id" < 9 AND last_name != "Bernhard" AND cell_mobile_phone_number = "1-197-686-2849x8761" AND customer_status_code = "Bad Customer" OR phone_number <> "1-673-962-8158x7646" AND first_name = "Rylan" AND email_address != "karina.carroll@example.net"


Question: Can you give me the IDs of drivers, up to ID 2, who are drivers but not school bus drivers up to ID 3?

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


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

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


Question: Can you give me a list of aircraft IDs, including those that are 5 from the aircraft table and those that are 2 or greater from the airport_aircraft table?

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


Question: Could you give me a list of school IDs that meet two conditions: first, they either had a budget year before 2002 with a budget investment percentage of 127.6 or a budgeted amount greater than 6803; and second, they either have a school ID that's not 2 or a total budget percentage budgeted of at least 2.0 and a budget investment percentage not equal to 71.3?

SELECT School_id FROM budget WHERE "Year" < 2002 AND Budget_invested_percent = "127.6" OR "Budgeted" > 6803 INTERSECT SELECT School_id FROM budget WHERE "School_id" != 2 OR "total_budget_percent_budgeted" >= 2.0 AND Budget_invested_percent <> "71.3"


Question: Which driver IDs are both not equal to 4 and greater than 7, considering drivers and school buses separately?

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


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

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


Question: Which driver IDs that are less than 12 are also driver IDs of school buses where the driver ID is 9?

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


Question: Can you give me a list of document type codes from the Documents table where the document ID is 13 or higher, or where the shipping agent code isn't "US", the document type code isn't "Paper", and the receipt date isn't "1983-09-26 09:32:56", or where the other details aren't "u", combined with a list of document type codes from the Ref_Document_Types table where the document type description isn't "u" and the document type code isn't "CD"?

SELECT document_type_code FROM Documents WHERE "document_id" >= 13 OR shipping_agent_code != "US" AND document_type_code <> "Paper" AND receipt_date <> "1983-09-26 09:32:56" OR other_details <> "u" UNION SELECT document_type_code FROM Ref_Document_Types WHERE document_type_description != "u" AND document_type_code != "CD"


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

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


Question: Can you show me the lowest rank and club ID from the coach table where the club ID is 1 or higher, or the coach ID is not 1, or the gender is not male, the coach's name is not Smith Brown, and the rank is greater than 1, combined with the lowest rank and club ID from the match result table where the rank is not 1, or the small silver count is 6, or the club ID is 5 and the gold count is not 6?

SELECT MIN(Rank), Club_ID FROM coach WHERE "Club_ID" >= 1 OR "Coach_ID" <> 1 OR Gender != "M" AND Coach_name != "Smith Brown" AND "Rank" > 1 UNION SELECT MIN(Rank), Club_ID FROM match_result WHERE "Rank" <> 1 OR "Small_Silver" = 6 OR "Club_ID" = 5 AND "Gold" != 6


Question: Which driver IDs are both less than 12 and also equal to 10?

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


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

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


Question: Can you give me the name and location of each club, along with a count of clubs, including those that don't have the description "Play pen and paper games on campus." or have a location of "HHH" and a ClubID that is not 1, as well as those that don't have the description "Venture capital fund for student business."?

SELECT ClubName, ClubLocation, COUNT(ClubID) FROM Club WHERE ClubDesc != "Play pen and paper games on campus." OR "ClubID" <> 1 AND ClubLocation = "HHH" UNION ALL SELECT ClubName, ClubLocation, COUNT(ClubID) FROM Club WHERE ClubDesc != "Venture capital fund for student business."


Question: Which driver IDs are both greater than 1 and appear in the driver table, and also greater than 9 and appear in the school_bus table?

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


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

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


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

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 from the driver table, excluding those drivers from the school_bus table whose School ID is not 3, and including drivers who are not named Jason Rojas, are not affiliated with the Dem party, are 38 years old, have a Driver ID other than 1, or don't live in East Hartford?

SELECT Driver_ID FROM driver WHERE Name <> "Jason Rojas" OR Party != "Dem" OR "Age" = 38 OR "Driver_ID" <> 1 OR Home_city <> "East Hartford" EXCEPT SELECT Driver_ID FROM school_bus WHERE "School_ID" <> 3


Question: Can you list all the driver IDs, including those from the driver table that are 9 or higher, and those from the school bus table that are 9 or lower?

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 the Club ID, Points, and the lowest Small Silver value for each club, considering only results where the Rank isn't 5, the Club ID is greater than 5, the Gold is less than or equal to 6, or the Points are less than or equal to 168, but excluding any results where the Gold is less than 12, the Bronze is greater than 8, the Rank isn't 6, the Points are less than or equal to 89, or the Big Silver is greater than or equal to 11 and the Club ID is not 4?

SELECT Club_ID, Points, MIN(Small_Silver) FROM match_result WHERE "Rank" != 5 OR "Club_ID" > 5 OR "Gold" <= 6 OR "Points" <= 168 EXCEPT SELECT Club_ID, Points, MIN(Small_Silver) FROM match_result WHERE "Gold" < 12 AND "Bronze" > 8 AND "Rank" != 6 OR "Points" <= 89 OR "Big_Silver" >= 11 AND "Club_ID" <> 4


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


Question: Which aircraft have an ID of 5 and also appear in the list of aircraft with an ID of 3 or greater at the airport?

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, including those from the driver table where the ID is greater than 8, and those from the school bus table where the ID is 9 or greater?

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


Question: Can you give me a list of all the Driver IDs, including those from the driver table excluding Driver ID 11, and those from the school_bus table with Driver IDs greater than or equal to 3?

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


Question: Can you give me a list of driver IDs that are less than 4 from the driver table, combined with a list of driver IDs that are not equal to 3 from the school bus table, making sure to remove 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 != 3


Question: Can you give me the employee IDs for employees named Lee Mears who are at least 30 years old and have an ID of 6 or less, along with the employee IDs from the evaluation table where the bonus is at least 2900 or the employee ID is 1 or the year awarded is not 2011?

SELECT Employee_ID FROM employee WHERE Name = "Lee Mears" AND "Age" >= 30 AND "Employee_ID" <= 6 UNION ALL SELECT Employee_ID FROM evaluation WHERE "Bonus" >= 2900.0 AND Employee_ID = "1" OR Year_awarded <> "2011"


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

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


Question: Can you give me the first and last names of all customers whose mobile phone number is not 200.830.8723, combined with the first and last names of all staff members named Eulalia with the nickname santos45, or those with a staff address ID of 1 and a birthdate other than November 16, 2000 at 6:55:12 AM and a last name other than Hermann, or those with a staff ID less than 6 and a middle name other than Tre?

SELECT last_name, first_name FROM Customers WHERE cell_mobile_phone_number <> "200.830.8723" UNION SELECT last_name, first_name FROM Staff WHERE first_name = "Eulalia" AND nickname = "santos45" OR "staff_address_id" = 1 AND date_of_birth != "2000-11-16 06:55:12" AND last_name != "Hermann" OR "staff_id" < 6 AND middle_name <> "Tre"


Question: Can you give me the level, hometown, card number, member ID, and the number of members, excluding Ventrell Jenkins and those with card number RT91, but then remove from that list anyone who isn't from Simpsonville, South Carolina or isn't David Jones, or whose Member ID is less than 10 and level is 6 or higher?

SELECT Level, Hometown, Card_Number, Member_ID, COUNT(Name) FROM member WHERE Name != "Ventrell Jenkins" AND Card_Number != "RT91" EXCEPT SELECT Level, Hometown, Card_Number, Member_ID, COUNT(Name) FROM member WHERE Hometown <> "Simpsonville, South Carolina" AND Name <> "David Jones" OR "Member_ID" < 10 AND "Level" >= 6


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

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


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

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


Question: Which driver IDs that are less than 11 are also driver IDs of school buses, specifically driver ID 10?

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


Question: Which driver IDs, excluding driver 6, are also bus driver IDs, excluding bus driver 9?

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


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

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: Can you give me a list of driver IDs, including those from the driver table that are 3 or greater, and those from the school bus table that are less than 7?

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


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

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: What is the average coach ID for coaches where either the club ID is not 3, or the coach ID is 4 or greater and the coach's name is Smith Brown, combined with the average coach ID from the player coach table where the player ID is not 10, the coach ID is not 2, and the starting year is 2011 or later?

SELECT AVG(Coach_ID) FROM coach WHERE "Club_ID" != 3 OR "Coach_ID" >= 4 AND Coach_name = "Smith Brown" UNION SELECT AVG(Coach_ID) FROM player_coach WHERE "Player_ID" != 10 AND "Coach_ID" <> 2 AND "Starting_year" >= 2011


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

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


Question: Can you give me a list of driver IDs from the driver table, considering only those IDs that are 8 or greater, but excluding any driver IDs that also appear in the school_bus table, unless that ID is 4?

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


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

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 is the sum of branch IDs for branches named "Taverner" with a membership amount of "31" and not located on Abbott Street, combined with the sum of branch IDs from purchases made in years other than 2018 or where the total pounds are less than 402.1 and the member ID is less than or equal to 3?

SELECT SUM(Branch_ID) FROM branch WHERE Address_road != "Abbott Street" AND Name = "Taverner" AND membership_amount = "31" UNION ALL SELECT SUM(Branch_ID) FROM purchase WHERE Year <> "2018" OR "Total_pounds" < 402.1 AND "Member_ID" <= 3


Question: Can you give me the counts of rank, player ID, gender, and occupation, along with the residence, player name, maximum votes, and sponsor name for all players, first for those whose rank isn't first or whose player ID is 13 or higher or whose votes are 4947, and then again for those who are retired and named Jim Maloway?

SELECT COUNT(Rank), Residence, Player_name, COUNT(Player_ID), MAX(Votes), Sponsor_name, COUNT(Gender), COUNT(Occupation) FROM player WHERE Rank <> "1st" OR "Player_ID" >= 13 OR "Votes" = 4947 UNION ALL SELECT COUNT(Rank), Residence, Player_name, COUNT(Player_ID), MAX(Votes), Sponsor_name, COUNT(Gender), COUNT(Occupation) FROM player WHERE Occupation = "Retired" AND Player_name = "Jim Maloway"


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

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


Question: Can you give me a list of driver IDs that are less than 8, excluding those 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 < 8 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 driver ID 4 from the driver table and all driver IDs except 4 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 != 4


Question: For each aircraft, what is the ID of that aircraft and the ID of the aircraft with the smallest ID that is associated with the same airport?

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


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

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


Question: Which branch IDs are found in the membership register for years other than 2016, and also appear in the purchase table with a branch ID not equal to 3 or a member ID not equal to 4?

SELECT Branch_ID FROM membership_register_branch WHERE Register_Year <> "2016" INTERSECT SELECT Branch_ID FROM purchase WHERE Branch_ID != "3" OR "Member_ID" <> 4