Question: What are the manager names, shop IDs, and number of products for shops that satisfy the following conditions: either the shop name is "IFK Mariehamn", the manager name is "Antti Muurinen", or the district is not "Veritas Stadion", the shop ID is less than 6, the location is not "Turku", and the number of products is not 3516; and also satisfy these conditions: either the shop name is not "FC Inter", the manager name is not "Job Dragtsma", the location is not "Kotka", the district is not "Magnum Areena", the number of products is 10770, and the shop ID is not 8?

SELECT Manager_name, Shop_ID, Number_products FROM shop WHERE Name = "IFK Mariehamn" OR Manager_name = "Antti Muurinen" OR District <> "Veritas Stadion" AND "Shop_ID" < 6 AND Location != "Turku" AND "Number_products" != 3516 INTERSECT SELECT Manager_name, Shop_ID, Number_products FROM shop WHERE Name <> "FC Inter" OR Manager_name <> "Job Dragtsma" AND Location != "Kotka" AND District != "Magnum Areena" AND "Number_products" = 10770 AND "Shop_ID" <> 8


Question: What are the aircraft IDs that are less than or equal to 1, but not equal to 3, based on the aircraft and airport aircraft data?

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 driver IDs are in the driver table but not in the school bus table, excluding driver ID 5 from the driver table and driver IDs 9 or less 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 <= 9


Question: What are the driver IDs that are greater than or equal to 2, and also the driver IDs from school buses that are not equal to 3?

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


Question: What is the total number of students who own pets that are not dogs, and what are the ages of those pets?

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


Question: What are the company IDs of employees who are not person ID 4 or who have been working for 4 years?

SELECT Company_ID FROM employment WHERE "People_ID" != 4 UNION SELECT Company_ID FROM employment WHERE "Year_working" = 4


Question: Which driver IDs are not 3 from the driver table, combined with driver IDs that are 3 from the school bus table?

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


Question: What are the driver IDs that are both less than or equal to 6 and also appear in the school bus table with driver IDs less than or equal to 3?

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


Question: What are the IDs of albums where the artist ID is 17 or the ID is greater than 15 and the title is "Transmission", combined with the IDs of employees whose postal code is not "T5K 2N1"?

SELECT id FROM albums WHERE "artist_id" = 17 OR "id" > 15 AND title = "Transmission" UNION SELECT id FROM employees WHERE postal_code != "T5K 2N1"


Question: Which driver IDs are greater than 8, or are driver IDs from school buses that are less than or equal to 10?

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


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

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


Question: What are the aircraft IDs that appear in either the aircraft table with an ID of 3 or greater, or in the airport_aircraft table with an ID of 1 or greater?

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


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

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


Question: What are the document descriptions, other details, and template IDs for documents where the template ID is 22 or the document name isn't "Understanding DB", and also for documents where the template ID is greater than 11, the document ID is less than or equal to 1, or the document name is not "Learning French"?

SELECT Document_Description, Other_Details, Template_ID FROM Documents WHERE "Template_ID" = 22 OR Document_Name <> "Understanding DB" INTERSECT SELECT Document_Description, Other_Details, Template_ID FROM Documents WHERE "Template_ID" > 11 OR "Document_ID" <= 1 OR Document_Name != "Learning French"


Question: What are the aircraft IDs, excluding ID 1, from the aircraft table, and also the aircraft IDs up to 2 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 <= 2


Question: What are the document IDs from the circulation history where the copy number is 10 or less, or the employee ID is not 2, combined with the document IDs from the mailed documents where the address ID is not 8?

SELECT document_id FROM Circulation_History WHERE "copy_number" <= 10 OR "employee_id" != 2 UNION SELECT document_id FROM Documents_Mailed WHERE "mailed_to_address_id" <> 8


Question: What are the aircraft IDs that are not 2, and also the aircraft IDs greater than 5, considering both the aircraft and airport_aircraft tables?

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


Question: For each headquartered city, give me the average district ID, the number of districts, the maximum city population, the city itself, and the maximum city area, but only if the number of districts is not one, the maximum city population is less than or equal to 2,793,721, and the average district ID is less than or equal to 12, or if the maximum city population is greater than 530,438 and the number of districts is not one, or if the maximum city area is 28 and the average district ID is less than 15.

SELECT AVG(District_ID), COUNT(District_name), MAX(City_Population), Headquartered_City, MAX(City_Area) FROM district GROUP BY Headquartered_City HAVING COUNT(District_name) <> 1 AND MAX(City_Population) <= 2793721.0 AND AVG(District_ID) <= 12.0 UNION SELECT AVG(District_ID), COUNT(District_name), MAX(City_Population), Headquartered_City, MAX(City_Area) FROM district GROUP BY Headquartered_City HAVING MAX(City_Population) > 530438.0 AND COUNT(District_name) != 1 OR MAX(City_Area) = 28.0 AND AVG(District_ID) < 15.0


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

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


Question: What are the driver IDs, excluding ID 11, that are present in the driver table and also present in the school bus table, excluding ID 3?

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: What are the aircraft IDs, excluding aircraft ID 5, and also the aircraft IDs that are less than or equal to 1?

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


Question: Which driver IDs are not equal to 1, and which driver ID is equal to 10?

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


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

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


Question: What are the decor, maximum occupancy, room name, bed type, base price, room ID, and number of beds for rooms where the base price is over 150, the maximum occupancy is not 2, the bed type is not King, and the room name is not "Interim but salutary" or the number of beds is 2 or less? Also, what are the same details for rooms where the room ID is "AOB", the base price is less than 175, the number of beds is less than 2, or the decor is modern?

decor maxOccupancy roomName bedType basePrice RoomId beds

SELECT decor, maxOccupancy, roomName, bedType, basePrice, RoomId, beds FROM Rooms WHERE "basePrice" > 150 AND "maxOccupancy" <> 2 AND bedType <> "King" AND roomName <> "Interim but salutary" OR "beds" <= 2 UNION ALL SELECT decor, maxOccupancy, roomName, bedType, basePrice, RoomId, beds FROM Rooms WHERE RoomId = "AOB" OR "basePrice" < 175 OR "beds" < 2 OR decor = "modern"


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

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


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

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


Question: What are the payment amounts and customer IDs for payments that are not credit card payments, with amounts less than or equal to 6970.98 and customer IDs greater than 2, or with payment dates not equal to March 12, 2018, at 8:41:47 AM? Also, include the payment amounts and customer IDs for customers with IDs less than 2.

SELECT amount_payment, customer_id FROM Customer_Payments WHERE payment_method_code <> "Credit Card" AND "amount_payment" <= 6970.98 AND "customer_id" > 2 OR datetime_payment <> "2018-03-12 08:41:47" UNION SELECT amount_payment, customer_id FROM Customer_Payments WHERE "customer_id" < 2


Question: What are the club IDs of clubs that started before 1998 or are not in the USA, but not including any club IDs where the coach isn't Jameson Tomas, or the coach ID is greater than 2, or the rank is less than 5, or the club ID is 1 or greater, or the gender is male?

SELECT Club_ID FROM club WHERE "Start_year" < 1998 OR Region <> "USA" EXCEPT SELECT Club_ID FROM coach WHERE Coach_name <> "Jameson Tomas" OR "Coach_ID" > 2 OR "Rank" < 5 OR "Club_ID" >= 1 OR Gender = "M"


Question: Which driver IDs are less than 10 from the driver table, and also driver ID 3 from the school bus table?

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


Question: What are the ranking, number of product categories, store ID, and area size for stores where the number of product categories is at least 1678 or the area size is greater than 28.74 and the store ID is not 2, and also for stores where the area size is greater than 26.69?

SELECT Ranking, Number_of_product_category, Store_ID, Area_size FROM store WHERE "Number_of_product_category" >= 1678.0 OR "Area_size" > 28.74 AND "Store_ID" <> 2 UNION ALL SELECT Ranking, Number_of_product_category, Store_ID, Area_size FROM store WHERE "Area_size" > 26.69


Question: What are the driver IDs that are either less than or equal to 7 from the driver table or greater than or equal to 3 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 >= 3


Question: Which driver IDs are not equal to 7 and are present in the driver table but not in the school bus table, where the school bus driver IDs 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: What are the driver IDs that are greater than or equal to 1, but not found in the school bus table with driver IDs less than 7?

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


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

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


Question: Which driver IDs are greater than or equal to 3 but not less than 10, considering only those IDs present in the driver table but not the school bus table?

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


Question: What are the aircraft IDs that are not 1 and are present in the aircraft table but not in the airport_aircraft table, where the airport_aircraft table only includes aircraft IDs less than 2?

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


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

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


Question: Which driver IDs are greater than or equal to 10, excluding those with IDs less than 9 in the school bus records?

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


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

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


Question: What are the IDs of documents that are either not drafts marked as "p" or were mailed to an address other than ID 5?

SELECT document_id FROM Document_Drafts WHERE draft_details <> "p" UNION SELECT document_id FROM Documents_Mailed WHERE "mailed_to_address_id" != 5


Question: Which driver IDs, excluding driver ID 3, are greater than 10 and appear in the driver table but not in the school bus table?

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


Question: Which store IDs meet at least one of the following conditions: the store name isn't Rogersville and the ranking isn't 3, or the store ID is 2 and the area size is less than or equal to 179.84, or the store type isn't Village Store, or the number of product categories is greater than 1170; or have a product ID less than 6 in the store_product table?

SELECT Store_ID FROM store WHERE Store_Name <> "Rogersville" AND "Ranking" <> 3 OR "Store_ID" = 2 AND "Area_size" <= 179.84 OR Type != "Village Store" OR "Number_of_product_category" > 1170.0 UNION SELECT Store_ID FROM store_product WHERE "Product_ID" < 6


Question: What are the average interface and product values, and the maximum page size, for products where the DPI is greater than 600, or the dimensions are not "300 x 50 x 45", or the interface is not "USB 2.0" and the product ID is 3 and the product is not "Fujitsu fi-6130 A4 Series Scanner", excluding those products where the interface is "USB 2.0", the maximum page size is not "A4", and the dimensions are not "298 x 209 x 99"?

SELECT AVG(interface), max_page_size, AVG(product) FROM product WHERE "dpi" > 600.0 OR dimensions <> "300 x 50 x 45" OR interface <> "USB 2.0" AND "product_id" = 3 AND product <> "Fujitsu fi-6130 A4 Series Scanner" EXCEPT SELECT AVG(interface), max_page_size, AVG(product) FROM product WHERE interface = "USB 2.0" AND max_page_size <> "A4" AND dimensions != "298 x 209 x 99"


Question: What are the IDs of drivers, excluding driver ID 5, and the IDs of school buses, excluding ID 4?

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


Question: What are the member IDs, total pounds, and years for purchases in 2018, excluding those with a member ID of 1 or a total of 2013.32, but including those with a total not equal to 321.13 and a branch ID not equal to 6?

SELECT Member_ID, Total_pounds, Year FROM purchase WHERE "Member_ID" != 1 AND "Total_pounds" != 2013.32 AND Year = "2018" EXCEPT SELECT Member_ID, Total_pounds, Year FROM purchase WHERE "Total_pounds" <> 321.13 AND Branch_ID <> "6"


Question: What are the driver IDs greater than 2 that are in the driver table but not in the school bus table, where the driver IDs in the school bus table 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: What are the driver IDs that are both less than 10 and also equal to 7?

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


Question: What are the aircraft IDs greater than 4 that are not present in the airport aircraft table with an ID of 1?

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


Question: Which driver IDs, excluding driver ID 12, are present in both the driver and school bus records, but with school bus driver IDs greater than 3?

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


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

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


Question: Which driver IDs are less than or equal to 6, excluding those driver IDs that are greater than 9?

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


Question: What are the item IDs from items that aren't "shampoo", combined with item IDs from reviews where the rank isn't 5 and the item ID is less than or equal to 7, or the user ID is less than 1, or the author ID isn't 3, or the rating is 10 or higher?

SELECT i_id FROM item WHERE title != "shampoo" UNION ALL SELECT i_id FROM review WHERE "rank" <> 5 AND "i_id" <= 7 OR "u_id" < 1 OR "a_id" != 3 OR "rating" >= 10


Question: What are the aircraft IDs, excluding ID 3, from the aircraft table, combined with aircraft IDs less than 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: What are the aircraft IDs that are not 3 and also appear in the airport_aircraft table with an ID less than or equal to 2?

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


Question: What are the driver IDs that are greater than or equal to 9, and also the driver IDs from school buses that are not equal to 10?

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


Question: What are the feature type codes for "BurglarAlarm" features that are not "Air Conditioning.", and also feature types that are not "Amenity, eg Pool."?

SELECT feature_type_code FROM Other_Available_Features WHERE feature_name = "BurglarAlarm" AND feature_description <> "Air Conditioning." INTERSECT SELECT feature_type_code FROM Ref_Feature_Types WHERE feature_type_name <> "Amenity, eg Pool."


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

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


Question: Which driver IDs are not equal to 4 and are present in the driver table but not in the school bus table, where the driver ID is not greater than 4?

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


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

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


Question: What is the average of 'other_details' from the 'Documents' table, excluding documents with ID 1, and also the average of 'other_details' from the 'Employees' table where the role code isn't "PT" or where 'other_details' isn't "v" and the employee ID is less than 2?

SELECT AVG(other_details) FROM Documents WHERE "document_id" <> 1 UNION ALL SELECT AVG(other_details) FROM Employees WHERE role_code != "PT" OR other_details <> "v" AND "employee_id" < 2


Question: What are the driver IDs that are less than 3, excluding those driver IDs that are also less than or equal to 7 in the school bus records?

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: Which driver IDs are equal to 1 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: Which driver IDs are not equal to 5 and are not present in the school bus table with driver IDs less than or equal to 9?

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


Question: What are the aircraft IDs that are less than 4 in the aircraft table, combined with the aircraft IDs that are not 5 in the airport_aircraft table?

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


Question: What are the names and the sum of their user IDs, excluding Nancy or where the user ID is 5, combined with the names and sum of user IDs where the user ID is 1?

SELECT name, SUM(u_id) FROM useracct WHERE name != "Nancy" OR "u_id" = 5 UNION SELECT name, SUM(u_id) FROM useracct WHERE "u_id" = 1


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

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


Question: What is the average document ID from the circulation history where the draft number is greater than 20, excluding the average document ID from draft copies where the document ID is not 12, or the draft number is not 20, or the copy number is less than 15?

SELECT AVG(document_id) FROM Circulation_History WHERE "draft_number" > 20 EXCEPT SELECT AVG(document_id) FROM Draft_Copies WHERE "document_id" <> 12 OR "draft_number" != 20 OR "copy_number" < 15


Question: What are the maximum occupancy, number of beds, room name, and decor for rooms that are not "IBS" and either not priced at 100, or are modern, not double beds, not named "Thrift and accolade", have a maximum occupancy of 2 or less, and have 1 bed, but not for rooms that have more than 2 beds and are not king beds, or are not "IBD", or are not named "Mendicant with cryptic" and have a maximum occupancy of 4?

SELECT maxOccupancy, beds, roomName, decor FROM Rooms WHERE RoomId != "IBS" AND "basePrice" <> 100 OR decor = "modern" AND bedType <> "Double" AND roomName <> "Thrift and accolade" AND "maxOccupancy" <= 2 AND "beds" = 1 EXCEPT SELECT maxOccupancy, beds, roomName, decor FROM Rooms WHERE "beds" > 2 AND bedType <> "King" AND RoomId <> "IBD" OR roomName != "Mendicant with cryptic" AND "maxOccupancy" = 4


Question: Which driver IDs are greater than 8 but not less than 7, considering driver and school bus information?

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


Question: What are the driver IDs that are either 3 or less, or 9 or more?

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: What are the aircraft IDs that are less than or equal to 5, but not aircraft IDs greater than 3 that are present in the airport data?

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


Question: What is the average of 'other_details' from the 'Documents' table where the 'document_type_code' is not "Paper" or the 'document_id' is less than or equal to 17, combined with the average of 'other_details' from the 'Employees' table where the 'role_code' is "PT", or 'other_details' is "u", or the 'employee_id' is not 7 and the 'employee_name' is not "Haley"?

SELECT AVG(other_details) FROM Documents WHERE document_type_code != "Paper" OR "document_id" <= 17 UNION ALL SELECT AVG(other_details) FROM Employees WHERE role_code = "PT" OR other_details = "u" OR "employee_id" != 7 AND employee_name != "Haley"


Question: What are the aircraft IDs that are greater than 2 in the aircraft table and also equal to 3 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 = 3


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

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


Question: What are the driver IDs that are present in both the driver and school bus tables, excluding driver ID 9 from the driver table and including driver IDs greater than or equal to 9 from the school bus table?

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


Question: What are the names of employees who are not Steve Borthwick and have an employee ID greater than 5, or are younger than 23, or live in Leicester, combined with the names of shops where the manager is not Mika Laurikainen, or the district is not Tapiolan Urheilupuisto and the shop ID is less than or equal to 1, or the location is not Lahti, or the shop name is not FC Honka and has 10770 or fewer products?

SELECT Name FROM employee WHERE Name != "Steve Borthwick" AND "Employee_ID" > 5 OR "Age" < 23 OR City = "Leicester" UNION SELECT Name FROM shop WHERE Manager_name <> "Mika Laurikainen" OR District != "Tapiolan Urheilupuisto" AND "Shop_ID" <= 1 OR Location <> "Lahti" OR Name != "FC Honka" AND "Number_products" <= 10770


Question: Which driver IDs are associated with either a driver or a school bus, excluding driver ID 12 for drivers and driver ID 7 for school buses?

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


Question: Which driver IDs are in either the driver table (excluding ID 6) or the school bus table (with IDs greater than 3)?

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


Question: Which aircraft have ID 5, and which aircraft have IDs other than 5, considering information from both the aircraft and airport_aircraft tables?

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


Question: Which employee IDs are associated with documents having IDs less than 1 or draft numbers less than 1 and copy numbers less than 10, or who have a role code that isn't "PT"?

SELECT employee_id FROM Circulation_History WHERE "document_id" < 1 OR "draft_number" < 1 AND "copy_number" < 10 UNION SELECT employee_id FROM Employees WHERE role_code <> "PT"


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

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


Question: What are the feature type names that are not "Amenity" or are "Amenity, eg Pool.", and also what are the feature type names that are not "Security"?

SELECT feature_type_name FROM Ref_Feature_Types WHERE feature_type_code <> "Amenity" OR feature_type_name = "Amenity, eg Pool." UNION ALL SELECT feature_type_name FROM Ref_Feature_Types WHERE feature_type_code != "Security"


Question: What are the driver IDs from the driver table, and also the driver IDs from the school bus table, where the driver ID is at least 1 in the driver table and at least 10 in the school bus table?

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


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

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


Question: What are the minimum locations, shop IDs, districts, manager names, and number of products for shops that are not named "FC Inter" and have at least 3516 products, or are located in "Jakobstad", or have a manager name other than "Mika Laurikainen"? Also, what are the minimum locations, shop IDs, districts, manager names, and number of products for shops managed by "Kai Nyyssönen", or where the shop ID is not 1 and the district is not "Jakobstads Centralplan" and the location is not "Turku", or where the number of products is at least 6000 and the name is not "IFK Mariehamn"?

SELECT MIN(Location), Shop_ID, District, Manager_name, Number_products FROM shop WHERE Name <> "FC Inter" AND "Number_products" >= 3516 OR Location = "Jakobstad" OR Manager_name <> "Mika Laurikainen" UNION SELECT MIN(Location), Shop_ID, District, Manager_name, Number_products FROM shop WHERE Manager_name = "Kai Nyyssönen" OR "Shop_ID" <> 1 AND District <> "Jakobstads Centralplan" AND Location != "Turku" OR "Number_products" >= 6000 AND Name != "IFK Mariehamn"


Question: What are the driver IDs that are equal to 3, but not driver IDs greater than 7, considering the drivers and school buses?

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: What is the maximum driver ID and the number of years worked for drivers who either don't live in Manchester and work at school ID 1, are older than 46 and have worked a total of more than 8 years, are affiliated with the "Dem" party, or are named "Douglas McCrory" and work full-time?

SELECT MAX(T1.Driver_ID), T2.Years_Working FROM driver as T1 JOIN school_bus as T2 ON T1.Driver_ID = T2.Driver_ID WHERE Home_city <> "Manchester" AND School_ID = 1 OR Age > 46 AND SUM(Years_Working) > 8 OR Party = "Dem" OR Name = "Douglas McCrory" AND If_full_time = "T"


Question: Find the minimum company ID, maximum velocity, minimum pilot, and average ID for flights, excluding those with vehicle flight number "M2-F1 #73". Also, find the same statistics for flights where the altitude is not 3650.0, or the vehicle flight number is not "M2-F1 #70", or the airport ID is less than 4, or the pilot is not Thompson and the date is not July 16, 1965, and the ID is less than or equal to 5 and the velocity is greater than or equal to 240.0.

MIN(company_id) MAX(Velocity) MIN(Pilot) AVG(id)

SELECT MIN(company_id), MAX(Velocity), MIN(Pilot), AVG(id) FROM flight WHERE Vehicle_Flight_number <> "M2-F1 #73" UNION ALL SELECT MIN(company_id), MAX(Velocity), MIN(Pilot), AVG(id) FROM flight WHERE "Altitude" != 3650.0 OR Vehicle_Flight_number <> "M2-F1 #70" OR "airport_id" < 4 OR Pilot != "Thompson" AND Date != "July 16, 1965" AND "id" <= 5 AND "Velocity" >= 240.0


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

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


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

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


Question: What are the aircraft IDs greater than 1, considering both the aircraft and airport_aircraft tables?

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: Which driver IDs are greater than 8 but not greater than 9, considering only those driver IDs present in the 'driver' table and excluding those in the 'school_bus' table?

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


Question: What are the driver IDs that are less than 3, excluding those driver IDs from the school bus table that are less than 10?

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


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

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


Question: What are the driver IDs that are both less than 12 and also appear in the school bus table with IDs less than or equal to 7?

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


Question: Which driver IDs are greater than 8 but not present in the school bus table, excluding driver ID 3?

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


Question: What are the driver IDs, excluding driver ID 9, and also the driver IDs from school buses that are 9 or less?

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


Question: What are the driver IDs that are greater than or equal to 5, excluding those driver IDs that are greater than 10?

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


Question: What is the average feature description for features with an ID greater than 2, combined with the average feature description for features that are not "Security", not "Burglar Alarm", have the name "Pool", or have an ID less than or equal to 4?

SELECT AVG(feature_description) FROM Other_Available_Features WHERE "feature_id" > 2 UNION SELECT AVG(feature_description) FROM Other_Available_Features WHERE feature_type_code <> "Security" AND feature_description <> "Burglar Alarm" AND feature_name = "Pool" OR "feature_id" <= 4


Question: Which aircraft IDs are not equal to 1 but are not present in the airport_aircraft table with an aircraft ID of 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: What are the driver IDs that are either 7 from the driver table or 3 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 = 3


Question: What are the aircraft IDs that are either aircraft ID 4 or aircraft IDs less than 2 in the airport aircraft table?

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


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

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


Question: Which driver IDs are either at least 2 in the driver table or at least 7 in the school bus table?

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


Question: What are the aircraft IDs that are equal to 5 in the aircraft table, but not greater than 5 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: Which aircraft IDs are not equal to 2, but are not present in the airport aircraft table where the aircraft ID is greater than 1?

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


Question: What are the aircraft IDs that are present in the aircraft table with an ID greater than or equal to 1, but not present in the airport_aircraft table with an ID greater than 1?

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: What are the driver IDs that are less than 11, and also the driver IDs from the school bus table that are not 7?

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


Question: Which aircraft IDs are not equal to 4 and are present in the aircraft table but not in the airport_aircraft table with an ID of 5?

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


Question: What are the aircraft IDs that are equal to 4 in the aircraft table but not in the airport_aircraft table with aircraft IDs greater than or equal to 1?

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


Question: Which driver IDs are in the driver table but not in the school bus table, excluding driver ID 12 from the driver table and driver IDs greater than 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: What are the driver IDs less than 9, excluding driver ID 7?

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


Question: What are the driver IDs that are either greater than or equal to 8 in the driver table or less than or equal to 10 in 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: What are the hometown, name, card number, member ID, and level of members who are either named Micah Johnson, not from LaGrange, Georgia, and not have card number OLB56, or have a member ID less than or equal to 10, and also have a member ID greater than or equal to 8?

SELECT Hometown, Name, Card_Number, Member_ID, Level FROM member WHERE Name = "Micah Johnson" AND Hometown <> "LaGrange, Georgia" AND Card_Number <> "OLB56" OR "Member_ID" <= 10 INTERSECT SELECT Hometown, Name, Card_Number, Member_ID, Level FROM member WHERE "Member_ID" >= 8


Question: What are the member IDs of members with card number "LE99" or a name that isn't "Myron Pryor", combined with the member IDs from the branch with ID "4" where the registration year isn't "2016" or the member ID is less than or equal to 3?

SELECT Member_ID FROM member WHERE Card_Number = "LE99" OR Name != "Myron Pryor" UNION ALL SELECT Member_ID FROM membership_register_branch WHERE Register_Year != "2016" AND Branch_ID = "4" OR "Member_ID" <= 3


Question: What role codes do employees with "b" in their other details and roles that are not "ED" have in common?

SELECT role_code FROM Employees WHERE other_details = "b" INTERSECT SELECT role_code FROM Roles WHERE role_code != "ED"


Question: What is the average rank, minimum votes, and sponsor name for players, grouped by residence, considering players who are not locomotive engineers or have a rank of 1st and a sponsor name other than Winnipeg South, or have a player ID of 3, or have the name Ross C. Martin and a residence other than Winnipeg? Also, what is the average rank, minimum votes, and sponsor name for players, grouped by residence, considering players with votes less than or equal to 9506, or a rank of 3rd and the name Jim Maloway, or a residence of Birtle, a player ID not equal to 11, a sponsor name other than Selkirk—Interlake, an occupation of student, and a gender of M?

AVG(Rank) Residence MIN(Votes) Sponsor_name

SELECT AVG(Rank), Residence, MIN(Votes), Sponsor_name FROM player WHERE Occupation <> "Locomotive Engineer" OR Rank = "1st" AND Sponsor_name <> "Winnipeg South" OR "Player_ID" = 3 OR Player_name = "Ross C. Martin" AND Residence <> "Winnipeg" UNION SELECT AVG(Rank), Residence, MIN(Votes), Sponsor_name FROM player WHERE "Votes" <= 9506 OR Rank = "3rd" AND Player_name = "Jim Maloway" OR Residence = "Birtle" AND "Player_ID" != 11 AND Sponsor_name <> "Selkirk—Interlake" AND Occupation = "Student" AND Gender = "M"


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

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


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

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


Question: For each shop, give me the sum of employee IDs, whether they are full-time, and the start date. Include employees where the employee ID is not 2 or are full-time, and also include employees who are not full-time or whose start date isn't 2010, shop ID isn't 1, and employee ID is 4.

SELECT Shop_ID, SUM(Employee_ID), Is_full_time, Start_from FROM hiring WHERE "Employee_ID" <> 2 OR Is_full_time = "T" UNION ALL SELECT Shop_ID, SUM(Employee_ID), Is_full_time, Start_from FROM hiring WHERE Is_full_time = "F" OR Start_from <> "2010" AND "Shop_ID" <> 1 AND "Employee_ID" = 4


Question: What are the aircraft IDs, excluding those greater than 1 in the airport_aircraft table, but not including aircraft ID 4 from the aircraft table?

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


Question: Which driver IDs are 10 or which driver IDs are 4, considering driver IDs from both the driver and school bus tables?

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


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

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


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

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


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

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


Question: What are the customer IDs that have a payment amount less than 9414.74 and a customer ID less than or equal to 4, or a payment method that isn't Direct Debit, and also have a lesson on March 5th, 2018 at 18:05:31 or a staff ID less than 3?

SELECT customer_id FROM Customer_Payments WHERE "amount_payment" < 9414.74 AND "customer_id" <= 4 OR payment_method_code != "Direct Debit" INTERSECT SELECT customer_id FROM Lessons WHERE lesson_date = "2018-03-05 18:05:31" OR "staff_id" < 3


Question: Which driver IDs are either 11 or greater than 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: Which driver IDs are greater than 8 but not greater than 9, considering only driver IDs from the driver table and excluding those from the school bus table?

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


Question: What is the sum of 'other_details' from the 'Documents' table where the receipt number is "189" and the document ID is less than or equal to 17, and also the sum of 'other_details' from the 'Employees' table where the employee name is "Clemens", the employee ID is not 1, the other details are not "u", and the role code is not "PT"?

SELECT SUM(other_details) FROM Documents WHERE receipt_number = "189" AND "document_id" <= 17 INTERSECT SELECT SUM(other_details) FROM Employees WHERE employee_name = "Clemens" AND "employee_id" != 1 AND other_details != "u" AND role_code <> "PT"


Question: What are the aircraft IDs greater than 4, and also the aircraft IDs that are not 3, considering both the aircraft and airport-aircraft tables?

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


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

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


Question: What are the user IDs of reviews with a rating of 7 or less, or where the user ID is at least 1, the rank is 6, and the item ID is 7, or where the account ID is at least 3, combined with the user IDs of users named Helen?

SELECT u_id FROM review WHERE "rating" <= 7 OR "u_id" >= 1 AND "rank" = 6 AND "i_id" = 7 OR "a_id" >= 3 UNION SELECT u_id FROM useracct WHERE name = "Helen"


Question: What are the aircraft IDs greater than 2, considering both the aircraft and airport_aircraft tables?

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: How many contestants have a contestant number of 9 or greater and are not named Tabatha Gehling, combined with the number of contestants who have a contestant number of 4 or are not named Jessie Alloway?

SELECT COUNT(contestant_number) FROM CONTESTANTS WHERE "contestant_number" >= 9 AND contestant_name != "Tabatha Gehling" UNION SELECT COUNT(contestant_number) FROM CONTESTANTS WHERE "contestant_number" = 4 OR contestant_name <> "Jessie Alloway"


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

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


Question: What are the driver IDs that are not 8 and also appear in the school bus table with driver IDs less than or equal to 7?

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


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

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


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

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


Question: Which driver IDs are present in both the driver table (excluding driver ID 5) and the school bus table (with driver ID 3)?

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


Question: What are the aircraft IDs that are less than or equal to 5, but not present in the airport aircraft table with IDs greater than 5?

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

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


Question: What are the minimum mailed to address IDs and document IDs for documents where the document ID is 14 or greater or the mailed to address ID is 4, and also for documents mailed on May 22, 1999 at 23:21:07?

SELECT MIN(mailed_to_address_id), document_id FROM Documents_Mailed WHERE "document_id" >= 14 OR "mailed_to_address_id" = 4 UNION SELECT MIN(mailed_to_address_id), document_id FROM Documents_Mailed WHERE mailing_date = "1999-05-22 23:21:07"


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

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

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


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

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


Question: What are the lesson IDs, prices, lesson status codes, customer IDs, staff IDs, and lesson times for lessons that meet the following criteria: either the vehicle ID is less than or equal to 2, or the lesson status is not "Completed", or the lesson date is not "2018-03-16 07:08:52" and the price is less than 456.0 and the lesson ID is not 5 and the lesson time is not "5" and the customer ID is not 2; and also meet these criteria: either the customer ID is 10 and the lesson date is not "2018-03-17 19:02:07" and the lesson time is not "3", or the lesson ID is greater than or equal to 14 and the lesson status is "Cancelled", or the price is greater than or equal to 184.0?

SELECT lesson_id, price, lesson_status_code, customer_id, staff_id, lesson_time FROM Lessons WHERE "vehicle_id" <= 2 OR lesson_status_code != "Completed" OR lesson_date != "2018-03-16 07:08:52" AND "price" < 456.0 AND "lesson_id" != 5 AND lesson_time <> "5" AND "customer_id" <> 2 INTERSECT SELECT lesson_id, price, lesson_status_code, customer_id, staff_id, lesson_time FROM Lessons WHERE "customer_id" = 10 AND lesson_date != "2018-03-17 19:02:07" AND lesson_time != "3" OR "lesson_id" >= 14 AND lesson_status_code = "Cancelled" OR "price" >= 184.0


Question: What are the driver IDs that are equal to 1, or are less than or equal to 7?

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


Question: What is the total number of drivers and the school ID, where the driver lives in Hartford, or is named Edwin Vargas, or has a school ID less than 5 and is not full-time, or is younger than 42, or has not worked for 6 years, grouped by school ID, and where the party is not Dem, or has worked for 8 years, or is full-time?

SELECT SUM(T1.Driver_ID), T2.School_ID FROM driver as T1 JOIN school_bus as T2 ON T1.Driver_ID = T2.Driver_ID WHERE Home_city = "Hartford" OR Name = "Edwin Vargas" OR "School_ID" < 5 AND If_full_time <> "T" OR "Age" < 42 OR "Years_Working" <> 6 GROUP BY School_ID HAVING Party <> "Dem" OR Years_Working = 8 OR If_full_time = "T"


Question: Which driver IDs are equal to 10 in either the driver or school bus tables?

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: What are the driver IDs that are less than or equal to 9, excluding those with IDs less than 4, considering only driver IDs?

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


Question: What political parties are there, considering those where the delegate wasn't Gail H. Bates, or the first elected year was after 1994, or the election ID was less than 8, or the district wasn't 1, and also including the Liberal party if the governor wasn't Tom Golisano, or if Hillary Rodham Clinton was the US Senator and Eliot Spitzer was the Attorney General, or if the Lieutenant Governor wasn't Dennis Mehiel?

SELECT Party FROM election WHERE Delegate <> "Bates, Gail H. Gail H. Bates" AND "Party" > 4 OR "First_Elected" > 1994.0 OR "Election_ID" < 8 OR "District" != 1 UNION SELECT Party FROM party WHERE Party = "Liberal" AND Governor != "Tom Golisano" OR US_Senate = "Hillary Rodham Clinton" AND Attorney_General = "Eliot Spitzer" OR Lieutenant_Governor <> "Dennis Mehiel"


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


Question: What is the sum of city areas, the count of headquartered cities, the minimum city population, and the average district name for districts where the headquartered city is not Hafizabad City and the district ID is 8 or the city area is greater than or equal to 22.0 and the district name is not Faisalabad District? Also, what is the sum of city areas, the count of headquartered cities, the minimum city population, and the average district name for districts where the city population is not 94620.0?

SELECT SUM(City_Area), COUNT(Headquartered_City), MIN(City_Population), AVG(District_name) FROM district WHERE Headquartered_City != "Hafizabad City" AND "District_ID" = 8 OR "City_Area" >= 22.0 AND District_name != "Faisalabad District" UNION ALL SELECT SUM(City_Area), COUNT(Headquartered_City), MIN(City_Population), AVG(District_name) FROM district WHERE "City_Population" <> 94620.0


Question: What are the aircraft IDs that are both less than or equal to 3 and also greater than 1, considering only the aircraft IDs present in both the aircraft and airport_aircraft tables?

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


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

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


Question: Which driver IDs are in the driver table but not in the school bus table, excluding driver ID 12 from the driver table and 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: What are the driver IDs that are greater than or equal to 12, excluding those driver IDs that are not equal to 9?

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


Question: What is the sum of document IDs for circulation history entries where the employee ID is not 1, combined with the sum of document IDs from mailed documents where the document ID is less than 20?

SELECT SUM(document_id) FROM Circulation_History WHERE "employee_id" != 1 UNION SELECT SUM(document_id) FROM Documents_Mailed WHERE "document_id" < 20


Question: What are the driver IDs less than 8 that are in the driver table but not in the school bus table, where the driver IDs in the school bus table are less than 7?

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


Question: Which driver IDs, excluding driver ID 2, are present in the driver table but not in the school bus table where the driver ID is 10?

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: What are the staff IDs of lessons that don't occur at time "3", combined with the staff IDs of staff members who aren't nicknamed "sbrown" and didn't join on "2017-10-21 17:20:57"?

SELECT staff_id FROM Lessons WHERE lesson_time != "3" UNION SELECT staff_id FROM Staff WHERE nickname <> "sbrown" AND date_joined_staff != "2017-10-21 17:20:57"


Question: What are the vendor requested prices, along with the maximum property address and oth_feature_3, for properties where shp_feature_1 is not "None", excluding those properties where the property ID is 13 and oth_feature_3 is "None" and shp_feature_1 is "None" or hse_feature_3 is not "None" or apt_feature_1 is not "aut" and the property name is "park" and apt_feature_3 is "None" and the property address is "2088 Bashirian Fork Suite 337 Faustinoport, MT 16771-9320" or fld_feature_1 is "None" or apt_feature_2 is not "sit" or room_count is greater than 9 and shp_feature_3 is not "None" or shp_feature_2 is "None" or other_property_details is not "None" or the date sold is not "2012-08-19 07:36:57" and the date on market is "1990-05-25 23:01:51" and hse_feature_1 is "None"?

SELECT vendor_requested_price, MAX(property_address), MAX(oth_feature_3) FROM Properties WHERE shp_feature_1 != "None" EXCEPT SELECT vendor_requested_price, MAX(property_address), MAX(oth_feature_3) FROM Properties WHERE "property_id" = 13 AND oth_feature_3 = "None" AND shp_feature_1 = "None" OR hse_feature_3 <> "None" OR apt_feature_1 <> "aut" AND property_name = "park" AND apt_feature_3 = "None" AND property_address = "2088 Bashirian Fork Suite 337 Faustinoport, MT 16771-9320" OR fld_feature_1 = "None" OR apt_feature_2 != "sit" OR "room_count" > 9 AND shp_feature_3 != "None" OR shp_feature_2 = "None" OR other_property_details <> "None" OR date_sold <> "2012-08-19 07:36:57" AND date_on_market = "1990-05-25 23:01:51" AND hse_feature_1 = "None"


Question: What are the aircraft IDs that are either aircraft ID 3 or any aircraft ID that is not 2, considering data from both the aircraft and airport_aircraft tables?

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


Question: What are the aircraft IDs, excluding ID 5, that are present in both the aircraft table and the airport_aircraft table, where the airport_aircraft ID is greater than 2?

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: Which driver IDs are equal to 12 but not greater than or equal to 4, considering driver IDs from the driver and school bus tables?

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


Question: What are the aircraft IDs that are in the aircraft table but not in the airport_aircraft table, excluding aircraft ID 4 from the aircraft table and aircraft ID 5 from the airport_aircraft table?

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


Question: What are the driver IDs that are less than 6, and also the driver IDs from school buses that are not 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: What are the aircraft IDs that are greater than or equal to 4, but not present in the airport_aircraft table with IDs greater than or equal to 3?

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


Question: What are the driver IDs that are less than 6 or greater than 10, considering both the driver and school bus records?

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


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

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 are the driver IDs that are both less than 4 in the driver table and equal to 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: Which driver IDs, excluding ID 4, are present in both the driver and school bus records, excluding 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: What are the school IDs from the budget table where the total budget percentage budgeted is greater than 2.4 and the total budget percentage invested is at least 2.7, or where the budgeted amount is less than or equal to 3666, or where the budget invested percentage is 127.6? Also, what are the school IDs from the endowment table where the donator name is not Duarte and the school ID is greater than 8, or where the endowment ID is not 6 and the amount is 9.83? Combine both sets of school IDs.

SELECT School_id FROM budget WHERE "total_budget_percent_budgeted" > 2.4 AND "total_budget_percent_invested" >= 2.7 OR "Budgeted" <= 3666 OR Budget_invested_percent = "127.6" UNION ALL SELECT School_id FROM endowment WHERE donator_name != "Duarte" AND "School_id" > 8 OR "endowment_id" != 6 AND "amount" = 9.83


Question: What are the aircraft IDs that are less than 3, excluding those aircraft IDs 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: What are the student IDs of students with allergies, excluding those whose last name is not "Epp" or whose first name is "David" and are not male, have advisor 8918, are at least 20 years old, and do not live in SFO?

SELECT StuID FROM Has_Allergy WHERE "StuID" != 1007 EXCEPT SELECT StuID FROM Student WHERE LName != "Epp" OR Fname = "David" AND Sex <> "M" AND "Advisor" = 8918 AND "Age" >= 20 AND city_code <> "SFO"


Question: What are the IDs of airports that are not in Boston or are not named "Ted Stevens Airport", combined with the IDs of companies that are not incorporated in Vietnam or have an ID greater than or equal to 13 or have a group equity shareholding of 18.77 and whose principal activities are not catering services, and whose name is "Cathay Pacific Holidays" and are not a subsidiary?

SELECT id FROM airport WHERE IATA <> "BOS" OR name != "Ted Stevens Airport" UNION SELECT id FROM operate_company WHERE Incorporated_in <> "Vietnam" OR "id" >= 13 OR "Group_Equity_Shareholding" = 18.77 AND Principal_activities != "Catering services" AND name = "Cathay Pacific Holidays" AND Type <> "Subsidiary"


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

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


Question: What are the aircraft IDs, excluding aircraft ID 4, and also the aircraft IDs that are less than or equal to 2?

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


Question: What is the highest customer ID from payments where the payment date isn't "2018-03-20 21:38:41" or the customer ID is less than or equal to 13, and also the highest customer ID from customers where the mobile phone number isn't "1-387-258-1016x96963" and the outstanding amount is 255?

SELECT MAX(customer_id) FROM Customer_Payments WHERE datetime_payment <> "2018-03-20 21:38:41" OR "customer_id" <= 13 UNION SELECT MAX(customer_id) FROM Customers WHERE cell_mobile_phone_number <> "1-387-258-1016x96963" AND "amount_outstanding" = 255.0


Question: What are the school IDs for Jimtown or schools that are not Lancers and are AA and not in Walkerton, or schools that are not ID 4 and not in county 75 Starke, or have an enrollment of 620? Also, what are the school IDs for schools where the invested amount is less than or equal to 8335 and the budget invested percentage is not 42.9?

SELECT School_id FROM School WHERE School_name = "Jimtown" OR Mascot <> "Lancers" AND IHSAA_Class = "AA" AND Location != "Walkerton" OR School_id <> "4" AND County <> "75 Starke" OR "Enrollment" = 620 UNION ALL SELECT School_id FROM budget WHERE "Invested" <= 8335 AND Budget_invested_percent <> "42.9"


Question: What are the ages of people in the head table who are over 68 and born in Florida, or whose name isn't Franklin Langham, or whose head ID isn't 5? Also, what are the ages of people in the head table who weren't born in California or are 43 years old?

SELECT age FROM head WHERE "age" > 68.0 AND born_state = "Florida" OR name <> "Franklin Langham" OR "head_ID" != 5 UNION ALL SELECT age FROM head WHERE born_state != "California" OR "age" = 43.0


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

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


Question: What are the driver IDs that are not equal to 5, but are not also driver IDs from school buses with IDs greater than 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: What are the driver IDs that are either less than or equal to 5 in the driver table or less than 4 in the school bus table?

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


Question: Which contestant numbers are in both the contestants table (excluding Jessie Alloway or with a number of 8 or greater) and the votes table (excluding votes from NY, or with a phone number not equal to 7148407040, or with a contestant number of 5 or greater and created on March 9, 2018 at 7:03:40 PM)?

SELECT contestant_number FROM CONTESTANTS WHERE contestant_name <> "Jessie Alloway" OR "contestant_number" >= 8 INTERSECT SELECT contestant_number FROM VOTES WHERE state <> "NY" OR "phone_number" != 7148407040 OR "contestant_number" >= 5 AND created = "2018-03-09 19:03:40"


Question: What are the school ID, amount, and donor name for endowments where the school ID is greater than 7 and the donor name is not "Com. Dom. En Estados Unidos", or where the endowment ID is 9 and the amount is less than or equal to 9.73? Also, include the school ID, amount, and donor name for endowments where the amount is not 9.05 and the school ID is 1 and the endowment ID is greater than 9, or where the donor name is "Santo Domingo Este".

SELECT School_id, amount, donator_name FROM endowment WHERE "School_id" > 7 AND donator_name <> "Com. Dom. En Estados Unidos" OR "endowment_id" = 9 AND "amount" <= 9.73 UNION ALL SELECT School_id, amount, donator_name FROM endowment WHERE "amount" != 9.05 AND "School_id" = 1 AND "endowment_id" > 9 OR donator_name = "Santo Domingo Este"


Question: What are the driver IDs that are greater than or equal to 3 in the driver table, but not present in the school bus table with driver IDs less than or equal to 3?

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


Question: What are the aircraft IDs that are both less than or equal to 3 and not equal to 2, considering only aircraft IDs present in both the aircraft and airport_aircraft tables?

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


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

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


Question: What are the other details from the Documents table, excluding those with receipt number "124", document status code "working", receipt date "2008-04-21 20:42:25", other details "m", or shipping agent code "US" and document type code "Paper" and document ID less than 15, but not including other details from the Employees table where the employee name is "Koby" and other details is "u" or employee ID is less than 3?

SELECT other_details FROM Documents WHERE receipt_number != "124" AND document_status_code != "working" AND receipt_date <> "2008-04-21 20:42:25" AND other_details != "m" OR shipping_agent_code != "US" AND document_type_code != "Paper" AND "document_id" < 15 EXCEPT SELECT other_details FROM Employees WHERE employee_name = "Koby" AND other_details = "u" OR "employee_id" < 3


Question: What are the store names, minimum area sizes, and maximum types for stores that either aren't named "Rogersville", or have 1678 product categories, or don't have a ranking of 9 and have an area size less than 28.74, or have a store ID less than or equal to 3? Also, what are the store names, minimum area sizes, and maximum types for stores that have 793 product categories, a ranking less than or equal to 3, and an area size greater than or equal to 179.84, or are not named "Blackville"?

SELECT Store_Name, MIN(Area_size), MAX(Type) FROM store WHERE Store_Name != "Rogersville" OR "Number_of_product_category" = 1678.0 OR "Ranking" <> 9 AND "Area_size" < 28.74 OR "Store_ID" <= 3 UNION SELECT Store_Name, MIN(Area_size), MAX(Type) FROM store WHERE "Number_of_product_category" = 793.0 AND "Ranking" <= 3 AND "Area_size" >= 179.84 OR Store_Name <> "Blackville"


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

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


Question: Which driver IDs are not equal to 5, but are not also driver ID 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: What are the aircraft IDs that are either greater than or equal to 3 in the aircraft table, or not equal to 1 in the airport_aircraft table?

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


Question: What are the aircraft IDs where the distance is at most 7120 or the aircraft ID is at most 13, and also the aircraft IDs associated with certificate entries where the employee ID is 142519864 or the aircraft ID is greater than 11?

SELECT aid FROM aircraft WHERE "distance" <= 7120 OR "aid" <= 13 UNION SELECT aid FROM certificate WHERE "eid" = 142519864 OR "aid" > 11


Question: What are the aircraft IDs, excluding aircraft ID 3, but not including aircraft ID 5?

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


Question: What are the people IDs and poker player IDs, grouped by best finish, where the earnings are 104871.0, or the height is less than 196.0 and the best finish is less than 3.0, or the nationality is not Russia and the birth date is not April 17, 1987 and the name is not Maksim Botin, or the final table made is not 42.0 and the poker player ID is greater than or equal to 1?

SELECT T1.People_ID, T2.Poker_Player_ID FROM people as T1 JOIN poker_player as T2 ON T1.People_ID == T2.People_ID GROUP BY Best_Finish HAVING Earnings = 104871.0 OR Height < 196.0 AND Best_Finish < 3.0 OR Nationality <> "Russia" AND Birth_Date <> "April 17, 1987" AND Name <> "Maksim Botin" OR Final_Table_Made <> 42.0 AND Poker_Player_ID >= 1


Question: What are the aircraft IDs, excluding ID 1, from the aircraft table, combined with the aircraft IDs, excluding ID 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: Which driver IDs are greater than 9 in the driver table or greater than 10 in the school bus table?

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


Question: What are the aircraft IDs that are less than 4 but not greater than 3, considering only the aircraft and airport-aircraft tables?

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


Question: What is the total sum of PetIDs for pets not owned by student 1002, combined with the sum of PetIDs for pets that are either older than 1 year, weigh 12.0, or are not dogs?

SELECT SUM(PetID) FROM Has_Pet WHERE "StuID" <> 1002 UNION ALL SELECT SUM(PetID) FROM Pets WHERE "pet_age" > 1 OR "weight" = 12.0 OR PetType != "dog"


Question: What are the driver IDs that are less than 1, and also the driver IDs from school buses that are less than 9?

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


Question: Which driver IDs are present in both the driver and school bus tables, where the driver ID is at least 8 in the driver table and at least 3 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 >= 3


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

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: What are the aircraft IDs that are present in both the aircraft table (excluding aircraft ID 4) and the airport_aircraft table (with aircraft IDs greater than or equal to 1)?

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


Question: What are all the address IDs that received mail, excluding those mailed on November 4, 2010, or with an address ID greater than or equal to 0, combined with those that received mail, excluding those mailed on April 1, 1977, and not to address ID 7, or with document ID 12?

SELECT mailed_to_address_id FROM Documents_Mailed WHERE mailing_date != "2010-11-04 04:00:16" OR "mailed_to_address_id" >= 0 UNION ALL SELECT mailed_to_address_id FROM Documents_Mailed WHERE mailing_date <> "1977-04-01 17:03:50" AND "mailed_to_address_id" <> 7 OR "document_id" = 12


Question: Which customer IDs appear in both the Customer_Payments table (excluding payments made at a specific time, or with a specific amount, or with customer ID greater than 1, but including direct debit payments) and the Lessons table (where the lesson price is at least 352, the lesson date and time are not specific values, the lesson ID is not 8, the customer ID is not 6, or the lesson status is cancelled, and the staff ID is less than 11)?

SELECT customer_id FROM Customer_Payments WHERE datetime_payment <> "2018-02-03 15:04:36" OR "amount_payment" <> 4032.33 AND payment_method_code = "Direct Debit" OR "customer_id" > 1 INTERSECT SELECT customer_id FROM Lessons WHERE "price" >= 352.0 AND lesson_date != "2018-03-03 15:10:16" AND "lesson_id" != 8 AND "customer_id" <> 6 AND lesson_time <> "5" OR lesson_status_code = "Cancelled" AND "staff_id" < 11


Question: What are the aircraft IDs greater than 3, and also the 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 aircraft IDs that are greater than 2 and also present in the airport aircraft table, excluding aircraft ID 2?

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


Question: What are the driver IDs that are 10 or greater, but not driver IDs less than 3, considering the driver IDs from the driver and school bus tables?

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


Question: What are the driver IDs greater than 4 from the driver table, combined with the driver IDs less than 10 from the school bus table?

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


Question: What are the department ID, temporary acting status, and head ID for employees where the head ID is less than 10 or the department ID is less than 2 and they are temporarily acting, and also where the head ID is less than or equal to 3 or the department ID is less than 2?

SELECT department_ID, temporary_acting, head_ID FROM management WHERE "head_ID" < 10 OR "department_ID" < 2 AND temporary_acting = "Yes" INTERSECT SELECT department_ID, temporary_acting, head_ID FROM management WHERE "head_ID" <= 3 OR "department_ID" < 2


Question: What is the sum of 'Maker' from 'car_makers' where the 'Id' is not 12, or the 'Country' is not "1", or the 'Maker' is not "kia", or the 'FullName' is "General Motors", combined with the sum of 'Maker' from 'model_list' where 'Maker' is less than 6?

SELECT SUM(Maker) FROM car_makers WHERE "Id" <> 12 OR Country <> "1" AND Maker != "kia" OR FullName = "General Motors" UNION SELECT SUM(Maker) FROM model_list WHERE "Maker" < 6


Question: Which driver IDs, excluding ID 10, are present in both the driver and school bus tables, excluding driver ID 4?

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


Question: What are the IDs of drivers who have an ID of 7 or higher, excluding driver ID 9?

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


Question: What is the average country value for car makers that are not from country "6" and not "amc", combined with the average country value for car makers that are not "Honda"?

SELECT AVG(Country) FROM car_makers WHERE Country != "6" AND Maker <> "amc" UNION SELECT AVG(Country) FROM car_makers WHERE FullName <> "Honda"


Question: What are the aircraft IDs that are not 3 and are present in both the aircraft and airport_aircraft tables, where the airport_aircraft table has an Aircraft_ID of 2?

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


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

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


Question: Which driver IDs are either less than or equal to 11 from the driver table, or equal to 3 from the school bus table?

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


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

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


Question: Which aircraft IDs are either aircraft ID 4 or aircraft IDs less than or equal to 1, considering both the aircraft and airport_aircraft tables?

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


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

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


Question: What is the maximum enrollment and the amount invested for schools, considering conditions related to the year, investment amount, IHSAA class, football class, budget percentage, enrollment size, and location?

SELECT MAX(T1.Enrollment), T2.Invested FROM School as T1 JOIN budget as T2 ON T1.School_id = T2.School_id WHERE "Year" <= 2005 OR "Invested" < 5840 AND IHSAA_Class = "AAA" AND IHSAA_Football_Class <> "A" AND "total_budget_percent_budgeted" < 2.0 OR "Enrollment" <= 620 OR Location <> "Culver"


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

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


Question: What are the template IDs that appear in both documents where the description isn't "y", or the template ID is 6, or the document name isn't "Learning French", and in templates where the details aren't empty or the template type code isn't "BK"?

SELECT Template_ID FROM Documents WHERE Document_Description <> "y" OR "Template_ID" = 6 OR Document_Name != "Learning French" INTERSECT SELECT Template_ID FROM Templates WHERE Template_Details <> "" OR Template_Type_Code != "BK"


Question: Which customer IDs made a direct debit payment at "2018-03-12 13:31:36" or have the first name "Jordy" but a different phone number than "417.136.2900x672"?

SELECT customer_id FROM Customer_Payments WHERE datetime_payment = "2018-03-12 13:31:36" AND payment_method_code = "Direct Debit" UNION SELECT customer_id FROM Customers WHERE first_name = "Jordy" AND phone_number != "417.136.2900x672"


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

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


Question: What are the aircraft IDs that are both less than or equal to 2 and not equal to 2, considering only aircraft IDs present in both the aircraft and airport_aircraft tables?

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


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

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


Question: What are the area sizes and types of stores where the number of product categories is at least 1678 or the store type is "Village Store"? Also, what are the area sizes and types of stores where the area size is not 28.74, or the number of product categories is less than or equal to 17811, or the store name is not "Neguac" and the store ID is 3 and the ranking is at least 2?

SELECT Area_size, Type FROM store WHERE "Number_of_product_category" >= 1678.0 OR Type = "Village Store" UNION SELECT Area_size, Type FROM store WHERE "Area_size" <> 28.74 OR "Number_of_product_category" <= 17811.0 OR Store_Name != "Neguac" AND "Store_ID" = 3 AND "Ranking" >= 2


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

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


Question: What are the driver IDs that are greater than or equal to 1, excluding those driver IDs from the school bus table that are greater than 7?

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


Question: How many employees received an award in 2016, and how many employees received a bonus greater than 3200 (excluding employee 7) in any year other than 2011?

SELECT COUNT(Employee_ID) FROM evaluation WHERE Year_awarded = "2016" UNION SELECT COUNT(Employee_ID) FROM evaluation WHERE Year_awarded <> "2011" AND "Bonus" > 3200.0 AND Employee_ID != "7"


Question: What are the IDs of drivers who are in both the driver and school bus tables, excluding driver ID 5 from the driver table and driver ID 4 from the school bus table?

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


Question: What are the driver IDs that are either 12 or greater, or 9 or less, based on the driver and school bus records?

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: Which driver IDs are either 9 or less than 7, considering both drivers and school buses?

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


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

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


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

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


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

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


Question: Which driver IDs are both greater than or equal to 10 and not equal to 4, considering only those IDs present in both the driver and school bus records?

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


Question: What are the property type codes that are not "House" and not described as "House, Bungalow, etc.", combined with the property type codes that are not "Shop" or not described as "House, Bungalow, etc."?

SELECT property_type_code FROM Ref_Property_Types WHERE property_type_description != "House, Bungalow, etc." AND property_type_code != "House" UNION SELECT property_type_code FROM Ref_Property_Types WHERE property_type_code != "Shop" OR property_type_description <> "House, Bungalow, etc."


Question: What are the receipt numbers, shipping agent codes, receipt dates, document status codes, document types, and document IDs for documents that meet either of these conditions: the document status is not overdue or the document type is not Paper and the receipt number is not 189, and also meet either of these conditions: the shipping agent code is not UP or the receipt date is not September 26, 1983, or the document status is overdue or the document type is CD?

SELECT receipt_number, shipping_agent_code, receipt_date, document_status_code, document_type_code, document_id FROM Documents WHERE document_status_code <> "overdue" OR document_type_code <> "Paper" AND receipt_number <> "189" INTERSECT SELECT receipt_number, shipping_agent_code, receipt_date, document_status_code, document_type_code, document_id FROM Documents WHERE shipping_agent_code <> "UP" AND receipt_date != "1983-09-26 09:32:56" OR document_status_code = "overdue" OR document_type_code = "CD"


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

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


Question: What are the driver IDs that are less than or equal to 4, excluding driver ID 4, based on the driver and school bus information?

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


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

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


Question: What are the IDs of aircraft that are not a CH-47D Chinook, or have a maximum gross weight of 50,000 lb (22,680 kg), or have a maximum disk loading of 14.5 lb/ft² (71 kg/m²) and a total disk area not equal to 8,495 ft² (789 m²), or have an aircraft ID not equal to 5? Also, what are the aircraft IDs from airport aircraft where the airport ID is not 1? Combine these results.

SELECT Aircraft_ID FROM aircraft WHERE Aircraft != "CH-47D Chinook" OR Max_Gross_Weight = "50,000 lb (22,680 kg)" OR Max_disk_Loading = "14.5 lb/ft² (71 kg/m²)" AND Total_disk_area <> "8,495 ft² (789 m²)" OR "Aircraft_ID" != 5 UNION ALL SELECT Aircraft_ID FROM airport_aircraft WHERE "Airport_ID" <> 1


Question: What are the aircraft IDs that are both less than or equal to 3 and also appear in the airport aircraft table with IDs less than 2?

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


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

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


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

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


Question: What is the minimum document status description and code for "currently working on", and what is the minimum document status description and code for all statuses except "mailed late"?

SELECT MIN(document_status_description), document_status_code FROM Ref_Document_Status WHERE document_status_description = "currently working on" UNION SELECT MIN(document_status_description), document_status_code FROM Ref_Document_Status WHERE document_status_description <> "mailed late"


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

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


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

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


Question: What are the average country ID, the sum of the continent values, and the average country name for Japan, excluding those results where the continent value is less than or equal to 2 and the country name is Nigeria?

SELECT AVG(CountryId), SUM(Continent), AVG(CountryName) FROM countries WHERE CountryName = "japan" EXCEPT SELECT AVG(CountryId), SUM(Continent), AVG(CountryName) FROM countries WHERE "Continent" <= 2 AND CountryName = "nigeria"


Question: Which driver IDs are not 12, and also which driver ID is 3, considering driver and school bus information?

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


Question: What are the IDs of airports not in Belgium, excluding the IDs of companies that are subsidiaries incorporated in Hong Kong but not named "Cathay Pacific Catering Services (HK) Limited", or companies with over 49% group equity shareholding and not primarily involved in cargo airlines?

SELECT id FROM airport WHERE Country != "Belgium" EXCEPT SELECT id FROM operate_company WHERE Type = "Subsidiary" AND name <> "Cathay Pacific Catering Services (HK) Limited" AND Incorporated_in = "Hong Kong" OR "Group_Equity_Shareholding" > 49.0 AND Principal_activities <> "Cargo airline"