Question: Can you give me the student IDs from the Has_Pet table where the student ID is less than 1002 or the pet ID is greater than 2003, combined with the student IDs from the Student table where the major is not 520 and the sex is not male, or the first name is Sarah and the last name is not Wilson, or the student ID is not 1026, or the city code is not HKG, or the age is 18 or older and the advisor is 7712 or less?

SELECT StuID FROM Has_Pet WHERE "StuID" < 1002 OR "PetID" > 2003 UNION ALL SELECT StuID FROM Student WHERE "Major" <> 520 AND Sex != "M" OR Fname = "Sarah" AND LName <> "Wilson" OR "StuID" <> 1026 OR city_code != "HKG" OR "Age" >= 18 AND "Advisor" <= 7712


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

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


Question: Could you provide the date they became a customer, their customer address ID, and date of birth for all customers, including those who either didn't become a customer on "2016-07-22 15:53:44", or have a customer address ID greater than or equal to 9 and an email address of "afranecki@example.com" and an amount outstanding that is not 3900.0, or have a cell phone number that is not "1-401-108-8016x078", or don't have a customer status code of "Good Customer", along with those who have a first name other than "Omer", or a cell phone number other than "1-197-686-2849x8761" and a date of birth other than "1993-07-09 11:11:36", or a last name other than "Mertz", or a customer address ID greater than 10 and a date they became a customer other than "2016-02-17 08:26:23"?

SELECT date_became_customer, customer_address_id, date_of_birth FROM Customers WHERE date_became_customer <> "2016-07-22 15:53:44" OR "customer_address_id" >= 9 AND email_address = "afranecki@example.com" AND "amount_outstanding" <> 3900.0 OR cell_mobile_phone_number != "1-401-108-8016x078" OR customer_status_code <> "Good Customer" UNION ALL SELECT date_became_customer, customer_address_id, date_of_birth FROM Customers WHERE first_name <> "Omer" OR cell_mobile_phone_number <> "1-197-686-2849x8761" AND date_of_birth <> "1993-07-09 11:11:36" OR last_name <> "Mertz" OR "customer_address_id" > 10 AND date_became_customer != "2016-02-17 08:26:23"


Question: Which driver IDs, excluding 11, are also driver IDs greater than 7 that are used in school buses?

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


Question: Can you list the aircraft IDs that are less than 5, excluding those aircraft IDs that are also greater than 3 and associated with an airport?

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


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

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


Question: Which aircraft have an ID of 3, but are not aircraft with an ID of 1 that are located at an airport?

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


Question: How many domestic passengers are there for each aircraft?

SELECT COUNT(T1.Domestic_Passengers), T2.Aircraft_ID FROM airport as T1 JOIN airport_aircraft as T2 ON T1.Airport_ID = T2.Airport_ID


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

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


Question: Could you list the shipping agent codes and names that are not "UP" or "Fedex", but also have a description that isn't "t" or a code that is "UP"?

SELECT shipping_agent_code, shipping_agent_name FROM Ref_Shipping_Agents WHERE shipping_agent_code != "UP" AND shipping_agent_name <> "Fedex" INTERSECT SELECT shipping_agent_code, shipping_agent_name FROM Ref_Shipping_Agents WHERE shipping_agent_description <> "t" OR shipping_agent_code = "UP"


Question: Can you give me a list of driver IDs from the driver table that are less than or equal to 5, combined with a list of driver IDs from the school_bus table that are greater than 4, making sure to remove 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 list all the aircraft IDs, combining those from the aircraft table that are not equal to 1 with those from the airport_aircraft table that are greater than or equal to 5?

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


Question: Which aircraft IDs are not equal to 4 and are also less than or equal to 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 a list of driver IDs that are both greater than or equal to 1 and not equal to 10, considering only drivers who appear in both the driver and school bus records?

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


Question: Can you list the rank and club ID for coaches where the club ID is greater than 1 or the gender is male, combined with the rank and club ID for match results where the small silver is less than 16, or the gold is not equal to 20, or the points are less than 139 and the big silver is less than or equal to 12?

SELECT Rank, Club_ID FROM coach WHERE "Club_ID" > 1 OR Gender = "M" UNION SELECT Rank, Club_ID FROM match_result WHERE "Small_Silver" < 16 OR "Gold" != 20 OR "Points" < 139 AND "Big_Silver" <= 12


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 less than 9 from the school_bus table?

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


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

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


Question: Can you list the ranks from the coach table where the coach is not female and the coach's name is not Jameson Tomas, or where the coach ID is 5 and the club ID is less than 1, combined with the ranks from the player table where the sponsor name is not Saint Boniface, or the votes are not 4673, or the player ID is 4, or the residence is not Birtle, or the rank is not 1st?

SELECT Rank FROM coach WHERE Gender != "F" AND Coach_name <> "Jameson Tomas" OR "Coach_ID" = 5 AND "Club_ID" < 1 UNION SELECT Rank FROM player WHERE Sponsor_name != "Saint Boniface" OR "Votes" != 4673 OR "Player_ID" = 4 OR Residence <> "Birtle" OR Rank != "1st"


Question: Can you list the total disk area, aircraft name, maximum gross weight, description, and maximum disk loading for all aircraft that either are CH-47D Chinooks and not heavy-lift helicopters with a total disk area of 5,655 ft², or have a total disk area of 5,655 ft²?

5,655 ft² (526 m²)
CH-47D Chinook
50,000 lb (22,680 kg)
Tandem rotor helicopter
8.8 lb/ft² (43 kg/m²)

SELECT Total_disk_area, Aircraft, Max_Gross_Weight, Description, Max_disk_Loading FROM aircraft WHERE Description <> "Heavy-lift helicopter" AND Aircraft = "CH-47D Chinook" AND Total_disk_area = "5,655 ft² (526 m²)" UNION SELECT Total_disk_area, Aircraft, Max_Gross_Weight, Description, Max_disk_Loading FROM aircraft WHERE Total_disk_area = "5,655 ft² (526 m²)"


Question: What are the ages and birth states of people in the head table who were born in California, excluding those who are 43 or younger, or not from California and have a head ID of 10 or greater and a name other than Pádraig Harrington?

SELECT age, born_state FROM head WHERE born_state = "California" EXCEPT SELECT age, born_state FROM head WHERE "age" <= 43.0 OR born_state <> "California" AND "head_ID" >= 10 AND name != "Pádraig Harrington"


Question: Can you give me a list of driver IDs, including those from the driver table excluding driver ID 6, and those from the school bus table with driver IDs up to 9?

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


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

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


Question: Can you list all Aircraft IDs, including those that are equal to 1 from the aircraft table and those that are not equal to 5 from the airport_aircraft table?

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


Question: Can you give me a list of aircraft IDs, first from the aircraft table excluding aircraft ID 3, and then from the airport_aircraft table including only those less than 5, removing any duplicates?

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


Question: Can you list all the aircraft IDs, combining those from the aircraft table that are not equal to 2 with those from the airport_aircraft table that are not equal to 1?

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


Question: Can you give me a list of driver IDs, including those from the driver table that aren't 5, and those from the school bus table that are 10?

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


Question: Can you give me a list of driver IDs, combining those from the driver table that are not 12 with those from the school_bus table that are less than 3, removing any duplicates?

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


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

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


Question: Could you give me the total name value from the airport table for entries where the city is Bergen, the ICAO code is PANC, and the name is Schiphol Airport, with an id less than 3, or where the country is not Norway and the IATA code is not BRU, combined with the total name value from the operate_company table for entries incorporated in Hong Kong?

SELECT SUM(name) FROM airport WHERE City = "Bergen" AND ICAO = "PANC" AND name = "Schiphol Airport" AND "id" < 3 OR Country != "Norway" AND IATA <> "BRU" UNION SELECT SUM(name) FROM operate_company WHERE Incorporated_in = "Hong Kong"


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

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


Question: Can you list whether the positions are full-time from the hiring information, including those with a Shop ID of 4 or less, or that started in a year other than 2003, along with positions that started in a year other than 2011 and are not full-time?

SELECT Is_full_time FROM hiring WHERE "Shop_ID" <= 4 OR Start_from <> "2003" UNION ALL SELECT Is_full_time FROM hiring WHERE Start_from <> "2011" AND Is_full_time != "T"


Question: Can you give me a list of driver IDs, excluding driver ID 11, that are also driver IDs greater than or equal to 3, based on the driver and school bus information?

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


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

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


Question: Which driver IDs, excluding driver ID 6, are also driver ID 3 on the school bus?

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


Question: Can you give me a list of driver IDs that are not equal to 1 from the driver table, but only include those driver IDs that are also not equal to 7 from the school bus table?

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


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

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


Question: Can you give me the IDs of drivers with IDs less than or equal to 3, excluding those drivers whose IDs are not equal to 3 from the school bus table?

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


Question: What are the average feature name, count of feature type codes, and feature descriptions for features that are not pools or air conditioning, or whose ID is not 2 and type is not security, excluding those that are not air conditioning and are of security type?

SELECT AVG(feature_name), COUNT(feature_type_code), feature_description FROM Other_Available_Features WHERE feature_name <> "Pool" AND feature_description <> "Air Conditioning." OR "feature_id" != 2 AND feature_type_code != "Security" EXCEPT SELECT AVG(feature_name), COUNT(feature_type_code), feature_description FROM Other_Available_Features WHERE feature_description <> "Air Conditioning." AND feature_type_code = "Security"


Question: Can you give me a list of album IDs for albums titled "Kill 'Em All", combined with a list of playlist IDs for playlists that aren't named "Heavy Metal Classic"?

SELECT id FROM albums WHERE title = "Kill 'Em All" UNION SELECT id FROM playlists WHERE name <> "Heavy Metal Classic"


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

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


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

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


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

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


Question: Which driver IDs are both greater than 5 and also less than or equal to 9, appearing in both the driver and school_bus records?

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


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

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


Question: What aircraft IDs are present in both the aircraft table (excluding ID 1) and the airport_aircraft table (including only IDs 5 or greater)?

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


Question: Can you give me a list of driver IDs, where each ID is greater than 9, but only include those IDs that are not less than 4 in the school bus list?

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


Question: Can you list the aircraft IDs that appear in the aircraft table, excluding aircraft ID 5, but only if they are not also aircraft IDs that appear in the airport_aircraft table with an aircraft ID greater than 1?

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


Question: Can you give me the maximum gross weight, maximum disk loading, aircraft ID, aircraft name, and description for aircraft that meet these two sets of criteria: first, they are either heavy-lift helicopters, or their aircraft ID is greater than 5 and they are not a Robinson R-22, or their total disk area is not 872 square feet and their maximum disk loading is 15 lb/ft²; and second, their maximum gross weight is not 73,500 lb, and their maximum disk loading is not 15 lb/ft², and their total disk area is not 4,900 square feet, or their aircraft ID is not 2?

123,500 lb (56,000 kg)
14.5 lb/ft² (71 kg/m²)
4
Mil Mi-26
Heavy-lift helicopter

73,500 lb (33,300 kg)
15 lb/ft² (72 kg/m²)
5
CH-53E Super Stallion
Heavy-lift helicopter

SELECT Max_Gross_Weight, Max_disk_Loading, Aircraft_ID, Aircraft, Description FROM aircraft WHERE Description = "Heavy-lift helicopter" OR "Aircraft_ID" > 5 AND Aircraft != "Robinson R-22" OR Total_disk_area <> "872 ft² (81.1 m²)" AND Max_disk_Loading = "15 lb/ft² (72 kg/m²)" INTERSECT SELECT Max_Gross_Weight, Max_disk_Loading, Aircraft_ID, Aircraft, Description FROM aircraft WHERE Max_Gross_Weight != "73,500 lb (33,300 kg)" AND Max_disk_Loading <> "15 lb/ft² (72 kg/m²)" AND Total_disk_area <> "4,900 ft² (460 m²)" OR "Aircraft_ID" <> 2


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

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


Question: Can you give me a list of aircraft IDs that appear in the aircraft table, excluding aircraft ID 2, but only if they are not also listed in the airport_aircraft table with an aircraft ID of 1 or greater?

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


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

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


Question: Which driver IDs, other than 3, are in the driver table but not in the school_bus table?

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


Question: Could you list the Aircraft IDs that are both less than or equal to 1 in the aircraft table and less than 5 in the airport_aircraft table?

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


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

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


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

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


Question: What is the smallest aircraft name among those with a distance of at least 7120, excluding the smallest employee name among those with a salary less than 23980?

SELECT MIN(name) FROM aircraft WHERE "distance" >= 7120 EXCEPT SELECT MIN(name) FROM employee WHERE "salary" < 23980


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 3 UNION 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 2, 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 <= 2 UNION SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID != 2


Question: What aircraft IDs are greater than or equal to 5, excluding those aircraft IDs less than 2 that are associated with airports?

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: Can you list the full name, country, ID, and maker for all car makers with an ID less than 20, excluding those that are either not named "BMW" or have an ID greater than 7?

SELECT FullName, Country, Id, Maker FROM car_makers WHERE "Id" < 20 EXCEPT SELECT FullName, Country, Id, Maker FROM car_makers WHERE FullName <> "BMW" OR "Id" > 7


Question: Could you give me the total Book IDs and their corresponding prices from the publication table, combining two sets of results? The first set includes publications where the publication date isn't June 2006, or the Publication ID is less than or equal to 2 and the price is under 4,100,000, or the publisher is Pearson, or the Book ID is less than 5. The second set includes publications where the Book ID is less than or equal to 7 and the price is at least 4,100,000 and the Publication ID is 7, or the publisher is Wiley and the publication date isn't April 2007.

SELECT SUM(Book_ID), Price FROM publication WHERE Publication_Date <> "June 2006" OR "Publication_ID" <= 2 AND "Price" < 4100000.0 OR Publisher = "Pearson" OR "Book_ID" < 5 UNION SELECT SUM(Book_ID), Price FROM publication WHERE "Book_ID" <= 7 AND "Price" >= 4100000.0 AND "Publication_ID" = 7 OR Publisher = "Wiley" AND Publication_Date != "April 2007"


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

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


Question: Could you list the aircraft IDs that are less than 2, excluding any aircraft IDs greater than 3 that are associated with airports?

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


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

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


Question: Can you give me a list of driver IDs, where the IDs are not equal to 3, and also include driver IDs from the school bus list that are less than 4?

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


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

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


Question: Which driver IDs, excluding driver ID 9, are also driver IDs that are equal to 3?

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


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

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


Question: Which driver IDs, other than 3, are in the driver list but not in the school bus list?

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


Question: What is the number of available features that are not feature ID 4 or are security features, and also the number of property features with a property ID greater than 13?

SELECT COUNT(feature_id) FROM Other_Available_Features WHERE "feature_id" <> 4 OR feature_type_code = "Security" INTERSECT SELECT COUNT(feature_id) FROM Other_Property_Features WHERE "property_id" > 13


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

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


Question: Can you give me the middle name, date they left, date they joined, last name, birth date, and first name of all staff members, including those who either didn't join on "2017-12-22 03:06:32" and don't have the last name "Jast", or don't have the first name "Jedidiah", combined with those who either don't have the nickname "nicholaus92" and don't have the last name "Herzog", or whose staff ID isn't 3 and staff address ID isn't 7, or don't have the first name "Ludie" and didn't join on "2017-10-21 17:20:57"?

SELECT middle_name, date_left_staff, date_joined_staff, last_name, date_of_birth, first_name FROM Staff WHERE date_joined_staff <> "2017-12-22 03:06:32" AND last_name <> "Jast" OR first_name != "Jedidiah" UNION SELECT middle_name, date_left_staff, date_joined_staff, last_name, date_of_birth, first_name FROM Staff WHERE nickname <> "nicholaus92" AND last_name != "Herzog" OR "staff_id" != 3 AND "staff_address_id" <> 7 OR first_name != "Ludie" AND date_joined_staff != "2017-10-21 17:20:57"


Question: Can you give me a list of aircraft IDs that are greater than 3, excluding any aircraft IDs that are less than or equal to 3 and are also found in the airport aircraft list?

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


Question: Can you give me a list of driver IDs that appear in the driver table, excluding driver ID 2, but then remove any driver IDs that also appear in the school_bus table and are greater than 3?

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


Question: Can you give me a list of member IDs from the membership register branch for the year 2016, or those not associated with branch 5, along with member IDs from purchases not made at branch 1?

SELECT Member_ID FROM membership_register_branch WHERE Register_Year = "2016" OR Branch_ID != "5" UNION ALL SELECT Member_ID FROM purchase WHERE Branch_ID <> "1"


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

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


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

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


Question: Can you list the aircraft IDs that are less than or equal to 1, excluding those aircraft IDs less than 1 that are associated with airports?

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


Question: Can you list all the role descriptions, including those that aren't "Editor", and also those with a role code that isn't "PT" or that are specifically "Editor"?

SELECT role_description FROM Roles WHERE role_description != "Editor" UNION ALL SELECT role_description FROM Roles WHERE role_code <> "PT" OR role_description = "Editor"


Question: Can you list all the aircraft IDs, excluding aircraft ID 3, and combine that with a list of all aircraft IDs from the airport aircraft table, excluding aircraft ID 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 are the genders and ranks of coaches with a rank of 5 or lower, or who are not male, excluding the genders and ranks of players who are not ranked 3rd?

SELECT Gender, Rank FROM coach WHERE "Rank" <= 5 OR Gender <> "M" EXCEPT SELECT Gender, Rank FROM player WHERE Rank != "3rd"


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

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


Question: Can you give me the sum of draft numbers, the average document ID, the employee ID, and the average copy number from the circulation history, first for records where the document ID is less than or equal to 1, the employee ID is not 2, the copy number is 15, or the draft number is less than or equal to 20, and then again for records where the employee ID is not 1, combining the results?

SELECT SUM(draft_number), AVG(document_id), employee_id, AVG(copy_number) FROM Circulation_History WHERE "document_id" <= 1 OR "employee_id" <> 2 OR "copy_number" = 15 OR "draft_number" <= 20 UNION SELECT SUM(draft_number), AVG(document_id), employee_id, AVG(copy_number) FROM Circulation_History WHERE "employee_id" != 1


Question: Can you give me the minimum number of employees, the count of department names, the average department ID, the count of creation dates, the ranking, and the maximum budget in billions for departments, grouped by ranking, first where the budget isn't 44.6 billion and the department ID is 7 or less, but only if the maximum budget is 77.6 billion or less, or the count of department names and creation dates are not equal to 1, or the minimum number of employees is 30266, or the average department ID is greater than 5; and then also give me the same information for departments grouped by ranking where the department ID is greater than 1, or the ranking is greater than 15, or the department name is Treasury, or the number of employees is less than 36000, but only if the minimum number of employees is greater than 208000 and the average department ID is greater than 12?

SELECT MIN(Num_Employees), COUNT(Name), AVG(Department_ID), COUNT(Creation), Ranking, MAX(Budget_in_Billions) FROM department WHERE "Budget_in_Billions" <> 44.6 AND "Department_ID" <= 7 GROUP BY Ranking HAVING MAX(Budget_in_Billions) <= 77.6 OR COUNT(Name) != 1 AND COUNT(Creation) != 1 OR MIN(Num_Employees) = 30266.0 OR AVG(Department_ID) > 5.0 UNION SELECT MIN(Num_Employees), COUNT(Name), AVG(Department_ID), COUNT(Creation), Ranking, MAX(Budget_in_Billions) FROM department WHERE "Department_ID" > 1 OR "Ranking" > 15 OR Name = "Treasury" OR "Num_Employees" < 36000.0 GROUP BY Ranking HAVING MIN(Num_Employees) > 208000.0 AND AVG(Department_ID) > 12.0


Question: Which driver IDs are both greater than 8 and also equal to 10?

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


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

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


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

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


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


Question: Can you give me a list of aircraft IDs that are greater than 1, excluding those aircraft IDs less than 5 that are also found 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 < 5


Question: Which driver has an ID of 5, excluding any drivers with IDs less than 4 who are also school bus drivers?

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


Question: What is the earliest property type description, excluding "Other", that is not "Shop, Retail Outlet."?

SELECT MIN(property_type_description) FROM Ref_Property_Types WHERE property_type_code != "Other" EXCEPT SELECT MIN(property_type_description) FROM Ref_Property_Types WHERE property_type_description = "Shop, Retail Outlet."


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

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


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

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


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

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


Question: What aircraft IDs are not equal to 5 and are also not equal to 2 when considering aircraft associated with airports?

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


Question: Can you list the aircraft IDs that are less than or equal to 5, excluding those aircraft IDs that are not equal to 2 and are also present in the airport aircraft list?

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


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

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


Question: What is the average name from the airport table, considering only airports that are not KBOS or have an ID less than or equal to 9 and are not in the United States, combined with the average name from the operate_company table, considering only companies that are not Cathay Pacific Services Limited or have an ID less than or equal to 9?

SELECT AVG(name) FROM airport WHERE ICAO <> "KBOS" OR "id" <= 9 AND Country <> "United States" UNION SELECT AVG(name) FROM operate_company WHERE name != "Cathay Pacific Services Limited" OR "id" <= 9


Question: Can you give me a list of driver IDs that are less than 11 and also not equal to 9, 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 < 11 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 9


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

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


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

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


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

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


Question: Could you show me the draft number, document ID, and draft details for all document drafts that are not draft number 17, but only if the draft details are not "v" or the document ID is not 4?

SELECT draft_number, document_id, draft_details FROM Document_Drafts WHERE "draft_number" != 17 INTERSECT SELECT draft_number, document_id, draft_details FROM Document_Drafts WHERE draft_details != "v" OR "document_id" <> 4


Question: Could you list all draft numbers that are either greater than 9 and not associated with document ID 13, or are not associated with document ID 2?

SELECT draft_number FROM Document_Drafts WHERE "draft_number" > 9 AND "document_id" != 13 UNION SELECT draft_number FROM Document_Drafts WHERE "document_id" != 2


Question: Can you give me the IDs of drivers with IDs less than 3, excluding those drivers who also have IDs that are not equal to 9 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 <> 9


Question: Which driver IDs are both greater than 9 and appear in the driver table, and also greater than or equal to 3 and appear in the school bus table?

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


Question: Could you give me the company IDs that are both from companies not headquartered in the USA with assets not equal to 331.1 billion, a company ID greater than 17, profits of at least 15.7 billion, a name other than "Total", or a market value not equal to 107.5 billion, and also from employments where the people ID is not 3 and the company ID is no more than 11?

SELECT Company_ID FROM company WHERE Headquarters <> "USA" AND "Assets_in_Billion" <> 331.1 AND "Company_ID" > 17.0 OR "Profits_in_Billion" >= 15.7 OR Name != "Total" OR "Market_Value_in_Billion" <> 107.5 INTERSECT SELECT Company_ID FROM employment WHERE "People_ID" != 3 AND "Company_ID" <= 11


Question: Can you give me a list of driver IDs that are less than 11 and are also driver IDs that are not equal to 7?

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


Question: Can you give me the employee IDs of those who have certificate ID 3, excluding those who either aren't employee ID 269734834 or have a salary of 24450 or less and aren't named Dorthy Lewis?

SELECT eid FROM certificate WHERE "aid" = 3 EXCEPT SELECT eid FROM employee WHERE "eid" != 269734834 OR "salary" <= 24450 AND name != "Dorthy Lewis"


Question: Which driver IDs are greater than 2 and also greater than 7, considering drivers and school buses separately?

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


Question: Can you list the Company and People IDs from the employment table where either the People ID is less than 1 or the working year is 2 or more, combined with another list of Company and People IDs from the same table where the working year is less than 1 and the Company ID is 7, or the People ID is 7 or less?

SELECT Company_ID, People_ID FROM employment WHERE "People_ID" < 1 OR "Year_working" >= 2 UNION SELECT Company_ID, People_ID FROM employment WHERE "Year_working" < 1 AND "Company_ID" = 7 OR "People_ID" <= 7


Question: Can you list all the aircraft IDs, excluding ID 1, that appear in either the aircraft table or the airport_aircraft table?

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


Question: How many continents are named "america", and how many countries are not named "egypt" and don't have a CountryId of 3?

SELECT COUNT(Continent) FROM continents WHERE Continent = "america" UNION ALL SELECT COUNT(Continent) FROM countries WHERE CountryName != "egypt" AND "CountryId" != 3


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

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


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

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, including those from the driver table that are not 11, and those from the school bus table that are exactly 10?

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


Question: Can you give me a list of driver IDs, including those from the driver table that are greater than or equal to 2, and those from the school bus table that are less than or equal to 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: Can you list all the branch names located on Abbott Street or that aren't named Taverner, along with all the member names who have a level greater than 6 or a card number of RCB32?

SELECT Name FROM branch WHERE Address_road = "Abbott Street" OR Name != "Taverner" UNION ALL SELECT Name FROM member WHERE "Level" > 6 OR Card_Number = "RCB32"


Question: What are the maximum age, minimum student ID, count of first names, and average major for students who are at least 19 years old, combined with the same information for students who either don't have a major of 600, don't have the last name Simms, or are 18 years old?

MAX(Age) MIN(StuID) COUNT(Fname) AVG(Major)

SELECT MAX(Age), MIN(StuID), COUNT(Fname), AVG(Major) FROM Student WHERE "Age" >= 19 UNION SELECT MAX(Age), MIN(StuID), COUNT(Fname), AVG(Major) FROM Student WHERE "Major" <> 600 OR LName != "Simms" OR "Age" = 18


Question: Which driver IDs are not equal to 2 and appear in the driver table, and are also not equal to 4 and appear in the school_bus table?

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


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

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


Question: Can you give me a list of driver IDs, including those from the driver table excluding driver ID 8, and those from the school bus table with driver IDs of 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 that are less than 5 from the driver table, combined with a list of driver IDs that are exactly 10 from the school bus table?

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


Question: Can you give me a list of aircraft IDs that are greater than 1, excluding those aircraft IDs from the airport aircraft list that are not equal to 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: Which aircraft IDs are both greater than 1 when grouped in the aircraft table, and greater than or equal to 3 when grouped in the airport_aircraft table?

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


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

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


Question: Can you give me the Driver ID that appears exactly as 7 in the driver table, but is not a Driver ID greater than or equal to 9 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 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 or equal to 7?

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


Question: Can you give me the state of birth, age, ID, and name of people from the head table who are either at least head ID 3, named Stewart Cink, not from Delaware, or younger than 43, but exclude anyone who is from California, older than head ID 6, and not 43 years old?

SELECT born_state, age, head_ID, name FROM head WHERE "head_ID" >= 3 OR name = "Stewart Cink" OR born_state <> "Delaware" OR "age" < 43.0 EXCEPT SELECT born_state, age, head_ID, name FROM head WHERE "age" <> 43.0 AND born_state = "California" AND "head_ID" > 6


Question: Could you list the document IDs from the circulation history where the employee ID is less than 1, combined with the document IDs from the documents mailed table where the document ID is less than or equal to 10?

SELECT document_id FROM Circulation_History WHERE "employee_id" < 1 UNION SELECT document_id FROM Documents_Mailed WHERE "document_id" <= 10


Question: What are the total Department IDs, total rankings, and budgets in billions for departments with more than 4487 employees and a name other than "Defense", excluding the total Department IDs, total rankings, and budgets in billions for departments that either have a Department ID not equal to 11 and a ranking not equal to 8, or have 67000 employees and a name other than "Commerce", or have a budget over 439.3 billion?

SELECT SUM(Department_ID), SUM(Ranking), Budget_in_Billions FROM department WHERE "Num_Employees" > 4487.0 AND Name != "Defense" EXCEPT SELECT SUM(Department_ID), SUM(Ranking), Budget_in_Billions FROM department WHERE "Department_ID" != 11 AND "Ranking" <> 8 OR "Num_Employees" = 67000.0 AND Name != "Commerce" OR "Budget_in_Billions" > 439.3


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

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


Question: Can you show me the address, city, membership amount, earliest open year, branch ID, and name for all branches, excluding Brooke Greville, where the branch ID is 1 or higher or the opening year isn't 2015, but then remove any branches that have a membership amount of 11 and are located on Abbott Street?

SELECT Address_road, City, membership_amount, MIN(Open_year), Branch_ID, Name FROM branch WHERE Name != "Brooke Greville" AND "Branch_ID" >= 1 OR Open_year <> "2015" EXCEPT SELECT Address_road, City, membership_amount, MIN(Open_year), Branch_ID, Name FROM branch WHERE membership_amount = "11" AND Address_road = "Abbott Street"


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

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


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

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, combining those from the driver table that are not 11 with those from the school bus table that are 10 or less, 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 <= 10


Question: Can you give me a list of staff IDs from the Lessons table where the staff ID is 11 or higher, or the lesson status is 'Completed', or the vehicle ID is less than 2 and the customer ID is 6 or higher, combined with a list of staff IDs from the Staff table where the date of birth is September 24, 1996 at 9:51:42 AM, or the middle name is not 'Sherwood', or the staff ID is less than 5 and the date they joined is not June 4, 2017 at 2:30:41 PM and the date they left is March 9, 2018 at 5:08:35 AM?

SELECT staff_id FROM Lessons WHERE "staff_id" >= 11 OR lesson_status_code = "Completed" OR "vehicle_id" < 2 AND "customer_id" >= 6 UNION ALL SELECT staff_id FROM Staff WHERE date_of_birth = "1996-09-24 09:51:42" OR middle_name != "Sherwood" OR "staff_id" < 5 AND date_joined_staff <> "2017-06-04 14:30:41" AND date_left_staff = "2018-03-09 05:08:35"


Question: Can you give me a list of driver IDs that are less than 5, excluding any driver IDs that are 10 or greater and are also associated with a school bus?

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 greater than or equal to 7, excluding those driver IDs greater than 7 that are also in the school bus table?

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


Question: Can you list the ranks from the match results where either the gold is 13 or less, or the rank is not 3, combined with the ranks where either the big silver is greater than 14 or the points are greater than 139?

SELECT Rank FROM match_result WHERE "Gold" <= 13 OR "Rank" <> 3 UNION SELECT Rank FROM match_result WHERE "Big_Silver" > 14 OR "Points" > 139


Question: Can you give me the template type code that is "PPT" and also has templates with effective dates not equal to "2005-11-12 07:09:48", version numbers not equal to 5, a template type code of "PP", and effective to dates not equal to "1992-05-02 20:06:11"?

SELECT Template_Type_Code FROM Ref_Template_Types WHERE Template_Type_Code = "PPT" INTERSECT SELECT Template_Type_Code FROM Templates WHERE Date_Effective_From <> "2005-11-12 07:09:48" OR "Version_Number" <> 5 AND Template_Type_Code = "PP" AND Date_Effective_To != "1992-05-02 20:06:11"


Question: Can you give me the minimum party, delegate, maximum committee, counties represented, average district, and the count of election IDs from the election table, combining two sets of results? The first set should include records where counties represented is not "12.1 12A", or election ID is not 3 and first elected is not 1994, or the committee is not "Environmental Matters", or the party is greater than 1 and the district is less than 1, or the delegate is "Malone, James E. Jr. James E. Malone, Jr.". The second set should include records where the committee is not "Environmental Matters" and first elected is not 1994, or the delegate is not "Bobo, Elizabeth Elizabeth Bobo", or the election ID is greater than 2 and the district is less than or equal to 3, or the party is less than or equal to 3.

MIN(Party) Delegate MAX(Committee) Counties_Represented AVG(District) COUNT(Election_ID)

SELECT MIN(Party), Delegate, MAX(Committee), Counties_Represented, AVG(District), COUNT(Election_ID) FROM election WHERE Counties_Represented <> "12.1 12A" OR "Election_ID" != 3 AND "First_Elected" <> 1994.0 OR Committee <> "Environmental Matters" OR "Party" > 1 AND "District" < 1 OR Delegate = "Malone, James E. Jr. James E. Malone, Jr." UNION ALL SELECT MIN(Party), Delegate, MAX(Committee), Counties_Represented, AVG(District), COUNT(Election_ID) FROM election WHERE Committee != "Environmental Matters" AND "First_Elected" != 1994.0 OR Delegate <> "Bobo, Elizabeth Elizabeth Bobo" OR "Election_ID" > 2 AND "District" <= 3 OR "Party" <= 3


Question: Can you give me the driver ID of drivers with ID 10, excluding the driver IDs of school bus drivers with IDs up to 7?

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


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

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


Question: Can you give me a list of names and IDs from airports that aren't BGO, combined with the names and IDs from operating companies where the ID isn't 5 or the Group Equity Shareholding is 100 or more?

Cathay Pacific Catering Services (HK) Limited

SELECT name, id FROM airport WHERE IATA != "BGO" UNION SELECT name, id FROM operate_company WHERE "id" != 5 OR "Group_Equity_Shareholding" >= 100.0


Question: Can you give me a list of employee IDs from the evaluation table where the bonus is greater than 2900 and the year awarded is not 2016 and the employee ID is 10, combined with a list of employee IDs from the hiring table where the start date is not 2011 and the shop ID is not 1, or the employee is not full-time?

SELECT Employee_ID FROM evaluation WHERE "Bonus" > 2900.0 AND Year_awarded != "2016" AND Employee_ID = "10" UNION ALL SELECT Employee_ID FROM hiring WHERE Start_from <> "2011" AND "Shop_ID" <> 1 OR Is_full_time <> "F"


Question: Can you list the aircraft IDs from the aircraft table that are less than 3, and combine that with a list of 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 < 3 UNION SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID >= 1


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

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


Question: Can you 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 greater than 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 employee IDs that either match ID 567354612 in the certificate list or are less than 548977562 and belong to someone named Linda Davis in the employee list?

SELECT eid FROM certificate WHERE "eid" = 567354612 UNION SELECT eid FROM employee WHERE "eid" < 548977562 AND name = "Linda Davis"


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


Question: Can you give me the driver ID of drivers with ID 10, excluding the driver IDs of school bus drivers with IDs less than 4?

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: What aircraft IDs are both greater than 2 in the aircraft table and greater than or equal to 2 in the airport_aircraft table?

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


Question: Can you give me a list of driver IDs, making sure to include all driver IDs from the driver table that are not 4, and all driver IDs from the school_bus table that are less than 3?

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


Question: Can you give me a list of member IDs from the member table, excluding any member IDs that are also found in the membership_register_branch table, where the member IDs in the member table have a card number that's not LCB7 or a member ID less than or equal to 1 and a hometown that's not Fort Campbell, Kentucky, and the member IDs in the membership_register_branch table are those that are not 6 or have a branch ID of 5?

SELECT Member_ID FROM member WHERE Card_Number <> "LCB7" OR "Member_ID" <= 1 AND Hometown != "Fort Campbell, Kentucky" EXCEPT SELECT Member_ID FROM membership_register_branch WHERE "Member_ID" <> 6 OR Branch_ID = "5"


Question: Which aircraft IDs, excluding aircraft ID 3, are also aircraft IDs that are greater than or equal to 5?

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: Which driver IDs, excluding driver ID 4, are not also driver IDs in the school bus table, excluding driver ID 7?

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


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 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 less than 5, excluding any 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 < 5 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 4


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

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


Question: Can you give me the IDs of drivers, with IDs greater than 7, excluding those driver IDs that are also in the school bus list and are greater than 3?

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


Question: Can you tell me the largest company name from the company table, considering companies that are not in the oil and gas industry or don't have sales of 117.6 billion, or have profits less than or equal to 11.1 billion and market value less than or equal to 164.3 billion, or have a company ID less than 19, or don't have assets of 319.4 billion, or whose name is not Total, combined with the largest name from the people table, considering people with a People ID greater than or equal to 7, or who didn't graduate from Oklahoma and are 34 or younger, or whose name is not Brad Lohaus, or who are not from the United States?

SELECT MAX(Name) FROM company WHERE Industry <> "Oil and gas" AND "Sales_in_Billion" != 117.6 OR "Profits_in_Billion" <= 11.1 AND "Market_Value_in_Billion" <= 164.3 OR "Company_ID" < 19.0 OR "Assets_in_Billion" <> 319.4 OR Name <> "Total" UNION SELECT MAX(Name) FROM people WHERE "People_ID" >= 7 OR Graduation_College <> "Oklahoma" AND "Age" <= 34 OR Name != "Brad Lohaus" OR Nationality != "United States"


Question: Can you list all the club IDs from the club table where the ID is greater than 1, and also include all the club IDs from the match result table where either the small silver value is not 9, or the points are less than or equal to 139, the club ID is not 4, the gold value is greater than or equal to 13, and the bronze value is not 10?

SELECT Club_ID FROM club WHERE "Club_ID" > 1 UNION ALL SELECT Club_ID FROM match_result WHERE "Small_Silver" <> 9 OR "Points" <= 139 AND "Club_ID" != 4 AND "Gold" >= 13 AND "Bronze" != 10


Question: Which driver IDs are equal to 6 in the driver table, but not greater than or equal to 3 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 the draft numbers from the Draft Copies table where the draft number is 12, or the document ID is less than or equal to 2 and the copy number is 15, combined with draft numbers where the draft number is not 2, or the document ID is not 2 and the copy number is less than 15?

SELECT draft_number FROM Draft_Copies WHERE "draft_number" = 12 OR "document_id" <= 2 AND "copy_number" = 15 UNION SELECT draft_number FROM Draft_Copies WHERE "draft_number" <> 2 OR "document_id" != 2 AND "copy_number" < 15


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

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


Question: Could you give me the customer IDs that appear both in a list of customers who made payments where either the payment wasn't made at "2018-03-18 13:48:13", the customer ID wasn't 2, or the payment method wasn't "Direct Debit", and in a list of customers who had lessons where either the vehicle ID was greater than 2, the lesson ID was less than or equal to 13, the staff ID was greater than or equal to 4, or the customer ID was 9 and the lesson date was "2018-02-28 10:55:36" and the lesson time wasn't "4"?

SELECT customer_id FROM Customer_Payments WHERE datetime_payment != "2018-03-18 13:48:13" OR "customer_id" != 2 OR payment_method_code != "Direct Debit" INTERSECT SELECT customer_id FROM Lessons WHERE "vehicle_id" > 2 OR "lesson_id" <= 13 OR "staff_id" >= 4 OR "customer_id" = 9 AND lesson_date = "2018-02-28 10:55:36" AND lesson_time != "4"


Question: Can you give me a list of driver IDs, excluding driver ID 5 from the driver table and excluding driver ID 7 from the school_bus table, combining the results and 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 <> 7


Question: Can you list the aircraft IDs from the aircraft table that are less than or equal to 3, 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 <= 3 UNION SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <= 1


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

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


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

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


Question: Which driver IDs are both greater than 2 and used by school buses with driver IDs less than 7?

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


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

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


Question: Can you give me the IDs of features that are both greater than 2 in the Other_Available_Features table and also have a property feature description of "quo" or a property ID less than or equal to 6 or a feature ID greater than or equal to 4 in the Other_Property_Features table?

SELECT feature_id FROM Other_Available_Features WHERE "feature_id" > 2 INTERSECT SELECT feature_id FROM Other_Property_Features WHERE property_feature_description = "quo" OR "property_id" <= 6 OR "feature_id" >= 4


Question: Could you give me the Shop ID, Name, and District of shops that meet both of these conditions: either they're not in Magnum Areena, or Job Dragtsma is the manager, or they don't have 6000 products, or their name isn't FC KooTeePee, or their Shop ID is 4 or less, or they're located in Jakobstad; and also, they're either not in Magnum Areena or their Shop ID isn't 4?

SELECT Shop_ID, Name, District FROM shop WHERE District <> "Magnum Areena" OR Manager_name = "Job Dragtsma" OR "Number_products" <> 6000 OR Name != "FC KooTeePee" OR "Shop_ID" <= 4 OR Location = "Jakobstad" INTERSECT SELECT Shop_ID, Name, District FROM shop WHERE District != "Magnum Areena" OR "Shop_ID" != 4


Question: Can you give me the driver IDs that are both less than or equal to 9 in the driver table and 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 list the aircraft IDs, up to and including 5, that appear in the aircraft table but not in the airport_aircraft table, considering only the aircraft IDs up to and including 2 in the airport_aircraft table?

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


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

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


Question: Could you list the driver IDs that are less than 11, excluding those driver IDs that are also less than or equal to 9 and appear 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 <= 9


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

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


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

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


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

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


Question: Can you list all the aircraft IDs, including those from the aircraft table where the ID is 1 or greater, and those from the airport_aircraft table where the ID is not 2?

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


Question: Can you list the aircraft IDs, up to and including 5, that appear in the aircraft table, excluding those aircraft IDs less than 5 that also appear in the airport_aircraft table?

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


Question: Could you give me a list of club IDs that either belong to club number 3 but didn't start in the year 2000, or are not located in the USA, combined with a list of club IDs from match results where the rank is 1, the club ID is less than 3, and the bronze score is no more than 9?

SELECT Club_ID FROM club WHERE "Club_ID" = 3 AND "Start_year" <> 2000 OR Region != "USA" UNION SELECT Club_ID FROM match_result WHERE "Rank" = 1 AND "Club_ID" < 3 AND "Bronze" <= 9


Question: Which aircraft have an ID of 3, but are not aircraft that have an ID less than 3 and are associated with an airport?

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


Question: Can you give me a list of driver IDs, combining those from the driver table where the ID is not 5 with those from the school bus table where the ID is greater than 3, 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 > 3


Question: Can you give me a list of customer IDs from the Customer_Payments table where the customer ID is 14 or greater, combined with a list of customer IDs from the Customers table where the amount outstanding is greater than 9447 or the cell phone number is "00659133944"?

SELECT customer_id FROM Customer_Payments WHERE "customer_id" >= 14 UNION SELECT customer_id FROM Customers WHERE "amount_outstanding" > 9447.0 OR cell_mobile_phone_number = "00659133944"


Question: Could you give me a list of People IDs that either belong to people who are at least 196 cm tall or are Russian but not named Sergey Grankin and have a People ID of 1 or less, combined with a list of People IDs that belong to poker players who have either achieved a best finish of 1 or better, or have made 19 final tables, or whose People ID is not 6, Money Rank is not 154, Earnings are not 142800, and Poker Player ID is less than 5?

SELECT People_ID FROM people WHERE "Height" >= 196.0 OR Nationality = "Russia" AND Name != "Sergey Grankin" AND "People_ID" <= 1 UNION SELECT People_ID FROM poker_player WHERE "Best_Finish" >= 1.0 OR "Final_Table_Made" = 19.0 OR "People_ID" <> 6 AND "Money_Rank" <> 154.0 AND "Earnings" != 142800.0 AND "Poker_Player_ID" < 5


Question: Can you give me a list of driver IDs, combining those from the driver table where the ID is not 1, and those from the school bus table where the ID is not 3, removing any duplicates?

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


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

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


Question: What is the highest template type code, excluding those with the description "Book" or the code "BK", and also the highest template type code from templates that have no details?

SELECT MAX(Template_Type_Code) FROM Ref_Template_Types WHERE Template_Type_Description <> "Book" OR Template_Type_Code != "BK" UNION SELECT MAX(Template_Type_Code) FROM Templates WHERE Template_Details = ""


Question: Can you give me a list of driver IDs, excluding driver ID 4 from the driver table and driver ID 3 from the school_bus table, making sure to list each driver ID only once?

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


Question: Can you give me the lesson ID, customer ID, lesson time, vehicle ID, staff ID, lesson status code, lesson date, and price for all lessons where the price is greater than 223, the lesson status is cancelled, or the customer ID is not 11, combined with all lessons where the vehicle ID is 1, the customer ID is greater than 10, the lesson ID is not 11 and the lesson date is March 6th, 2018, the price is not 277, the lesson time is 9, or the staff ID is not 4 and the lesson status is not cancelled?

SELECT lesson_id, customer_id, lesson_time, vehicle_id, staff_id, lesson_status_code, lesson_date, price FROM Lessons WHERE "price" > 223.0 OR lesson_status_code = "Cancelled" OR "customer_id" != 11 UNION ALL SELECT lesson_id, customer_id, lesson_time, vehicle_id, staff_id, lesson_status_code, lesson_date, price FROM Lessons WHERE "vehicle_id" = 1 OR "customer_id" > 10 OR "lesson_id" <> 11 AND lesson_date = "2018-03-06 21:48:51" AND "price" != 277.0 OR lesson_time = "9" OR "staff_id" <> 4 AND lesson_status_code <> "Cancelled"


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

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


Question: What aircraft IDs are greater than 2, considering only aircraft IDs that appear more than once, excluding any aircraft IDs that are not equal to 2 and appear in the airport aircraft table more than once?

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


Question: Can you list the aircraft IDs, where each ID is at least 3, excluding any aircraft IDs that also appear in the airport aircraft table where the ID is not equal to 2?

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


Question: 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 not equal to 3?

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


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


Question: Can you give me the Model IDs that are both less than or equal to 3, and also either equal to 14 or have a Maker that is not 17?

SELECT ModelId FROM model_list WHERE "ModelId" <= 3 INTERSECT SELECT ModelId FROM model_list WHERE "ModelId" = 14 OR "Maker" <> 17


Question: Can you give me a list of driver IDs, combining those from the driver table where the ID is not 2, and those from the school bus table where the ID is 3 or greater?

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


Question: How many books are there for each price, considering only books titled "The Dome: Ground Zero" or those not published in August 2008, or where the price isn't 2,000,000, or those not written by Garth Ennis and with a publication ID greater than 5?

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


Question: Can you list the aircraft IDs, first including those from the aircraft table that are not equal to 1, and then adding those from the airport_aircraft table that are less than or equal to 2?

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


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

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


Question: Which aircraft have an ID of 3 and are also associated with airports that do not have an aircraft ID of 5?

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 or equal to 2, excluding any driver IDs that are also in a list of driver IDs less than or equal to 10 from the school bus table?

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


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

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


Question: What is the highest People ID from the employment table for people who worked in year 1, combined with the highest People ID from the people table for those who didn't graduate from Wisconsin–Stevens Point or are not from the United States?

SELECT MAX(People_ID) FROM employment WHERE "Year_working" = 1 UNION ALL SELECT MAX(People_ID) FROM people WHERE Graduation_College != "Wisconsin–Stevens Point" OR Nationality != "United States"


Question: Which product IDs are associated with stores having an ID of 3 or greater, or are product ID 1, but are also associated with stores having an ID of 3 or greater, excluding product ID 1?

SELECT Product_ID FROM store_product WHERE "Store_ID" >= 3 OR "Product_ID" = 1 INTERSECT SELECT Product_ID FROM store_product WHERE "Product_ID" != 1 AND "Store_ID" >= 3


Question: Can you list the Branch ID, total pounds, and year for all purchases where the total pounds is less than or equal to 343.76, or the year is not 2018, or the Branch ID is 3, excluding any purchases where the total pounds is greater than or equal to 988.09?

SELECT Branch_ID, Total_pounds, Year FROM purchase WHERE "Total_pounds" <= 343.76 OR Year <> "2018" OR Branch_ID = "3" EXCEPT SELECT Branch_ID, Total_pounds, Year FROM purchase WHERE "Total_pounds" >= 988.09


Question: How many Big Silver counts are there where Small Silver is not 6, Points is 168, and Club ID is not 5, combined with the number of Big Silver counts where Rank is less than 3 or Gold is less than or equal to 12 and Club ID is less than or equal to 1?

SELECT COUNT(Big_Silver) FROM match_result WHERE "Small_Silver" != 6 AND "Points" = 168 AND "Club_ID" <> 5 UNION SELECT COUNT(Big_Silver) FROM match_result WHERE "Rank" < 3 OR "Gold" <= 12 AND "Club_ID" <= 1


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

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


Question: Could you give me the document IDs and draft numbers that appear in both the circulation history where the employee ID is less than 1, the copy number is less than 4, the draft number is not 2, or the document ID is not 20, and in the document drafts where the document ID is greater than 12 or the draft number is less than or equal to 20?

SELECT document_id, draft_number FROM Circulation_History WHERE "employee_id" < 1 AND "copy_number" < 4 OR "draft_number" != 2 OR "document_id" != 20 INTERSECT SELECT document_id, draft_number FROM Document_Drafts WHERE "document_id" > 12 OR "draft_number" <= 20


Question: How many of each type of property feature, excluding those described as "odio", "illo", or associated with property ID 6, and including those described as "Swimming Pool.", are associated with each property? Also, don't count "Pool" as a feature name.

SELECT COUNT(T1.feature_id), T2.property_id FROM Other_Available_Features as T1 JOIN Other_Property_Features as T2 ON T1.feature_id = T2.feature_id WHERE property_feature_description <> "odio" AND feature_name <> "Pool" OR feature_description = "Swimming Pool." GROUP BY property_feature_description HAVING property_id <> 6 AND property_feature_description <> "illo"


Question: Can you list the description and maximum gross weight of CH-53E Super Stallion aircraft with a maximum disk loading of 8.8 lb/ft² (43 kg/m²) where the maximum gross weight is not 3,200 lb (1,451 kg) or where the total disk area is not 5,655 ft² (526 m²), and also include the description and maximum gross weight of all aircraft with a maximum gross weight of 73,500 lb (33,300 kg) that don't have an Aircraft ID of 4?

Light utility helicopter
1,370 lb (635 kg)

Turboshaft utility helicopter
3,200 lb (1,451 kg)

Heavy-lift helicopter
123,500 lb (56,000 kg)

Heavy-lift helicopter
73,500 lb (33,300 kg)

Heavy-lift helicopter
73,500 lb (33,300 kg)

SELECT Description, Max_Gross_Weight FROM aircraft WHERE Max_Gross_Weight != "3,200 lb (1,451 kg)" AND Aircraft = "CH-53E Super Stallion" AND Max_disk_Loading = "8.8 lb/ft² (43 kg/m²)" OR Total_disk_area != "5,655 ft² (526 m²)" UNION ALL SELECT Description, Max_Gross_Weight FROM aircraft WHERE Max_Gross_Weight = "73,500 lb (33,300 kg)" AND "Aircraft_ID" <> 4


Question: Can you give me a list of driver IDs less than 8 that appear in the driver table, excluding any driver IDs less than 9 that are also in the school bus table?

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


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


Question: Can you give me a list of driver IDs, up to 8, that are in the driver table but not in the school_bus table, where only driver IDs up to 10 are considered 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 a list of driver IDs, including those from the driver table that are not 11, and those from the school bus table that are greater than 9?

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


Question: Can you show me the maximum disk loading, aircraft ID, and aircraft name from the aircraft table where the aircraft is a "CH-47D Chinook" and the total disk area is "872 ft² (81.1 m²)" and the description is not "Light utility helicopter", or where the maximum gross weight is not "73,500 lb (33,300 kg)", or the aircraft ID is less than or equal to 2, combined with the maximum disk loading, aircraft ID, and aircraft name where the total disk area is "8,495 ft² (789 m²)" or the maximum disk loading is not "14.5 lb/ft² (71 kg/m²)" and the aircraft ID is greater than 2, or the aircraft is a "CH-47D Chinook"?

15 lb/ft² (72 kg/m²)
5
CH-53E Super Stallion

3.7 lb/ft² (18 kg/m²)
2
Bell 206B3 JetRanger

SELECT Max_disk_Loading, Aircraft_ID, Aircraft FROM aircraft WHERE Aircraft = "CH-47D Chinook" AND Total_disk_area = "872 ft² (81.1 m²)" AND Description != "Light utility helicopter" OR Max_Gross_Weight != "73,500 lb (33,300 kg)" OR "Aircraft_ID" <= 2 UNION SELECT Max_disk_Loading, Aircraft_ID, Aircraft FROM aircraft WHERE Total_disk_area = "8,495 ft² (789 m²)" OR Max_disk_Loading <> "14.5 lb/ft² (71 kg/m²)" AND "Aircraft_ID" > 2 OR Aircraft = "CH-47D Chinook"


Question: Can you give me a list of aircraft IDs from the aircraft table that are 5 or less, excluding any aircraft IDs from the airport_aircraft table that are greater than 3?

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


Question: Could you give me the head IDs that belong to heads who are not Franklin Langham, and also belong to management with a head ID of 5 or a department ID greater than 11, excluding those with temporary acting status of "Yes"?

SELECT head_ID FROM head WHERE name != "Franklin Langham" INTERSECT SELECT head_ID FROM management WHERE "head_ID" = 5 OR "department_ID" > 11 AND temporary_acting <> "Yes"


Question: Can you list all the aircraft IDs, first from the aircraft table excluding ID 2, and then from the airport_aircraft table including only IDs up to 3, combining the two lists?

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


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


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

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


Question: What is the total of role descriptions for roles with the code "ED" or a description other than "Photo", combined with the total of role descriptions for roles with the description "Photo" or a code not equal to "MG"?

SELECT SUM(role_description) FROM Roles WHERE role_code = "ED" OR role_description != "Photo" UNION SELECT SUM(role_description) FROM Roles WHERE role_description = "Photo" OR role_code <> "MG"


Question: What is the total number of car makers, excluding Daimler Benz or those not from country 4, combined with the total number of model list entries where the model is not Datsun, the ModelId is less than or equal to 22, and the Maker is less than 5?

SELECT SUM(Maker) FROM car_makers WHERE Maker != "daimler benz" OR Country != "4" UNION ALL SELECT SUM(Maker) FROM model_list WHERE Model <> "datsun" AND "ModelId" <= 22 AND "Maker" < 5


Question: Can you give me a list of album IDs that are greater than 116 or have a title that isn't "No Security", along with a list of media type IDs where the name is "AAC audio file" or the ID is greater than 4?

SELECT id FROM albums WHERE "id" > 116 OR title != "No Security" UNION ALL SELECT id FROM media_types WHERE name = "AAC audio file" OR "id" > 4


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

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


Question: What aircraft IDs, excluding ID 4, are present in the aircraft table and also have an ID of 1 or greater 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: Which driver IDs are greater than 7 and also greater than 4 in the school bus records?

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


Question: Which driver has an ID of 7, but is not a driver with an ID less than 7 in the school bus table?

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


Question: Can you give me the template type codes that are either not "CV" or don't have the description "Paper" and are also associated with templates that either don't have a template ID of 11 or have a template type code of "BK"?

SELECT Template_Type_Code FROM Ref_Template_Types WHERE Template_Type_Code != "CV" OR Template_Type_Description <> "Paper" INTERSECT SELECT Template_Type_Code FROM Templates WHERE "Template_ID" <> 11 OR Template_Type_Code = "BK"


Question: Can you list all the driver IDs that are equal to 1, and also list all driver IDs 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 that are less than 9 from the driver table, combined with a list of driver IDs that are exactly 7 from the school_bus table?

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


Question: Can you give me a list of employee IDs, including those of employees who aren't named George Chuter, and those from the hiring table who are full-time and not associated with shop ID 1?

SELECT Employee_ID FROM employee WHERE Name <> "George Chuter" UNION SELECT Employee_ID FROM hiring WHERE Is_full_time = "T" AND "Shop_ID" != 1


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

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


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

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


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

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


Question: Can you give me the smallest flight ID where the company ID is 11 and the airport ID is less than 2, or where the flight number isn't "M2-F1 #14" and the altitude isn't 3650, but only if it also matches the smallest operate company ID where the name isn't "Cathay Pacific Catering Services (HK) Limited" and the principal activities aren't "Laundry", or the type isn't "Joint Venture" and the group equity shareholding is 100 and the ID is at least 10, or it's incorporated in "Hong Kong"?

SELECT MIN(id) FROM flight WHERE "company_id" = 11 AND "airport_id" < 2 OR Vehicle_Flight_number <> "M2-F1 #14" AND "Altitude" <> 3650.0 INTERSECT SELECT MIN(id) FROM operate_company WHERE name != "Cathay Pacific Catering Services (HK) Limited" AND Principal_activities <> "Laundry" OR Type <> "Joint Venture" AND "Group_Equity_Shareholding" = 100.0 AND "id" >= 10 OR Incorporated_in = "Hong Kong"


Question: Which driver has an ID of 10 and also drives a school bus, but not bus number 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 not equal to 2 and are also less than or equal to 9?

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


Question: Can you give me a list of driver IDs, including driver ID 9 from the driver table and driver IDs up to 7 from the school bus table?

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


Question: Can you give me a list of driver IDs that are less than 9 from the driver table, excluding any driver IDs that are less than or equal to 9 from 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 driver IDs that are less than 10, but also greater than 4 and used in school buses?

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


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

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