Question: What are the minimum maximum occupancy, average room ID, and minimum base price for modern rooms with room ID "IBS", a maximum occupancy of 2, no more than 2 beds, a base price of at least 100, a bed type of King, and not named "Mendicant with cryptic", excluding the results for rooms with room ID "AOB", or a bed type of King and modern decor, or a room name not equal to "Harbinger but bequest" and a base price not equal to 150?

SELECT MIN(maxOccupancy), AVG(RoomId), MIN(basePrice) FROM Rooms WHERE decor = "modern" AND RoomId = "IBS" AND "beds" <= 2 AND "maxOccupancy" = 2 AND roomName <> "Mendicant with cryptic" AND "basePrice" >= 100 AND bedType = "King" EXCEPT SELECT MIN(maxOccupancy), AVG(RoomId), MIN(basePrice) FROM Rooms WHERE RoomId = "AOB" OR bedType = "King" AND decor = "modern" OR roomName != "Harbinger but bequest" AND "basePrice" != 150


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

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: What is the average sales, the count of industries, and the sum of headquarters for each company ID, considering companies that are not headquartered in the UK or have assets greater than 717.2 billion or are not in the oil and gas industry? Also, what is the average sales, the count of industries, and the sum of headquarters for each company ID, excluding those headquartered in the USA?

SELECT AVG(Sales_in_Billion), COUNT(Industry), SUM(Headquarters), Company_ID FROM company WHERE Headquarters <> "UK" OR "Assets_in_Billion" > 717.2 AND "Profits_in_Billion" <> 21.5 OR Industry <> "Oil and gas" UNION ALL SELECT AVG(Sales_in_Billion), COUNT(Industry), SUM(Headquarters), Company_ID FROM company WHERE Headquarters <> "USA"


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

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: Which driver IDs are in the driver table but not in the school bus table, excluding driver ID 8 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 != 8 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 3


Question: What are the aircraft IDs that are less than 2, combined with the aircraft IDs that are not 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: What are the driver IDs that are either less than or equal to 9 from the driver table, or greater than 7 from the school bus table?

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


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 9 INTERSECT 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 both the aircraft and airport aircraft tables, with the aircraft ID being 5 or greater in the airport aircraft table?

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


Question: Which driver IDs are either 2 or greater than or equal to 9?

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


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


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

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


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

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


Question: Which driver IDs are less than or equal to 3, but not equal to 10, 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 <= 3 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 10


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

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


Question: What are the aircraft IDs that are less than 5, but not equal to 5, based on the aircraft and airport_aircraft tables?

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 less than 3, and also the driver IDs from school buses that are not 10?

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


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

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


Question: What are the driver IDs that are less than 1 in the driver table, combined with the driver IDs that are less than or equal to 4 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 <= 4


Question: For each user ID, what is the lowest rank, considering reviews where the item ID is 7 or less, the user ID is greater than 2 and the author ID is 3 or greater, or the rank is 7 or less, or the rating is 5? Also, for each user ID, what is the lowest rank for reviews where the author ID is 6 and the user ID is 2 or less?

SELECT u_id, MIN(rank) FROM review WHERE "i_id" <= 7 AND "u_id" > 2 AND "a_id" >= 3 OR "rank" <= 7 OR "rating" = 5 UNION ALL SELECT u_id, MIN(rank) FROM review WHERE "a_id" = 6 AND "u_id" <= 2


Question: What are the IDs of albums by artists with ID 147 or greater and the title "Holst: The Planets, Op. 32 & Vaughan Williams: Fantasies", or any album ID except 269, and also the IDs of playlists with an ID greater than 18?

SELECT id FROM albums WHERE "artist_id" >= 147 AND title = "Holst: The Planets, Op. 32 & Vaughan Williams: Fantasies" OR "id" <> 269 UNION SELECT id FROM playlists WHERE "id" > 18


Question: What is the average driver ID and the driver ID from the school bus table for drivers under 52 years old?

SELECT AVG(T1.Driver_ID), T2.Driver_ID FROM driver as T1 JOIN school_bus as T2 ON T1.Driver_ID = T2.Driver_ID WHERE "Age" < 52


Question: What are the smallest club IDs from the club table where the region is USA, or the start year is before 2011, or the club name is not Gefle IF and the club ID is greater than 5? Also, what are the smallest club IDs from the coach table where the gender is M and the rank is at least 1 and the club ID is greater than 3 and the coach ID is at least 1, or the coach name is Joe Fabbri?

SELECT MIN(Club_ID) FROM club WHERE Region = "USA" OR "Start_year" < 2011 OR Club_name != "Gefle IF" AND "Club_ID" > 5 UNION ALL SELECT MIN(Club_ID) FROM coach WHERE Gender = "M" AND "Rank" >= 1 AND "Club_ID" > 3 AND "Coach_ID" >= 1 OR Coach_name = "Joe Fabbri"


Question: What are the driver IDs that are both less than 6 and also appear in the school bus table with IDs no greater than 10?

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


Question: What are the driver IDs that are less than 1, combined with the driver IDs that are not 7, from the driver and school bus tables?

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 are the aircraft IDs, excluding aircraft ID 2, from the aircraft table, combined with aircraft IDs less than or equal to 1 from the airport_aircraft table?

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


Question: What are the aircraft IDs, excluding aircraft ID 1, that are present in both the aircraft and airport_aircraft tables, where the aircraft ID is also less than or equal to 3 in the airport_aircraft table?

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


Question: What are the driver IDs greater than 7 in the driver table or less than 10 in the school bus table?

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


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

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


Question: What are the aircraft IDs that are less than 2, excluding those aircraft IDs that are not equal to 1 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 != 1


Question: What template type codes are present in both the Ref_Template_Types table (excluding "BK") and the Templates table (where the effective end date isn't "1974-09-14 06:34:39", the version number is less than 2, the template type code is not "PP", or the template ID is 20 or greater, or the template details are not empty, and the effective start date is not "2002-08-25 13:26:23")?

SELECT Template_Type_Code FROM Ref_Template_Types WHERE Template_Type_Code <> "BK" INTERSECT SELECT Template_Type_Code FROM Templates WHERE Date_Effective_To <> "1974-09-14 06:34:39" AND "Version_Number" < 2 AND Template_Type_Code != "PP" OR "Template_ID" >= 20 OR Template_Details <> "" AND Date_Effective_From != "2002-08-25 13:26:23"


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

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


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

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


Question: Which driver IDs are less than or equal to 3, excluding those that are not 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: How many property features have a description of "corrupti", or a feature ID less than 4, or a property ID of 4 or more, combined with how many property features have a property ID greater than 14 or a feature ID of 3 or more?

SELECT COUNT(property_feature_description) FROM Other_Property_Features WHERE property_feature_description = "corrupti" OR "feature_id" < 4 OR "property_id" >= 4 UNION ALL SELECT COUNT(property_feature_description) FROM Other_Property_Features WHERE "property_id" > 14 OR "feature_id" >= 3


Question: Which driver IDs are not 5, and which driver ID is 9, considering both drivers and school buses?

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


Question: What are the driver IDs that are greater than or equal to 2, but not present 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 >= 2 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 7


Question: Which driver IDs are equal to 4 in the driver table, and which driver IDs are not equal to 3 in the school bus table?

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


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

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


Question: What are the names and user IDs of all users who are not named Nancy, and also the names and user IDs of users with a user ID of 6 or higher, excluding those named Mark?

SELECT name, u_id FROM useracct WHERE name <> "Nancy" UNION SELECT name, u_id FROM useracct WHERE "u_id" >= 6 AND name != "Mark"


Question: What are the IDs of albums that aren't "UB40 The Best Of - Volume Two UK" and have an ID of 140 or greater and an artist ID greater than 115, along with the IDs of playlists that aren't named "Audiobooks" and don't have an ID of 10?

SELECT id FROM albums WHERE title <> "UB40 The Best Of - Volume Two UK" AND "id" >= 140 AND "artist_id" > 115 UNION ALL SELECT id FROM playlists WHERE name != "Audiobooks" AND "id" != 10


Question: What are the counties represented, first elected year, and the maximum party value for candidates whose party value is greater than 1, excluding those who are not Elizabeth Bobo, do not represent county "12.2 12B", were not first elected in 1994, and are not on the Economic Matters committee?

SELECT Counties_Represented, First_Elected, MAX(Party) FROM election WHERE "Party" > 1 EXCEPT SELECT Counties_Represented, First_Elected, MAX(Party) FROM election WHERE Delegate <> "Bobo, Elizabeth Elizabeth Bobo" AND Counties_Represented != "12.2 12B" AND "First_Elected" != 1994.0 AND Committee <> "Economic Matters"


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

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


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

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


Question: Which driver IDs 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 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: Which driver IDs are present in both the driver and school bus tables, excluding driver ID 11 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 != 11 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 or equal to 10 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 <= 10 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 9


Question: What are the aircraft IDs that are either 1 or not 3, considering both aircraft and airport aircraft information?

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


Question: Give me the full-time status, shop ID, employee ID, and start date for all hiring records where the shop ID is 2 or greater, or the full-time status is not "T", excluding any records where the employee ID is 1 and the shop ID is 5.

SELECT Is_full_time, Shop_ID, Employee_ID, Start_from FROM hiring WHERE "Shop_ID" >= 2 OR Is_full_time != "T" EXCEPT SELECT Is_full_time, Shop_ID, Employee_ID, Start_from FROM hiring WHERE "Employee_ID" = 1 AND "Shop_ID" = 5


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

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


Question: What are the driver IDs that are equal to 3 in the driver table but not equal to 3 in the school bus table?

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


Question: What are the club IDs of clubs that have a club ID greater than or equal to 1 or a start year after 2001, combined with the club IDs from match results where the small silver value is greater than 10 and the points are not 139 or the gold value is not 13?

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


Question: How many airports have ICAO "EHAM", or a city other than "Billund", or are in Belgium, or don't have IATA "BWI" and aren't named "Bergen Airport"? Also, how many airports have ICAO "EBBR" and a name other than "Ted Stevens Airport", or have an ID less than or equal to 3, or are not in Netherlands and have IATA "BWI", or have a city other than "Bergen"? For each of these sets of airports, what is the count of their ICAO codes, the count of their names, their ID, and the minimum IATA code?

SELECT COUNT(ICAO), COUNT(name), id, MIN(IATA) FROM airport WHERE ICAO = "EHAM" OR City <> "Billund" OR Country = "Belgium" OR IATA <> "BWI" AND name <> "Bergen Airport" UNION SELECT COUNT(ICAO), COUNT(name), id, MIN(IATA) FROM airport WHERE ICAO = "EBBR" AND name != "Ted Stevens Airport" OR "id" <= 3 OR Country != "Netherlands" AND IATA = "BWI" OR City != "Bergen"


Question: What is the highest allergy value, excluding environmental allergies or soy allergies, and also the highest allergy value, excluding dog allergies and for students other than student ID 1003?

SELECT MAX(Allergy) FROM Allergy_Type WHERE AllergyType != "environmental" OR Allergy <> "Soy" UNION ALL SELECT MAX(Allergy) FROM Has_Allergy WHERE Allergy <> "Dog" AND "StuID" != 1003


Question: What are the Comptroller, Governor, and Party ID for parties that meet any of the following conditions: the US Senate is not Hillary Rodham Clinton, or the year is before 2006, or the Lieutenant Governor is David Paterson and the party is Liberal, or the Governor is not Peter Vallone; or, the year is after 2006, or the US Senate is Hillary Rodham Clinton and the Comptroller is Carl McCall, or the Governor is not Tom Golisano and the Party ID is not 7, or the Lieutenant Governor is not Jonathan Reiter?

SELECT Comptroller, Governor, Party_ID FROM party WHERE US_Senate <> "Hillary Rodham Clinton" OR "Year" < 2006.0 OR Lieutenant_Governor = "David Paterson" AND Party = "Liberal" OR Governor <> "Peter Vallone" UNION SELECT Comptroller, Governor, Party_ID FROM party WHERE "Year" > 2006.0 OR US_Senate = "Hillary Rodham Clinton" AND Comptroller = "Carl McCall" OR Governor != "Tom Golisano" AND "Party_ID" != 7 OR Lieutenant_Governor != "Jonathan Reiter"


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

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


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

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 either less than or equal to 2 in the aircraft table or equal to 5 in the airport_aircraft table?

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


Question: What are the driver IDs that are greater than or equal to 7, excluding those driver IDs that are greater than 10 and are associated with a school bus?

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: Which driver IDs are in the driver table but not in the school bus table, excluding driver ID 6 from the driver table and driver IDs 10 or less from the school bus table?

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


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

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


Question: What are the driver IDs greater than 3 from the driver table, combined with the driver IDs that are not 10 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 <> 10


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

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


Question: What are the document IDs from the 'Documents' table where 'other_details' is "m", or 'shipping_agent_code' is not "UP", or 'receipt_date' is not "1976-09-15 19:24:17" and the document ID is not 14, combined with the document IDs from the 'Draft_Copies' table where the copy number is not 10, or the document ID is less than 4, or the draft number is not 17?

SELECT document_id FROM Documents WHERE other_details = "m" OR shipping_agent_code != "UP" OR receipt_date <> "1976-09-15 19:24:17" AND "document_id" <> 14 UNION ALL SELECT document_id FROM Draft_Copies WHERE "copy_number" <> 10 OR "document_id" < 4 OR "draft_number" <> 17


Question: What are the full-time status and start dates from the hiring table, excluding entries where the start year is 2012 and the shop ID is less than 8, or where the full-time status is not "T", or where the employee ID is not greater than 1? Also, what are the full-time status and start dates from the hiring table, excluding entries where the start year is 2009 and the employee ID is not greater than 2, or where the shop ID is less than 2?

SELECT Is_full_time, Start_from FROM hiring WHERE Start_from != "2012" AND "Shop_ID" >= 8 OR Is_full_time != "T" OR "Employee_ID" > 1 UNION ALL SELECT Is_full_time, Start_from FROM hiring WHERE Start_from != "2009" AND "Employee_ID" > 2 OR "Shop_ID" >= 2


Question: What are the club descriptions, excluding those that are not "Venture capital fund for student business." and not "Pen and Paper Gaming" and located in "AKW" with an ID greater than 2, but including those not located in "AKW" or are "A competitive tennis club." and not having an ID of 4?

SELECT ClubDesc FROM Club WHERE ClubLocation <> "AKW" OR ClubDesc = "A competitive tennis club." AND "ClubID" <> 4 EXCEPT SELECT ClubDesc FROM Club WHERE ClubDesc != "Venture capital fund for student business." AND ClubName <> "Pen and Paper Gaming" AND "ClubID" > 2 AND ClubLocation = "AKW"


Question: Which driver IDs are not equal to 5 but are not found in the school bus table where the driver ID is 3 or greater?

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


Question: What are the driver IDs, excluding driver ID 11, from the driver table, and also 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 customer IDs from payment records that don't have a payment time of "2018-02-06 13:35:58", excluding those customers whose address ID is not 13, outstanding amount is no more than 5494.0, email is kroberts@example.org, and cell phone number is +57(9)4602098297?

SELECT customer_id FROM Customer_Payments WHERE datetime_payment != "2018-02-06 13:35:58" EXCEPT SELECT customer_id FROM Customers WHERE "customer_address_id" <> 13 AND "amount_outstanding" <= 5494.0 AND email_address = "kroberts@example.org" AND cell_mobile_phone_number = "+57(9)4602098297"


Question: What are the document descriptions, sums of document names, average other details, maximum document IDs, and maximum template IDs for documents that either have a description other than "k", or a document ID less than or equal to 2394, or other details not equal to "None", or a document name not equal to "Robbin CV", and also have a document description not equal to "z" or a document name not equal to "A history of Arts" and other details equal to "None"?

SELECT Document_Description, SUM(Document_Name), AVG(Other_Details), MAX(Document_ID), MAX(Template_ID) FROM Documents WHERE Document_Description <> "k" OR "Document_ID" <= 2394 OR Other_Details <> "None" OR Document_Name != "Robbin CV" INTERSECT SELECT Document_Description, SUM(Document_Name), AVG(Other_Details), MAX(Document_ID), MAX(Template_ID) FROM Documents WHERE Document_Description != "z" AND Other_Details = "None" OR Document_Name <> "A history of Arts"


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

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


Question: What is the smallest employee ID from the certificate table where the aid is 11 or greater and the employee ID is 556784565 or less, excluding the smallest employee ID from the employee table where the salary is less than 256481 and the name is not Lawrence Sperry or the employee ID is less than 11564812?

SELECT MIN(eid) FROM certificate WHERE "aid" >= 11 AND "eid" <= 556784565 EXCEPT SELECT MIN(eid) FROM employee WHERE "salary" < 256481 AND name <> "Lawrence Sperry" OR "eid" < 11564812


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

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: Which driver IDs are greater than 6 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 > 6 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 3


Question: What are the driver IDs greater than 5 that are present in both the driver and school bus tables, excluding 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: Which driver IDs are greater than 8 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 > 8 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 10


Question: Which driver IDs, excluding driver 12, are present in both the driver and school bus records, but not driver 9?

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


Question: What are the IDs and titles of albums that aren't album ID 208 and have artist ID 58, combined with the IDs and titles of employees who either don't live in Calgary, or were not born on December 8, 1958, or have the fax number +1 (403) 456-8485, or live in Alberta and have the email robert@chinookcorp.com and the address 7727B 41 Ave and were not hired on May 1, 2002 and report to someone with an ID of 6 or higher, or have a first name other than Laura and an ID of 3 or higher, or have a phone number other than +1 (403) 263-4423, or have a postal code of T5K 2N1 and a last name other than Mitchell and the job title IT Staff?

Knocking at Your Back Door: The Best Of Deep Purple in the 80's

SELECT id, title FROM albums WHERE "id" <> 208 AND "artist_id" = 58 UNION ALL SELECT id, title FROM employees WHERE city <> "Calgary" OR birth_date != "1958-12-08 00:00:00" OR fax = "+1 (403) 456-8485" OR state = "AB" AND email = "robert@chinookcorp.com" AND address = "7727B 41 Ave" AND hire_date != "2002-05-01 00:00:00" AND "reports_to" >= 6.0 OR first_name != "Laura" AND "id" >= 3 OR phone != "+1 (403) 263-4423" OR postal_code = "T5K 2N1" AND last_name != "Mitchell" AND title = "IT Staff"


Question: What is the total number of driver IDs and the school ID, where the driver is either from Hartford and named Edwin Vargas, or the minimum school ID is less than 5 and not full-time, or the driver is under 42, or the count of years working is not 6?

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" AND Name = "Edwin Vargas" OR MIN(School_ID) < 5 AND If_full_time <> "T" OR Age < 42 OR COUNT(Years_Working) <> 6


Question: What are the average rank and rating, and the minimum user and item IDs, for reviews where the item ID is not 3, the rank is less than 3, the author ID is less than 4, and the rating is less than 7, or where the user ID is not 2? Also, what are the average rank and rating, and the minimum user and item IDs, for reviews where the rating is not 7, the rank is greater than 6, and the item ID is not 7?

SELECT AVG(rank), AVG(rating), MIN(u_id), MIN(i_id) FROM review WHERE "i_id" <> 3 AND "rank" < 3 AND "a_id" < 4 AND "rating" < 7 OR "u_id" <> 2 UNION SELECT AVG(rank), AVG(rating), MIN(u_id), MIN(i_id) FROM review WHERE "rating" != 7 AND "rank" > 6 AND "i_id" != 7


Question: What is the sum of car IDs and the weight, considering cars made by "American Motor Company", or with less than 4 cylinders, or with horsepower not equal to "75" and made before or in 1982 and with acceleration less than or equal to 16.5 and with minimum weight not equal to 2472 and country not equal to "8" or maker not equal to "toyota"?

SELECT SUM(T1.Id), T2.Weight FROM car_makers as T1 JOIN cars_data as T2 ON T1.Id = T2.Id WHERE FullName = "American Motor Company" OR COUNT(Cylinders) < 4 OR Horsepower <> "75" AND Year <= 1982 AND COUNT(Accelerate) <= 16.5 AND MIN(Weight) <> 2472 AND Country <> "8" OR Maker <> "toyota"


Question: Which driver IDs are greater than 6, excluding those with a driver ID of 3, considering only the drivers and school buses?

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


Question: Which player IDs played in a year other than 2010 or are not player ID 14?

SELECT Player_ID FROM player_coach WHERE "Starting_year" != 2010 UNION ALL SELECT Player_ID FROM player_coach WHERE "Player_ID" <> 14


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


Question: What are the aircraft IDs that are not 4, and also 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 != 4 UNION SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID > 1


Question: What are the IDs of drivers who have an ID of 4 or greater and also are assigned to a school bus with an ID that is not 7?

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


Question: Which driver IDs, excluding ID 1, are associated with drivers, and which driver IDs greater than 3 are associated with school buses?

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


Question: What are the document status codes that are either "mailed" or not "done", but not those that are not "currently working on" or not "working"?

SELECT document_status_code FROM Ref_Document_Status WHERE document_status_description = "mailed" OR document_status_code <> "done" EXCEPT SELECT document_status_code FROM Ref_Document_Status WHERE document_status_description <> "currently working on" OR document_status_code <> "working"


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

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


Question: What are the feature IDs that are either less than 4, not "Swimming Pool.", or are "BurglarAlarm", but are not feature IDs associated with property 3, or where the feature ID is less than or equal to 2 and the description isn't "quo"?

SELECT feature_id FROM Other_Available_Features WHERE "feature_id" < 4 OR feature_description != "Swimming Pool." OR feature_name = "BurglarAlarm" EXCEPT SELECT feature_id FROM Other_Property_Features WHERE "property_id" = 3 OR "feature_id" <= 2 AND property_feature_description != "quo"


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

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, excluding driver ID 3, that are present in both the driver and school bus tables, where the driver ID is less than 10?

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


Question: What are the IDs of people who either work at a company with an ID of 7 or higher, or have worked for more than 3 years, combined with the IDs of people who are not named Brad Lohaus and are 37 years old, or have an ID of 3?

SELECT People_ID FROM employment WHERE "Company_ID" >= 7 OR "People_ID" <> 3 AND "Year_working" > 3 UNION ALL SELECT People_ID FROM people WHERE Name != "Brad Lohaus" AND "Age" = 37 OR "People_ID" = 3


Question: Which driver IDs are associated with either drivers who are not driver ID 8 or school buses that are not driver ID 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 in the driver table but not in the school bus table, excluding driver ID 12 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 <> 12 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 4


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

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


Question: What are the IDs of car makers that are not Renault and also have cars where the MPG is not 38.1, or the engine displacement is less than or equal to 98.0, or the weight is not 2914 and the number of cylinders is 4?

SELECT Id FROM car_makers WHERE FullName != "Renault" INTERSECT SELECT Id FROM cars_data WHERE MPG <> "38.1" OR "Edispl" <= 98.0 OR "Weight" <> 2914 AND "Cylinders" = 4


Question: What are the aircraft IDs that appear in either the aircraft table or the airport_aircraft table, where the aircraft ID is 5 or greater?

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


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

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


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


Question: What are the customer IDs who do not pay via Direct Debit or are not customer ID 10, excluding those who have lessons with lesson ID 4 or higher, staff ID greater than 11 and a completed status, or a lesson time not equal to 9, or a customer ID of 2 or higher and a lesson date that is not February 28, 2018, at 10:55:36?

SELECT customer_id FROM Customer_Payments WHERE payment_method_code != "Direct Debit" OR "customer_id" != 10 EXCEPT SELECT customer_id FROM Lessons WHERE "lesson_id" >= 4 OR "staff_id" > 11 AND lesson_status_code = "Completed" OR lesson_time <> "9" OR "customer_id" >= 2 AND lesson_date != "2018-02-28 10:55:36"


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

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: Which driver IDs are equal to 12 but not equal to 7, considering driver and school bus information?

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


Question: Which driver IDs are greater than 10 but not equal to 7, 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 > 10 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 7


Question: What are the department rankings that are not 5 and also not 13, and do not have 30266 employees?

SELECT Ranking FROM department WHERE "Ranking" <> 5 INTERSECT SELECT Ranking FROM department WHERE "Ranking" != 13 AND "Num_Employees" != 30266.0


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

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


Question: Which driver IDs are greater than or equal to 4 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 >= 4 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 3


Question: What are the different document status codes, excluding "done" or those not described as "mailed", combined with those that are not "working" and not described as "mailed late"?

SELECT document_status_code FROM Ref_Document_Status WHERE document_status_code <> "done" OR document_status_description != "mailed" UNION SELECT document_status_code FROM Ref_Document_Status WHERE document_status_code <> "working" AND document_status_description <> "mailed late"


Question: What are the aircraft IDs that appear in the aircraft table with an ID of 3 or greater, or in the airport_aircraft table with an ID of 5 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 >= 5


Question: Which driver IDs are greater than 12 in the driver table or greater than 9 in the school bus table?

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


Question: What are the driver IDs, excluding driver ID 8, from the driver table, and also the driver IDs, excluding driver ID 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: What are all the feature IDs from the 'Other_Available_Features' table where the feature name is "AirCon", combined with feature IDs from the 'Other_Property_Features' table where the feature ID is not 4, or the description isn't "quo", or the property ID is 6?

SELECT feature_id FROM Other_Available_Features WHERE feature_name = "AirCon" UNION ALL SELECT feature_id FROM Other_Property_Features WHERE "feature_id" != 4 OR property_feature_description <> "quo" OR "property_id" = 6


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

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


Question: Which driver IDs are both less than 11 and greater than 9, considering only driver IDs present in both the driver and school bus tables?

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


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

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


Question: What are the aircraft IDs that are not 5, and also the aircraft IDs that are 5 or less, 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 <= 5


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


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

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


Question: What are the driver IDs that are 5 or greater, but not driver IDs that are 9 or less, considering the driver and school bus information?

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: Which driver IDs, excluding driver ID 11, are present in the driver table but not in the school bus table, excluding driver ID 10?

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


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

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


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


Question: Which driver IDs are equal to 12 but not present in the school bus table with a driver ID that is not equal to 4?

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: How many payments were made, and what are the corresponding mobile phone numbers, for customers who did not pay via Direct Debit, where the payment time was 2018-02-06 13:35:58, the customer status was "Good Customer", and the phone number was not (662)490-3108, or the payment amount was 1708.18 and the customer became a customer on 2017-10-05 14:15:46 and the date of birth was 1998-09-18 04:45:01, or the amount outstanding was greater than or equal to 9332.0, or the email address was kroberts@example.org, grouped by mobile phone number, excluding those with a date of birth not equal to 1996-08-29 00:03:08, and a payment time not equal to 2018-02-06 13:35:58, and a mobile phone number not equal to 1-387-258-1016x96963, or an amount outstanding equal to 2255.0?

SELECT COUNT(T1.amount_payment), T2.cell_mobile_phone_number FROM Customer_Payments as T1 JOIN Customers as T2 ON T1.customer_id = T2.customer_id WHERE payment_method_code <> "Direct Debit" AND datetime_payment = "2018-02-06 13:35:58" AND customer_status_code = "Good Customer" AND phone_number <> "(662)490-3108" OR "amount_payment" = 1708.18 AND date_became_customer = "2017-10-05 14:15:46" AND date_of_birth = "1998-09-18 04:45:01" OR "amount_outstanding" >= 9332.0 OR email_address = "kroberts@example.org" GROUP BY cell_mobile_phone_number HAVING date_of_birth <> "1996-08-29 00:03:08" AND datetime_payment <> "2018-02-06 13:35:58" AND cell_mobile_phone_number <> "1-387-258-1016x96963" OR amount_outstanding = 2255.0


Question: Which driver IDs are greater than or equal to 4, excluding driver ID 10?

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


Question: What are the driver IDs greater than 12 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 > 12 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 10


Question: How many cities are there for employees aged 32 or younger, considering the number of cities for employees named Phil Vickery who don't live in Bath and don't have employee ID 8?

SELECT COUNT(City) FROM employee WHERE "Age" <= 32 IN (SELECT COUNT(City) FROM employee WHERE Name = "Phil Vickery" AND City <> "Bath" AND "Employee_ID" <> 8)


Question: Which schools meet at least one of the following conditions: their total budget invested percentage is at least 2.0, their total budget budgeted percentage is at least 1.3, or their budget invested percentage is not 228.8 and the year is before 2006 and the budgeted amount is less than or equal to 6803 or the invested amount is less than 95542; or which schools have a donator name that is not "La Vega"?

SELECT School_id FROM budget WHERE "total_budget_percent_invested" >= 2.0 OR "total_budget_percent_budgeted" >= 1.3 OR Budget_invested_percent != "228.8" AND "Year" < 2006 AND "Budgeted" <= 6803 OR "Invested" < 95542 UNION ALL SELECT School_id FROM endowment WHERE donator_name <> "La Vega"


Question: Can you list the major, student ID, sex, last name, first name, and city code for all female students who are not from Houston, or for any student whose advisor ID is greater than 8722 and last name is Pang, student ID is less than 1014, first name is Eric, and age is 18, along with all students with a student ID greater than or equal to 1014?

SELECT Major, StuID, Sex, LName, Fname, city_code FROM Student WHERE Sex != "M" AND city_code <> "HOU" OR "Advisor" > 8722 AND LName = "Pang" AND "StuID" < 1014 AND Fname = "Eric" AND "Age" = 18 UNION ALL SELECT Major, StuID, Sex, LName, Fname, city_code FROM Student WHERE "StuID" >= 1014


Question: For paragraphs, show the document ID, the longest paragraph text, the paragraph ID, and the minimum other details. Include paragraphs where the document ID is less than 651512 or the other details are not "None" and the paragraph text is "Palestinian Territory". Also, include paragraphs where the other details are not "None" and the paragraph ID is less than 243399026.

SELECT Document_ID, MAX(Paragraph_Text), Paragraph_ID, MIN(Other_Details) FROM Paragraphs WHERE "Document_ID" < 651512 OR Other_Details != "None" AND Paragraph_Text = "Palestinian Territory" UNION ALL SELECT Document_ID, MAX(Paragraph_Text), Paragraph_ID, MIN(Other_Details) FROM Paragraphs WHERE Other_Details != "None" AND "Paragraph_ID" < 243399026


Question: What are the aircraft IDs greater than 1, and also any aircraft IDs from the airport_aircraft table that are not equal to 2?

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


Question: What are the receipt numbers, earliest receipt dates, document status codes, document IDs, and the sum of other details for documents that are not overdue and not of type "Hard Drive", or have a shipping agent other than "UP" and other details equal to "u", or have a document ID greater than or equal to 15 and a receipt date of "2014-12-25 17:22:44"? Also, what are the same details for documents shipped by "SH"?

SELECT receipt_number, MIN(receipt_date), document_status_code, document_id, SUM(other_details) FROM Documents WHERE document_status_code <> "overdue" AND document_type_code <> "Hard Drive" OR shipping_agent_code <> "UP" AND other_details = "u" OR "document_id" >= 15 AND receipt_date = "2014-12-25 17:22:44" UNION SELECT receipt_number, MIN(receipt_date), document_status_code, document_id, SUM(other_details) FROM Documents WHERE shipping_agent_code = "SH"


Question: What are the driver IDs that are both equal to 9 in the driver table and greater than 3 in the school bus table?

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


Question: Give me the department ID, head ID, and temporary acting status for all management entries where the head ID is less than 10, and also for entries where the department ID is not 7 and the temporary acting status is not "No", or where the head ID is 10 or greater.

SELECT department_ID, head_ID, temporary_acting FROM management WHERE "head_ID" < 10 UNION ALL SELECT department_ID, head_ID, temporary_acting FROM management WHERE "department_ID" <> 7 AND temporary_acting != "No" OR "head_ID" >= 10


Question: Which school IDs meet any of the following conditions: the total budget percentage invested is less than or equal to 2.0 and the amount invested is less than or equal to 8335, or the total budget percentage budgeted is greater than 2.0, or the year is not 2002 and the budget invested percentage is 146.9 and the school ID is not 5 and the budgeted amount is 74849; or the endowment amount is greater than 9.73 and the donor name is not Santiago, or the endowment ID is greater than 8?

SELECT School_id FROM budget WHERE "total_budget_percent_invested" <= 2.0 AND "Invested" <= 8335 OR "total_budget_percent_budgeted" > 2.0 OR "Year" != 2002 AND Budget_invested_percent = "146.9" AND "School_id" != 5 AND "Budgeted" = 74849 UNION ALL SELECT School_id FROM endowment WHERE "amount" > 9.73 AND donator_name <> "Santiago" OR "endowment_id" > 8


Question: Which driver IDs are less than or equal to 8 but not equal to 9, considering only drivers and school buses?

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


Question: What are the driver IDs that are equal to 5, but not driver IDs that are less than or equal to 4, considering information from the driver and school bus tables?

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


Question: Which driver IDs are in the driver table but not in the school bus table, excluding driver ID 11 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 <> 11 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 4


Question: What are the IDs of drivers who are either in the driver table or the school bus table, excluding driver ID 7?

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


Question: What are the aircraft IDs that are not equal to 3, but are not also aircraft IDs greater than 5 in the airport aircraft table?

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


Question: What are the smallest customer IDs from the Customers table where the date of birth is 1998-09-18 04:45:01, or the cell phone number is +45(6)4872981083, or the date became a customer is not 2016-03-18 06:14:18, or the customer status is not "Good Customer", or the customer address ID is not 1 and the last name is Bruen, or the phone number is not 1-875-045-0806, or the first name is Estelle, or the customer ID is less than or equal to 13 and the email address is not wehner.harold@example.com, or the amount outstanding is less than or equal to 7256.0? Also, what are the smallest customer IDs from the Lessons table where the lesson time is not "2", or the lesson status is not "Cancelled", or the lesson date is not 2018-03-07 22:03:49 and the price is greater than 456.0, or the customer ID is 11, or the vehicle ID is not 1?

SELECT MIN(customer_id) FROM Customers WHERE date_of_birth = "1998-09-18 04:45:01" OR cell_mobile_phone_number = "+45(6)4872981083" OR date_became_customer != "2016-03-18 06:14:18" OR customer_status_code <> "Good Customer" OR "customer_address_id" != 1 AND last_name = "Bruen" OR phone_number != "1-875-045-0806" OR first_name = "Estelle" OR "customer_id" <= 13 AND email_address != "wehner.harold@example.com" OR "amount_outstanding" <= 7256.0 UNION ALL SELECT MIN(customer_id) FROM Lessons WHERE lesson_time != "2" OR lesson_status_code != "Cancelled" OR lesson_date <> "2018-03-07 22:03:49" AND "price" > 456.0 OR "customer_id" = 11 OR "vehicle_id" != 1


Question: What football class levels are shared by schools that meet at least one of these conditions: located in Marshall County with enrollment under 316, or not named LaVille and are class A, or have the Redskins mascot, or have a school ID other than 8; and schools that meet at least one of these conditions: have the Trojans mascot and are not in Marshall County, or have a school ID of 3 and an enrollment of 495, or are not class AA, or are not class A and are not named Bremen?

SELECT IHSAA_Football_Class FROM School WHERE County = "50 Marshall" AND "Enrollment" < 316 OR School_name != "LaVille" AND IHSAA_Class = "A" OR Mascot = "Redskins" OR School_id <> "8" INTERSECT SELECT IHSAA_Football_Class FROM School WHERE Mascot = "Trojans" AND County != "50 Marshall" OR School_id = "3" AND "Enrollment" = 495 OR IHSAA_Class <> "AA" OR IHSAA_Football_Class <> "A" AND School_name <> "Bremen"


Question: What are the age and bonus for each city, excluding the employee named Matt Stevens?

SELECT T1.Age, T2.Bonus FROM employee as T1 JOIN evaluation as T2 ON T1.Employee_ID == T2.Employee_ID GROUP BY City HAVING Name <> "Matt Stevens"


Question: Which shop IDs started in 2012, or are located in Helsinki, or have a shop ID greater than 4?

SELECT Shop_ID FROM hiring WHERE Start_from = "2012" UNION ALL SELECT Shop_ID FROM shop WHERE Location = "Helsinki" OR "Shop_ID" > 4


Question: For counties, what are the population values, the count of zip codes, the count of county names, and the maximum county ID? Consider only counties where the county ID is less than or equal to 5 and the population is not 21000, or where the county name is not "Baltimore County" and the zip code is not "D09". Group the results by population, and only include groups where the zip code count is less than 1 or the county name count is less than or equal to 1 and the maximum county ID is greater than 4. Also, show the same information for counties where the county ID is not 1, grouped by population, but only include groups where the county name count is greater than 1. Combine the results from both sets of criteria.

SELECT Population, COUNT(Zip_code), COUNT(County_name), MAX(County_Id) FROM county WHERE "County_Id" <= 5 AND "Population" <> 21000.0 OR County_name <> "Baltimore County" AND Zip_code <> "D09" GROUP BY Population HAVING COUNT(Zip_code) < 1 OR COUNT(County_name) <= 1 AND MAX(County_Id) > 4 UNION SELECT Population, COUNT(Zip_code), COUNT(County_name), MAX(County_Id) FROM county WHERE "County_Id" != 1 GROUP BY Population HAVING COUNT(County_name) > 1


Question: What are the city population, district ID, the most frequent headquartered city, average district name, and average city area for districts that meet the following conditions: the district ID is not 11 or the headquartered city is not Chakwal City and the city area is not 12.0 and the city population is less than or equal to 314617.0, and also meet these conditions: the district name is not Bhakkar District or the district ID is not 5 or the headquartered city is not Dera Ghazi Khan City and the city population is less than or equal to 219254.0?

SELECT City_Population, District_ID, MAX(Headquartered_City), AVG(District_name), AVG(City_Area) FROM district WHERE "District_ID" <> 11 OR Headquartered_City != "Chakwal City" AND "City_Area" <> 12.0 AND "City_Population" <= 314617.0 INTERSECT SELECT City_Population, District_ID, MAX(Headquartered_City), AVG(District_name), AVG(City_Area) FROM district WHERE District_name != "Bhakkar District" OR "District_ID" <> 5 OR Headquartered_City != "Dera Ghazi Khan City" AND "City_Population" <= 219254.0


Question: What are the aircraft IDs that are present in both the aircraft and airport_aircraft tables, where the aircraft ID is greater than or equal to 1?

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


Question: What are the driver IDs greater than 10 from the driver table, combined with the driver IDs not equal to 10 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 != 10


Question: What are the destination, flight number, airline ID, and departure date, along with the minimum distance, for flights that meet any of these conditions: the price is less than 278.56, the arrival date is 04/12/2005 05:03, the origin is not Los Angeles, or the distance is not 1749; or for flights where the origin is Chicago, or the distance is greater than or equal to 2606 and the flight number is not 76 and the departure date is not 04/12/2005 07:03 and the destination is not Los Angeles, or the airline ID is greater than 3?

destination flno aid departure_date MIN(distance)

SELECT destination, flno, aid, departure_date, MIN(distance) FROM flight WHERE "price" < 278.56 OR arrival_date = "04/12/2005 05:03" OR origin != "Los Angeles" OR "distance" <> 1749 UNION SELECT destination, flno, aid, departure_date, MIN(distance) FROM flight WHERE origin = "Chicago" OR "distance" >= 2606 AND "flno" <> 76 AND departure_date != "04/12/2005 07:03" AND destination != "Los Angeles" OR "aid" > 3


Question: How many employees have certificates, excluding those with employee ID 567354612, but not including those with employee IDs greater than 552455348?

SELECT COUNT(eid) FROM certificate WHERE "eid" <> 567354612 EXCEPT SELECT COUNT(eid) FROM employee WHERE "eid" > 552455348


Question: What are the driver IDs that are greater than or equal to 1, excluding driver ID 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 driver IDs that appear in both the driver and school bus tables, where the driver ID is less than or equal to 8 in the driver table and less than 9 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 < 9


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

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


Question: Which driver IDs are less than or equal to 5, but not greater than 9, considering only the driver and school bus information?

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: Which driver IDs are greater than 9, and also include driver ID 9?

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: Which driver IDs are present in both the driver and school bus tables, excluding driver ID 5 from the driver table and including only driver IDs less than or equal to 3 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 <= 3


Question: What are the final table made, money rank, and best finish for poker players where the final table made is not 42, or the best finish is at least 1, the people ID is less than 6, the earnings are greater than 189233, and the poker player ID is 5, or the money rank is not 154? Also, what are the final table made, money rank, and best finish for poker players where the poker player ID is not 1, or the final table made is less than or equal to 19, or the earnings are not 189233 and the people ID is not 1?

SELECT Final_Table_Made, Money_Rank, Best_Finish FROM poker_player WHERE "Final_Table_Made" != 42.0 OR "Best_Finish" >= 1.0 AND "People_ID" < 6 AND "Earnings" > 189233.0 AND "Poker_Player_ID" = 5 OR "Money_Rank" != 154.0 UNION SELECT Final_Table_Made, Money_Rank, Best_Finish FROM poker_player WHERE "Poker_Player_ID" != 1 OR "Final_Table_Made" <= 19.0 OR "Earnings" != 189233.0 AND "People_ID" != 1


Question: What are the maximum page size and maximum DPI for the Xerox Travel Scanner 100, and what are the maximum page size and maximum DPI for all other products, including those with a DPI of 600, a page size other than 216mm x 355mm, dimensions not equal to 300 x 50 x 45, an interface other than USB 2.0, a color pages per minute value other than 30, or a product ID other than 3?

SELECT max_page_size, MAX(dpi) FROM product WHERE product = "Xerox Travel Scanner 100" UNION ALL SELECT max_page_size, MAX(dpi) FROM product WHERE product <> "Xerox Travel Scanner 100" OR "dpi" = 600.0 OR max_page_size != "216mm x 355mm" OR dimensions <> "300 x 50 x 45" AND interface != "USB 2.0" OR "pages_per_minute_color" <> 30.0 OR "product_id" != 3


Question: What are the aircraft IDs, excluding aircraft ID 3, and also the aircraft IDs from airport_aircraft, excluding aircraft ID 5?

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


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

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


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

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


Question: What is the average of the role descriptions for roles that are not "Editor", combined with the average of the role descriptions for roles that do not have the code "PR"?

SELECT AVG(role_description) FROM Roles WHERE role_description != "Editor" UNION ALL SELECT AVG(role_description) FROM Roles WHERE role_code <> "PR"


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 3 from the airport_aircraft table?

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


Question: What is the average store ID for districts where the store ID is at least 1 or the district ID is less than 15, excluding the average store ID for products where the product ID is less than 3 and the store ID is less than 1?

SELECT AVG(Store_ID) FROM store_district WHERE "Store_ID" >= 1 OR "District_ID" < 15 EXCEPT SELECT AVG(Store_ID) FROM store_product WHERE "Product_ID" < 3 AND "Store_ID" < 1


Question: What are the maximum disk loading, maximum total disk area, maximum gross weight, and aircraft names for aircraft that meet any of these conditions: the aircraft ID is 3 and the maximum gross weight is 123,500 lb (56,000 kg); or the maximum disk loading is not 15 lb/ft² (72 kg/m²) and the total disk area is 8,495 ft² (789 m²); or the aircraft is not Robinson R-22 and the description is not "Heavy-lift helicopter"; or the aircraft is not CH-47D Chinook; or the total disk area is not 5,655 ft² (526 m²)?

SELECT Max_disk_Loading, MAX(Total_disk_area), Max_Gross_Weight, Aircraft FROM aircraft WHERE "Aircraft_ID" = 3 AND Max_Gross_Weight = "123,500 lb (56,000 kg)" OR Max_disk_Loading != "15 lb/ft² (72 kg/m²)" AND Total_disk_area = "8,495 ft² (789 m²)" OR Aircraft != "Robinson R-22" AND Description <> "Heavy-lift helicopter" UNION SELECT Max_disk_Loading, MAX(Total_disk_area), Max_Gross_Weight, Aircraft FROM aircraft WHERE Aircraft != "CH-47D Chinook" OR Total_disk_area != "5,655 ft² (526 m²)"


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

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


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

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 is the sum of People IDs for those who have worked for less than 3 years, excluding the sum of People IDs for people who are not Tom Sheehey, or did not graduate from Wisconsin–Stevens Point, are older than 37, have a People ID of 4 or greater, and are from the United States?

SELECT SUM(People_ID) FROM employment WHERE "Year_working" < 3 EXCEPT SELECT SUM(People_ID) FROM people WHERE Name <> "Tom Sheehey" OR Graduation_College <> "Wisconsin–Stevens Point" AND "Age" > 37 AND "People_ID" >= 4 AND Nationality = "United States"


Question: What are the IDs of drivers, excluding driver 10, and the IDs of school bus drivers, excluding driver 9?

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


Question: What are the aircraft IDs that are both less than 4 and equal to 3?

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


Question: What are the driver IDs that are less than 2, and also the driver IDs from school buses that are not 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 are the aircraft IDs that appear in both the aircraft table and the airport_aircraft table, where the aircraft ID is at least 4 in the aircraft table and at least 3 in the airport_aircraft table?

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


Question: Which driver IDs are less than 2, excluding driver ID 3?

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


Question: Which driver IDs are not equal to 8 but are 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 <> 8 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 9


Question: What are the total budget invested percentage, year, budget invested percentage, budgeted amount, school ID, and total budget percentage budgeted for records in the budget table where the total budget invested percentage is less than 2.7, the year is before 2006, the total budget percentage budgeted is not 2.4, and the budget invested percentage is not 42.9, or the school ID is 2 or greater? Also, show the same information for records where the total budget invested percentage is 2.0 and the budget invested percentage is not 42.9, or the budgeted amount is not 3666 and the invested amount is 95542. Return only the records that satisfy both sets of conditions.

SELECT total_budget_percent_invested, Year, Budget_invested_percent, Budgeted, School_id, total_budget_percent_budgeted FROM budget WHERE "total_budget_percent_invested" < 2.7 AND "Year" < 2006 AND "total_budget_percent_budgeted" != 2.4 AND Budget_invested_percent != "42.9" OR "School_id" >= 2 INTERSECT SELECT total_budget_percent_invested, Year, Budget_invested_percent, Budgeted, School_id, total_budget_percent_budgeted FROM budget WHERE "total_budget_percent_invested" = 2.0 AND Budget_invested_percent != "42.9" OR "Budgeted" != 3666 AND "Invested" = 95542


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

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


Question: What are the coach IDs of coaches who are not male and not named Joe Fabbri, combined with the coach IDs from player-coach relationships where the starting year isn't 2010, the player ID isn't 3, or the coach ID is greater than 1?

SELECT Coach_ID FROM coach WHERE Gender <> "M" AND Coach_name <> "Joe Fabbri" UNION ALL SELECT Coach_ID FROM player_coach WHERE "Starting_year" != 2010 OR "Player_ID" != 3 OR "Coach_ID" > 1


Question: What are the driver IDs, excluding driver ID 11, that are present in both the driver and school bus tables, where the school bus driver ID is greater than 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 driver IDs, excluding driver ID 2, that are present in both the driver and school bus tables, where the driver ID is less than 9 in the school bus table?

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


Question: What are the driver IDs that are greater than or equal to 1, combined with the driver IDs that 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 are the aircraft IDs that are not 3 and are in the aircraft table but not in the airport_aircraft table with IDs less than 1?

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


Question: What are all the allergy types and allergies, excluding wheat, and also including ragweed, from the Allergy_Type table?

SELECT AllergyType, Allergy FROM Allergy_Type WHERE Allergy != "Wheat" UNION ALL SELECT AllergyType, Allergy FROM Allergy_Type WHERE Allergy = "Ragweed"


Question: Which driver IDs are not 8, and which driver ID is 9, considering both drivers and school buses?

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: What are the aircraft IDs, excluding aircraft ID 3, from the aircraft table, and also the aircraft IDs, excluding aircraft ID 1, 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 <> 1


Question: What are the driver IDs greater than 1, and also any driver IDs from school buses that are not 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 are the district IDs that are not district 14 or are headquartered in Jhang City, but are not headquartered in Hafizabad City, and do not have a city population of 365198.0, and are not district 4?

SELECT District_ID FROM district WHERE "District_ID" <> 14 OR Headquartered_City = "Jhang City" EXCEPT SELECT District_ID FROM district WHERE Headquartered_City = "Hafizabad City" AND "City_Population" <> 365198.0 AND "District_ID" <> 4


Question: Which driver IDs are in the driver table but not in the school bus table, excluding driver ID 10 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 <> 10 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 7


Question: What are the album IDs that are not 92 and also have a genre ID of 1?

SELECT id FROM albums WHERE "id" != 92 INTERSECT SELECT id FROM genres WHERE "id" = 1


Question: What driver IDs are present in both the driver table (excluding driver ID 11) and the school bus table (with driver ID 7)?

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


Question: What driver IDs are both not equal to 6 in the driver table and equal to 4 in the school bus table?

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


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

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


Question: What are the store IDs and the sum of their product IDs for stores with IDs less than or equal to 5, excluding those where the product ID is less than 6?

SELECT Store_ID, SUM(Product_ID) FROM store_product WHERE "Store_ID" <= 5 EXCEPT SELECT Store_ID, SUM(Product_ID) FROM store_product WHERE "Product_ID" < 6


Question: How many companies and their maximum type are there, excluding those where the principal activity is "Travel agency" or the ID is less than or equal to 9 or the type is not "Joint Venture" and are incorporated in "Hong Kong", but not including those with an ID less than 14?

SELECT COUNT(id), MAX(Type) FROM operate_company WHERE Principal_activities <> "Travel agency" OR "id" <= 9 OR Type <> "Joint Venture" AND Incorporated_in = "Hong Kong" EXCEPT SELECT COUNT(id), MAX(Type) FROM operate_company WHERE "id" < 14


Question: What is the total of airport IDs and the corresponding company ID for flights with a velocity of 240 or greater?

SELECT SUM(T1.id), T2.company_id FROM airport as T1 JOIN flight as T2 ON T1.id = T2.id WHERE "Velocity" >= 240.0


Question: What are the airport ID, altitude, velocity, pilot, company ID, ID, vehicle flight number, and date for flights that meet any of these conditions: velocity is greater than 240, company ID is greater than or equal to 11, airport ID is greater than or equal to 3, vehicle flight number is not "M2-F1 #0", altitude is greater than 0 and the date is not November 8, 1963, or the pilot is not Thompson and the ID is not 2; and also meet these conditions: velocity is greater than 135, altitude is greater than or equal to 3650, company ID is not 5, the date is not September 3, 1963, and the ID is less than 1, or the airport ID is not 8?

SELECT airport_id, Altitude, Velocity, Pilot, company_id, id, Vehicle_Flight_number, Date FROM flight WHERE "Velocity" > 240.0 OR "company_id" >= 11 OR "airport_id" >= 3 OR Vehicle_Flight_number != "M2-F1 #0" OR "Altitude" > 0.0 AND Date != "November 8, 1963" OR Pilot <> "Thompson" AND "id" <> 2 INTERSECT SELECT airport_id, Altitude, Velocity, Pilot, company_id, id, Vehicle_Flight_number, Date FROM flight WHERE "Velocity" > 135.0 AND "Altitude" >= 3650.0 AND "company_id" != 5 AND Date != "September 3, 1963" AND "id" < 1 OR "airport_id" != 8


Question: What are the document IDs, excluding document ID 4 or draft number 16 with draft details not equal to "r", and also document IDs excluding 20 or with copy number 10?

SELECT document_id FROM Document_Drafts WHERE "document_id" <> 4 OR "draft_number" <> 16 AND draft_details != "r" UNION ALL SELECT document_id FROM Draft_Copies WHERE "document_id" <> 20 OR "copy_number" = 10


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


Question: What are the aircraft IDs that are both equal to 5 in the aircraft table and greater than 1 in the airport_aircraft table?

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


Question: What are the club IDs, and for each club, does the description not equal "Refurbish computers; teach kids and adults about computer basics." and the position is "President", or the student ID is less than or equal to 1007?

SELECT T1.ClubID, T2.ClubID FROM Club as T1 JOIN Member_of_club as T2 ON T1.ClubID == T2.ClubID GROUP BY ClubName HAVING ClubDesc <> "Refurbish computers; teach kids and adults about computer basics." AND Position = "President" OR StuID <= 1007


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

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


Question: What are the property IDs that have a feature ID greater than 2, or a description of "odio", or a property ID not equal to 6, but are not property IDs where the room count is not 3, or oth_feature_2 is not "None", or hse_feature_3 is "None" and the vendor requested price is 2573.0, or the property name is "riverside" and hse_feature_2 is "None", or shp_feature_1 is not "None" and the property type code is not "House" and other_property_details is not "None", or fld_feature_3 is "None", or shp_feature_3 is "None" and oth_feature_1 is not "None" and the property address is not "062 Micaela Court Apt. 707 Margretville, WV 51628-3617", or hse_feature_1 is "None" and apt_feature_3 is not "None" and fld_feature_1 is "None" and oth_feature_3 is not "None" and apt_feature_2 is "est" and the property ID is greater than or equal to 8, or shp_feature_2 is not "None", or the buyer offered price is greater than or equal to 15.17 and the agreed selling price is not 476919.3 and the date sold is not "1997-01-07 19:52:45" and fld_feature_2 is "None", or the date on market is "1978-05-15 10:53:37", or apt_feature_1 is "sed"?

SELECT property_id FROM Other_Property_Features WHERE "feature_id" > 2 OR property_feature_description = "odio" OR "property_id" <> 6 EXCEPT SELECT property_id FROM Properties WHERE "room_count" != 3 OR oth_feature_2 <> "None" OR hse_feature_3 = "None" AND "vendor_requested_price" = 2573.0 OR property_name = "riverside" AND hse_feature_2 = "None" OR shp_feature_1 != "None" AND property_type_code <> "House" AND other_property_details != "None" OR fld_feature_3 = "None" OR shp_feature_3 = "None" AND oth_feature_1 <> "None" AND property_address != "062 Micaela Court Apt. 707 Margretville, WV 51628-3617" OR hse_feature_1 = "None" AND apt_feature_3 != "None" AND fld_feature_1 = "None" AND oth_feature_3 != "None" AND apt_feature_2 = "est" AND "property_id" >= 8 OR shp_feature_2 != "None" OR "buyer_offered_price" >= 15.17 AND "agreed_selling_price" != 476919.3 AND date_sold != "1997-01-07 19:52:45" AND fld_feature_2 = "None" OR date_on_market = "1978-05-15 10:53:37" OR apt_feature_1 = "sed"


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

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


Question: What are the draft numbers where the draft number is at least 17 or the copy number is not 10 and the employee ID is less than 1, combined with the draft numbers where the draft number is greater than 9 and the copy number is 4?

SELECT draft_number FROM Circulation_History WHERE "draft_number" >= 17 OR "copy_number" != 10 AND "employee_id" < 1 UNION SELECT draft_number FROM Draft_Copies WHERE "draft_number" > 9 AND "copy_number" = 4


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

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


Question: Which driver IDs are greater than 9, and also include driver ID 7?

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


Question: What are the price, number of flights, latest arrival date, distance, destination, sum of departure dates, airline ID, and number of origins for flights to Honolulu with flight numbers less than 2 or flights not originating from Chicago or flights with arrival dates not equal to 04/12/2005 03:18 and distances not equal to 7487? Also, what are the price, number of flights, latest arrival date, distance, destination, sum of departure dates, airline ID, and number of origins for flights where the arrival date is not 04/12/2005 07:05 or the departure date is not 04/12/2005 08:45 or the flight number is greater than or equal to 387 and the origin is Los Angeles and the price is greater than 182.0 or the distance is 2551?

price COUNT(flno) MAX(arrival_date) distance destination SUM(departure_date) aid COUNT(origin)

SELECT price, COUNT(flno), MAX(arrival_date), distance, destination, SUM(departure_date), aid, COUNT(origin) FROM flight WHERE destination = "Honolulu" AND "flno" < 2 OR origin <> "Chicago" OR arrival_date != "04/12/2005 03:18" AND "distance" != 7487 UNION ALL SELECT price, COUNT(flno), MAX(arrival_date), distance, destination, SUM(departure_date), aid, COUNT(origin) FROM flight WHERE arrival_date != "04/12/2005 07:05" AND departure_date <> "04/12/2005 08:45" OR "flno" >= 387 AND origin = "Los Angeles" AND "price" > 182.0 OR "distance" = 2551


Question: For each department creation date, how many departments were created? Consider only departments with more than 17347 employees where the count of department names is 1, and departments that are not "Veterans Affairs" or have a department ID other than 12, or have exactly 10600 employees, where the count of department names is not 1.

SELECT Creation, COUNT(Name) FROM department WHERE "Num_Employees" > 17347.0 GROUP BY Creation HAVING COUNT(Name) = 1 UNION SELECT Creation, COUNT(Name) FROM department WHERE Name <> "Veterans Affairs" AND "Department_ID" != 12 OR "Num_Employees" = 10600.0 GROUP BY Creation HAVING COUNT(Name) != 1


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

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


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


Question: Which driver IDs are either 1 or less than or equal to 9, considering both drivers and school buses?

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: What are the document ID, copy number, and draft number for records in the circulation history where the draft number is greater than 1 or the document ID is not 2, and also for records in the draft copies table where the document ID is greater than 10?

SELECT document_id, copy_number, draft_number FROM Circulation_History WHERE "draft_number" > 1 OR "document_id" != 2 UNION ALL SELECT document_id, copy_number, draft_number FROM Draft_Copies WHERE "document_id" > 10


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

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


Question: Which driver IDs are not 10 but are in the driver table, or are driver ID 9 in the school bus table?

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


Question: Which employee IDs are in the certificate table but not in the employee table where the employee ID is greater than 556784565 or the salary is less than or equal to 54921, excluding employee ID 242518965?

SELECT eid FROM certificate WHERE "eid" <> 242518965 EXCEPT SELECT eid FROM employee WHERE "eid" > 556784565 OR "salary" <= 54921


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

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


Question: Which club IDs are not from "Pen and Paper Gaming" or have an ID greater than or equal to 3, but are not club ID 1 if the student ID is 1010?

SELECT ClubID FROM Club WHERE ClubName <> "Pen and Paper Gaming" OR "ClubID" >= 3 EXCEPT SELECT ClubID FROM Member_of_club WHERE "ClubID" = 1 AND "StuID" = 1010


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

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


Question: What are the aircraft IDs greater than 4, and also the aircraft ID 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: Which driver IDs are equal to 10 in the driver table but not equal to 3 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: What are the aircraft IDs that are not 2 and also appear in the airport aircraft table with IDs less than 3?

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


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

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: Which driver IDs are in either the driver table (excluding ID 12) or the school bus table (with IDs less than 10)?

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


Question: Which driver IDs are not equal to 5 and are in the driver table but not in the school bus table where the driver ID is less than or equal to 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 sum of the ranks and the count of coach IDs for female coaches, and what is the sum of the ranks and the count of coach IDs for male coaches who are not coach ID 3, are in club ID 3 or less, and have a rank of 5 or higher?

SELECT SUM(Rank), COUNT(Coach_ID) FROM coach WHERE Gender != "M" UNION ALL SELECT SUM(Rank), COUNT(Coach_ID) FROM coach WHERE Gender = "M" AND "Coach_ID" <> 3 AND "Club_ID" <= 3 AND "Rank" >= 5


Question: What is the average item ID and the rank, grouped by rank, where the user ID is greater than 2, the rank is less than 3, the author ID is greater than 1, the title is "comb", or the rating is less than or equal to 6, and after grouping, either the author ID is not 5 or the user ID is less than or equal to 2 and the title is not "pear"?

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


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

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


Question: Which driver IDs are associated with school buses, including driver ID 3, and also list any other driver IDs except for driver ID 3?

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


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

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


Question: What are the aircraft IDs, excluding aircraft ID 4, from the aircraft table, combined with the aircraft IDs, excluding aircraft ID 5, from the airport_aircraft table?

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


Question: Which driver IDs are either 10 or less than 4, 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 < 4


Question: What are all the document type codes, excluding "Hard Drive", and also including those with descriptions that don't contain the letter "u"?

SELECT document_type_code FROM Ref_Document_Types WHERE document_type_code <> "Hard Drive" UNION ALL SELECT document_type_code FROM Ref_Document_Types WHERE document_type_description != "u"


Question: Which employee IDs are either less than 3 or were not awarded in 2011, or have an ID of 7, or have a bonus greater than 4000?

SELECT Employee_ID FROM employee WHERE "Employee_ID" < 3 UNION ALL SELECT Employee_ID FROM evaluation WHERE Year_awarded <> "2011" OR Employee_ID = "7" OR "Bonus" > 4000.0


Question: Which driver IDs are equal to 9 in the driver table, or less than 3 in the school bus table?

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


Question: What are the aircraft IDs, excluding aircraft ID 1, that are in the aircraft table, combined with the aircraft IDs, excluding aircraft ID 3, that are in the airport_aircraft table?

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


Question: What is the sum of middle names and the last name for staff members who weren't born on April 27, 1998, at 12:55:05 and don't have the middle name "Duane"? Also, what is the sum of middle names and the last name for staff members whose last name is "Macejkovic" and whose staff address ID isn't 1 and whose nickname isn't "ymiller", or whose first name is "Ludie" and middle name is "Dejon"?

SELECT SUM(middle_name), last_name FROM Staff WHERE date_of_birth != "1998-04-27 12:55:05" AND middle_name != "Duane" UNION SELECT SUM(middle_name), last_name FROM Staff WHERE last_name = "Macejkovic" AND "staff_address_id" <> 1 AND nickname != "ymiller" OR first_name = "Ludie" AND middle_name = "Dejon"


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

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


Question: Show me the names, ages, birth states, and head IDs of people from the 'head' table who are not named Pádraig Harrington and have a head ID greater than 5, or were born in California. Also, show me the names, ages, birth states, and head IDs of people from the 'head' table who are not named Jeff Maggert and are at least 50 years old, or were not born in Alabama.

SELECT name, age, born_state, head_ID FROM head WHERE name <> "Pádraig Harrington" AND "head_ID" > 5 OR born_state = "California" UNION SELECT name, age, born_state, head_ID FROM head WHERE name != "Jeff Maggert" AND "age" >= 50.0 OR born_state <> "Alabama"


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

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