Question: Is "food" the only allergy type listed in the Allergy_Type table?

SELECT AllergyType FROM Allergy_Type WHERE AllergyType = "food" NOT IN (SELECT AllergyType FROM Allergy_Type WHERE AllergyType <> "food")


Question: What are the album IDs for artist 90 that are not genre IDs less than or equal to 16?

SELECT id FROM albums WHERE "artist_id" = 90 EXCEPT SELECT id FROM genres WHERE "id" <= 16


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

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


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

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


Question: Which aircraft IDs appear in both the aircraft table and the airport_aircraft table, where the aircraft ID is at least 5 in the aircraft table and greater than 2 in the airport_aircraft table?

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


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

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


Question: What are the shop IDs from the hiring table where the start year isn't 2003, combined with the shop IDs from the shop table where the shop name is FF Jaro and the district is Magnum Areena, or the number of products is less than 10000, or the shop ID is greater than 6, or the manager's name isn't Ilkka Mäkelä?

SELECT Shop_ID FROM hiring WHERE Start_from != "2003" UNION SELECT Shop_ID FROM shop WHERE Name = "FF Jaro" AND District = "Magnum Areena" OR "Number_products" < 10000 OR "Shop_ID" > 6 OR Manager_name != "Ilkka Mäkelä"


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


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


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

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


Question: What are the names and sales in billions for companies that don't have assets of 2265.8 billion, combined with the names and sales in billions for companies that are not Volkswagen Group or are in the oil and gas industry and have sales less than or equal to 216.2 billion and profits less than 15.9 billion?

SELECT Name, Sales_in_Billion FROM company WHERE "Assets_in_Billion" <> 2265.8 UNION SELECT Name, Sales_in_Billion FROM company WHERE Name <> "Volkswagen Group" OR Industry = "Oil and gas" AND "Sales_in_Billion" <= 216.2 AND "Profits_in_Billion" < 15.9


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

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


Question: What are the driver IDs that are both 4 or greater and also less than 10, considering only the driver and school bus tables?

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


Question: What are the aircraft IDs that appear in both the aircraft table (with IDs greater than or equal to 1) and the airport_aircraft table (with IDs greater than 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 is the sum of People IDs from the people table where the nationality is Russia, or the name is not Semen Poltavskiy, or the height is not 182.0, or the People ID is greater than or equal to 7 and the birth date is not August 16, 1982? Also, what is the sum of People IDs from the poker player table where the money rank is 58.0, or the poker player ID is not 3, or the best finish is 1.0, or the earnings are 476090.0 and the People ID is less than or equal to 6 and the final table made is less than or equal to 21.0?

SELECT SUM(People_ID) FROM people WHERE Nationality = "Russia" OR Name != "Semen Poltavskiy" OR "Height" != 182.0 OR "People_ID" >= 7 AND Birth_Date != "August 16, 1982" UNION ALL SELECT SUM(People_ID) FROM poker_player WHERE "Money_Rank" = 58.0 OR "Poker_Player_ID" != 3 OR "Best_Finish" = 1.0 OR "Earnings" = 476090.0 AND "People_ID" <= 6 AND "Final_Table_Made" <= 21.0


Question: What are the document type codes and descriptions for all document types except "Paper", and also for any document type with a description of "u"?

SELECT document_type_code, document_type_description FROM Ref_Document_Types WHERE document_type_code <> "Paper" AND document_type_description <> "u" UNION ALL SELECT document_type_code, document_type_description FROM Ref_Document_Types WHERE document_type_description = "u"


Question: Which driver IDs are greater than 11, excluding those with ID 9, considering only the driver and school bus information?

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


Question: What are the driver IDs that are less than 12, excluding those driver IDs that are greater than 10 and are also present in the school bus records?

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


Question: What are the member and branch IDs for members who are not member ID 4 and also not registered in the year 2016?

SELECT Member_ID, Branch_ID FROM membership_register_branch WHERE "Member_ID" != 4 INTERSECT SELECT Member_ID, Branch_ID FROM membership_register_branch WHERE Register_Year <> "2016"


Question: Which driver IDs are equal to 4 in the driver table, or less than or 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 driver IDs that are less than 9, and also the driver IDs from school buses that are not equal to 4?

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


Question: What is the highest user ID from reviews where the article ID is less than or equal to 1, the item ID is not 7, or the rating is 5, but not the highest user ID from user accounts where the name is not Emily and the user ID is less than 7?

SELECT MAX(u_id) FROM review WHERE "a_id" <= 1 OR "i_id" <> 7 OR "rating" = 5 EXCEPT SELECT MAX(u_id) FROM useracct WHERE name <> "Emily" AND "u_id" < 7


Question: Which driver IDs are not 8, and which driver ID is 4, 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 = 4


Question: What are the product IDs sold at store 3 and store 5?

SELECT Product_ID FROM store_product WHERE "Store_ID" = 3 UNION ALL SELECT Product_ID FROM store_product WHERE "Store_ID" = 5


Question: Which driver IDs are less than or equal to 11 but not present in the school bus table with IDs greater than 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 are the document IDs that are in the drafts but not mailed to address 5 on a date other than November 3, 1971?

SELECT document_id FROM Document_Drafts WHERE "document_id" <> 23 EXCEPT SELECT document_id FROM Documents_Mailed WHERE "mailed_to_address_id" = 5 AND mailing_date <> "1971-11-03 12:32:14"


Question: What are the aircraft IDs that are less than 3, but not greater than 2, based on the aircraft and airport_aircraft tables?

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 not equal to 9 but are not present in the school bus table with driver IDs greater than 7?

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


Question: 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 ID 7 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 <> 7


Question: What are the aircraft IDs that appear in the aircraft table with an ID less than or equal to 1, combined with the aircraft IDs from the airport_aircraft table that have an ID less than or equal to 5?

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


Question: What are the aircraft IDs that are both less than or equal to 4 and present in the aircraft table, and also less than or equal to 1 and present in the airport_aircraft table?

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


Question: What are the driver IDs, excluding ID 10, that are present in both the driver and school bus tables, where the school bus driver ID is 3 or greater?

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: How many documents meet these criteria: the employee ID is greater than 1, or the draft number is less than 1 and the copy number is less than 10, or the document ID is greater than or equal to 1, but exclude the count of documents where the document ID is not 20?

SELECT COUNT(document_id) FROM Circulation_History WHERE "employee_id" > 1 OR "draft_number" < 1 AND "copy_number" < 10 OR "document_id" >= 1 EXCEPT SELECT COUNT(document_id) FROM Draft_Copies WHERE "document_id" <> 20


Question: What states are associated with area codes 504 or greater, and what states had votes created on March 9, 2018, at 19:03:36, excluding vote ID 3, excluding California, where the phone number is less than 6209222712 and the contestant number is 2 or less?

SELECT state FROM AREA_CODE_STATE WHERE "area_code" >= 504 UNION ALL SELECT state FROM VOTES WHERE created = "2018-03-09 19:03:36" AND "vote_id" <> 3 AND state != "CA" AND "phone_number" < 6209222712 AND "contestant_number" <= 2


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


Question: Which driver IDs are present in both the driver and school bus tables, excluding driver ID 10 from the driver table and driver IDs less than or equal to 7 from the school bus table?

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


Question: What is the minimum airport ID and the pilot for flights that meet the following criteria: the airport IATA code is BLL and the altitude is not 3650.0, and the airport ID is not 1, or the airport name is Bergen Airport, or the company ID is at least 11 and the country is Belgium and the velocity is not 240.0 and the date is October 25, 1963, or the city is Akureyri, or the pilot is not Thompson, grouped by vehicle flight number, and the velocity is greater than 240.0 or the pilot is Thompson?

SELECT MIN(T1.id), T2.Pilot FROM airport as T1 JOIN flight as T2 ON T1.id = T2.id WHERE IATA = "BLL" AND "Altitude" <> 3650.0 AND "airport_id" <> 1 OR name = "Bergen Airport" OR "company_id" >= 11 AND Country = "Belgium" AND "Velocity" <> 240.0 AND Date = "October 25, 1963" OR City = "Akureyri" OR Pilot <> "Thompson" GROUP BY Vehicle_Flight_number HAVING Velocity > 240.0 OR Pilot = "Thompson"


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

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


Question: What are the aircraft IDs that are either 1 or greater than 3?

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 IDs of albums with an ID of 217 or higher, or any album that isn't titled "Fear Of The Dark", and also the ID of playlist 12?

SELECT id FROM albums WHERE "id" >= 217 OR title <> "Fear Of The Dark" UNION SELECT id FROM playlists WHERE "id" = 12


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

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


Question: Which contestant numbers are greater than 8 but not found in votes with a vote ID of 2 or higher, or where the state isn't CA, or where the contestant number is less than 2, or where the phone number is 5112677315 or less?

SELECT contestant_number FROM CONTESTANTS WHERE "contestant_number" > 8 EXCEPT SELECT contestant_number FROM VOTES WHERE "vote_id" >= 2 OR state <> "CA" AND "contestant_number" < 2 OR "phone_number" <= 5112677315


Question: Which driver IDs are less than 7 but not present in the school bus table with IDs less than or 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


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

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


Question: What are all the document type codes where the description is not "f"?

SELECT document_type_code FROM Ref_Document_Types WHERE document_type_description != "f" UNION SELECT document_type_code FROM Ref_Document_Types WHERE document_type_description <> "f"


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

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


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

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


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

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


Question: What are the driver IDs that are greater than or equal to 2, excluding those driver IDs that are not equal to 3, considering only the driver and school bus information?

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


Question: What school types are found in schools that are not Occidental College, and also in schools where the school ID is less than or equal to 2 or the school is not Harvard Law School?

SELECT Type FROM school WHERE School != "Occidental College" INTERSECT SELECT Type FROM school WHERE "School_ID" <= 2 OR School != "Harvard Law School"


Question: What are the aircraft IDs that are either ID 4 from the aircraft table or greater than 2 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 > 2


Question: What are the employee IDs and bonuses for employees who received a bonus of at least 2900 in 2016, and also for those who received exactly 2900 as a bonus, based on the evaluation data?

SELECT Employee_ID, Bonus FROM evaluation WHERE "Bonus" >= 2900.0 AND Year_awarded = "2016" UNION ALL SELECT Employee_ID, Bonus FROM evaluation WHERE "Bonus" = 2900.0


Question: What is the sum of company IDs and the average of years worked for employees with a people ID greater than 2, a company ID of 13 or more, and 3 or fewer years worked, combined with the sum of company IDs and the average of years worked for employees with a company ID of 15 or more?

SELECT SUM(Company_ID), AVG(Year_working) FROM employment WHERE "People_ID" > 2 AND "Company_ID" >= 13 AND "Year_working" <= 3 UNION ALL SELECT SUM(Company_ID), AVG(Year_working) FROM employment WHERE "Company_ID" >= 15


Question: What are the IDs of flights with flight number "M2-F1 #64" and ID greater than 2, or velocity less than 240, or airport ID less than or equal to 4, that also have IDs present in operate companies where principal activities are not "Airline" or name is not "Cathay Pacific Cargo" and group equity shareholding is less than 100, and ID is greater than 5?

SELECT id FROM flight WHERE Vehicle_Flight_number = "M2-F1 #64" AND "id" > 2 OR "Velocity" < 240.0 OR "airport_id" <= 4 INTERSECT SELECT id FROM operate_company WHERE Principal_activities != "Airline" OR name != "Cathay Pacific Cargo" AND "Group_Equity_Shareholding" < 100.0 AND "id" > 5


Question: What are the driver IDs that are either 12 from the driver table or 3 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 = 3


Question: Which driver IDs are less than 3 but not equal to 4, considering only driver IDs from the 'driver' table and excluding those from the 'school_bus' table?

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


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


Question: What states have area codes less than or equal to 979, excluding California, and also either have a phone number of 7182887233 or are not New Jersey?

SELECT state FROM AREA_CODE_STATE WHERE "area_code" <= 979 AND state <> "CA" INTERSECT SELECT state FROM VOTES WHERE "phone_number" = 7182887233 OR state <> "NJ "


Question: What are the driver IDs greater than 5 that are not driver IDs from school buses that are not equal to 9?

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


Question: What are the aircraft IDs that appear in the 'aircraft' table more than 5 times or in the 'airport_aircraft' table at least 2 times?

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


Question: What are the driver IDs that are either 4 or greater than 7?

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


Question: Which driver IDs are not 12, and also which driver ID is 4, considering both drivers and school buses?

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


Question: What are the IDs of albums that are not by artist 127 and not album 117, or have the title "BBC Sessions [Disc 1] live", and also the IDs of playlists named "Audiobooks"?

SELECT id FROM albums WHERE "artist_id" <> 127 AND "id" <> 117 OR title = "BBC Sessions [Disc 1] live" UNION ALL SELECT id FROM playlists WHERE name = "Audiobooks"


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

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


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

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


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

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


Question: 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 IDs greater than 9 from the school bus table?

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


Question: What are the company IDs where the working year is 2 or less, or where the people ID is less than 4, the company ID is 17 or greater, and the working year is not 1?

SELECT Company_ID FROM employment WHERE "Year_working" <= 2 UNION SELECT Company_ID FROM employment WHERE "People_ID" < 4 AND "Company_ID" >= 17 AND "Year_working" != 1


Question: What is the average aircraft ID for each aircraft, considering data from the aircraft and airport_aircraft tables?

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


Question: What are the flight IDs, distances, and arrival dates for flights where the flight ID is greater than 3 and the arrival date is "04/12/2005 12:02", or the distance is 1251, or the flight number is less than or equal to 2, or the destination is "Washington D.C." and the price is not 261.56, or the departure date is "04/12/2005 06:30", excluding flights where the flight number is not 34 and the flight ID is greater than or equal to 5, or the price is greater than 375.23 and the destination is not "Washington D.C." and the arrival date is not "04/12/2005 08:45" and the departure date is not "04/12/2005 07:03" and the origin is "Los Angeles"?

SELECT aid, distance, arrival_date FROM flight WHERE "aid" > 3 AND arrival_date = "04/12/2005 12:02" OR "distance" = 1251 OR "flno" <= 2 OR destination = "Washington D.C." AND "price" != 261.56 OR departure_date = "04/12/2005 06:30" EXCEPT SELECT aid, distance, arrival_date FROM flight WHERE "flno" <> 34 AND "aid" >= 5 OR "price" > 375.23 AND destination <> "Washington D.C." AND arrival_date != "04/12/2005 08:45" AND departure_date <> "04/12/2005 07:03" AND origin = "Los Angeles"


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


Question: What are the document ID, copy number, and draft number for records in the Circulation_History table where the document ID is less than or equal to 20 and the draft number is greater than 2, or where the employee ID is less than or equal to 1 and the copy number is not 4? Also, what are the document ID, copy number, and draft number from the Draft_Copies table where the document ID is greater than 1 and the draft number is not 9, or where the copy number is not 10?

SELECT document_id, copy_number, draft_number FROM Circulation_History WHERE "document_id" <= 20 AND "draft_number" > 2 OR "employee_id" <= 1 AND "copy_number" != 4 UNION ALL SELECT document_id, copy_number, draft_number FROM Draft_Copies WHERE "document_id" > 1 AND "draft_number" != 9 OR "copy_number" <> 10


Question: How many companies have a market value in billions, grouped by people ID, where the market value is less than or equal to 213.7, or the company name is "Industrial and Commercial Bank of China", or the profits are not 20.1 and the industry is not "Conglomerate", or the assets are 1563.9 and the working year is less than or equal to 1, or the people ID is greater than 3, or the sales are 447.0, or the headquarters is not "China"?

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


Question: What are the driver IDs that are greater than or equal to 5, and also the driver IDs that are less than or equal to 3?

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


Question: 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 IDs 3 or less 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 <= 3


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

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: Which driver IDs are less than 3, and also the driver ID 3, considering both drivers and school buses?

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


Question: What are the driver IDs that are equal to 3, but not equal to 4, based on driver and school bus information?

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


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


Question: What are the distance and aid values from the aircraft table where the aircraft name isn't "Boeing 757-300", or the aid is at least 14, or the distance is less than 1502? Also, what are the distance and aid values from the flight table where the origin isn't "Chicago", or the distance is at least 1251 and the destination is "Sydney", or the aid is at least 1, or the departure date isn't "04/12/2005 07:03"? Combine the results from both.

SELECT distance, aid FROM aircraft WHERE name <> "Boeing 757-300" OR "aid" >= 14 OR "distance" < 1502 UNION SELECT distance, aid FROM flight WHERE origin != "Chicago" OR "distance" >= 1251 AND destination = "Sydney" OR "aid" >= 1 OR departure_date != "04/12/2005 07:03"


Question: Which coach IDs are associated with coaches whose rank is not 5, or with players who started coaching after 2012?

SELECT Coach_ID FROM coach WHERE "Rank" != 5 UNION SELECT Coach_ID FROM player_coach WHERE "Starting_year" > 2012


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


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


Question: What are the aircraft IDs that are less than 5, but not equal to 1, considering only 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 != 1


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

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


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

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


Question: What are the ages and majors of students who either have a major of 550, a first name other than Arthur, or a student ID less than or equal to 1022 and a sex other than M or a city code that is not BAL, or who are under 20 years old, or have a major less than or equal to 100 and a city code of ROC, or a last name other than Lee and an advisor other than 8722, or a first name other than Lisa?

SELECT Age, Major FROM Student WHERE "Major" = 550 OR Fname != "Arthur" OR "StuID" <= 1022 AND Sex != "M" OR city_code <> "BAL" UNION SELECT Age, Major FROM Student WHERE "Age" <= 19 OR "Major" <= 100 AND city_code = "ROC" OR LName <> "Lee" AND "Advisor" <> 8722 OR Fname != "Lisa"


Question: What are the driver IDs that are less than 5 from the driver table, combined with the driver IDs that are less than 9 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 < 9


Question: What are the driver IDs greater than or equal to 11 that are in the driver table but not in the school bus table, excluding any driver with ID 7?

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


Question: What are the driver IDs, excluding driver ID 7, that are present in both the driver and school bus tables, where the school bus driver IDs are less than or equal to 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: Which driver IDs are not equal to 11, but are not found on school buses with IDs greater than or equal to 7?

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


Question: What are the store and district IDs where the district ID is 15 or less and the store ID is greater than 2, and also where the store ID is not 3 and the district ID is 4 or greater?

SELECT Store_ID, District_ID FROM store_district WHERE "District_ID" <= 15 AND "Store_ID" > 2 INTERSECT SELECT Store_ID, District_ID FROM store_district WHERE "Store_ID" != 3 AND "District_ID" >= 4


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

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


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

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


Question: What are the aircraft IDs that appear in the aircraft table but not in the airport_aircraft table, where the aircraft ID is greater than 1 in both tables?

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


Question: What are the driver IDs that are either 8 or greater from the driver table, or greater than 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 descriptions and codes of shipping agents, excluding those named "UPS" or with a description of "k" and a code other than "US", combined with the descriptions and codes of agents with the code "US" or a description other than "q" and the name "USPS"?

SELECT shipping_agent_description, shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_name <> "UPS" OR shipping_agent_description = "k" AND shipping_agent_code != "US" UNION ALL SELECT shipping_agent_description, shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_code = "US" OR shipping_agent_description != "q" AND shipping_agent_name = "USPS"


Question: Which driver IDs are present in both the driver and school bus tables, where the driver ID is no more than 5 in the driver table and no more than 3 in the school bus table?

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


Question: What is the average employee ID, name, and salary for employees who are not Lawrence Sperry, and also what is the average employee ID, name, and salary for employees who are not Linda Davis or whose salary is less than or equal to 205187?

SELECT AVG(eid), name, salary FROM employee WHERE name != "Lawrence Sperry" UNION SELECT AVG(eid), name, salary FROM employee WHERE name <> "Linda Davis" OR "salary" <= 205187


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

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


Question: What are the aircraft IDs, excluding aircraft ID 2, from the aircraft table, combined with the aircraft IDs, excluding aircraft ID 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: Which driver IDs are not equal to 11 but are not found 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 <> 11 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <= 10


Question: Which driver IDs are either 4, or not 4?

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


Question: Which driver IDs are greater than or equal to 3 and also appear in the school bus table, excluding driver ID 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: Which driver IDs are present in both the driver and school bus tables, excluding driver ID 3 from the driver table and driver ID 10 from the school bus table?

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


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

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


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

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


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

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


Question: Which driver IDs, excluding driver ID 12, are in the driver table, and also which driver ID 4 is 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 years and member IDs from the purchase table where the branch ID is not "3", combined with the years and member IDs where the branch ID is not "1" and the total pounds are less than or equal to 430.29, or the member ID is less than or equal to 2?

SELECT Year, Member_ID FROM purchase WHERE Branch_ID != "3" UNION ALL SELECT Year, Member_ID FROM purchase WHERE Branch_ID <> "1" AND "Total_pounds" <= 430.29 OR "Member_ID" <= 2


Question: What are the names and user IDs of all users, excluding Roxi, and also those with a user ID of 2, plus any user with a user ID of 7 or less?

SELECT name, u_id FROM useracct WHERE name <> "Roxi" AND "u_id" <> 2 UNION ALL SELECT name, u_id FROM useracct WHERE "u_id" <= 7


Question: What are the driver IDs that are either greater than or equal to 3 in the driver table or equal to 10 in 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 driver IDs greater than 4 who are not also driver IDs less than 7?

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


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

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


Question: What are all the aid values from the certificate table where aid is 12 or greater, combined with all aid values from the flight table where aid is not 3 or the destination is not Washington D.C.?

SELECT aid FROM certificate WHERE "aid" >= 12 UNION ALL SELECT aid FROM flight WHERE "aid" != 3 OR destination != "Washington D.C."


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

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


Question: What car models are not "volkswagen" or have a "MakeId" less than or equal to 142, and also appear in the model list with a "ModelId" not equal to 4 and a "Maker" not equal to 4, excluding "datsun"?

SELECT Model FROM car_names WHERE Model <> "volkswagen" OR "MakeId" <= 142 INTERSECT SELECT Model FROM model_list WHERE "ModelId" <> 4 OR "Maker" <> 4 AND Model <> "datsun"


Question: What are the maximum PetIDs and corresponding StuIDs for pets with PetIDs less than 2003, combined with the maximum PetIDs and StuIDs for pets with PetID equal to 2002 or StuID greater than 1001?

SELECT MAX(PetID), StuID FROM Has_Pet WHERE "PetID" < 2003 UNION SELECT MAX(PetID), StuID FROM Has_Pet WHERE "PetID" = 2002 OR "StuID" > 1001


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

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


Question: What are the copy numbers, document IDs, and draft numbers for copies where the copy number is 5 or greater, the document ID is not 4, and the draft number is less than 20, or where the draft number is less than 1?

SELECT copy_number, document_id, draft_number FROM Draft_Copies WHERE "copy_number" >= 5 AND "document_id" <> 4 AND "draft_number" < 20 UNION SELECT copy_number, document_id, draft_number FROM Draft_Copies WHERE "draft_number" < 1


Question: What are the driver IDs that are either 9 or less than 7?

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


Question: What are the aircraft IDs that are less than or equal to 3, excluding those aircraft IDs greater than 2 that are also present 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: What are the driver IDs that are both greater than or equal to 1 and also less than or equal to 4, considering only those driver IDs present in both the driver and school bus tables?

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


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

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


Question: Which driver IDs are present in both the driver and school bus tables, excluding driver ID 9, and where the driver ID is greater than 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 aircraft IDs that are both less than or equal to 2 and not equal to 1, considering only those aircraft IDs present in both the aircraft and airport_aircraft tables?

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


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

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


Question: What is the earliest year worked and the total company ID, grouped by people ID, for employment records where the year worked is 3 or less, the people ID is 2, or the company ID is 13 or less, combined with records where the people ID is less than 4?

SELECT MIN(Year_working), People_ID, SUM(Company_ID) FROM employment WHERE "Year_working" <= 3 OR "People_ID" = 2 OR "Company_ID" <= 13 UNION ALL SELECT MIN(Year_working), People_ID, SUM(Company_ID) FROM employment WHERE "People_ID" < 4


Question: What are the document type codes for documents that aren't shipped by UP and have receipt number 117, plus all document type codes that aren't CD?

SELECT document_type_code FROM Documents WHERE shipping_agent_code != "UP" AND receipt_number = "117" UNION ALL SELECT document_type_code FROM Ref_Document_Types WHERE document_type_code <> "CD"


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

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


Question: What are the driver IDs that are less than 6, and also the driver IDs 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: What are the aircraft IDs that appear in both the aircraft table with an ID of 5 or greater and the airport_aircraft table with an ID greater than 2?

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


Question: What are the driver IDs, excluding ID 10, that are present in the driver table, combined with the driver IDs, excluding ID 3, that are present in the school bus table?

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


Question: Which driver IDs are less than 4 but not equal to 4, considering only driver IDs from the 'driver' table and excluding those from the 'school_bus' table?

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


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

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


Question: What are the area codes and contestant numbers, grouped by the creation date, where the vote ID is no more than 5 and the contestant number is at least 3?

SELECT T1.area_code, T2.contestant_number FROM AREA_CODE_STATE as T1 JOIN VOTES as T2 ON T1.state == T2.state GROUP BY created HAVING vote_id <= 5 AND contestant_number >= 3


Question: Which driver IDs are greater than or equal to 8, but not present in the school bus table except for driver ID 4?

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


Question: What are the IDs of players who are not male, or are retired, and also have a player ID greater than 6, or have 14097 votes, or are not ranked 2nd, or don't live in Brandon? Also, what are the player IDs from the player-coach table where the player ID is not 14 and the coach ID is not 5?

SELECT Player_ID FROM player WHERE Gender != "M" OR Occupation = "Retired" AND "Player_ID" > 6 OR "Votes" = 14097 OR Rank <> "2nd" OR Residence <> "Brandon" UNION ALL SELECT Player_ID FROM player_coach WHERE "Player_ID" != 14 AND "Coach_ID" <> 5


Question: What are the driver IDs that are less than 9 from the driver table, combined with the driver IDs that are less than 3 from the school bus table?

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


Question: What are the aircraft IDs that are either 4 or greater, or less than 5?

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


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

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


Question: Show me the contestant number, phone number, and creation date for votes where the contestant number is less than 2 and the state isn't CA and the phone number isn't 6209222712, or the vote ID isn't 5. Also, show me the contestant number, phone number, and creation date for votes created on March 9, 2018, at 7:03:40 PM, or where the contestant number is not 3.

SELECT contestant_number, phone_number, created FROM VOTES WHERE "contestant_number" < 2 AND state != "CA" AND "phone_number" != 6209222712 OR "vote_id" != 5 UNION ALL SELECT contestant_number, phone_number, created FROM VOTES WHERE created = "2018-03-09 19:03:40" OR "contestant_number" <> 3


Question: Which driver IDs are present in both the driver and school bus tables, excluding driver ID 7 from the driver table and including only driver IDs less than or equal to 4 from the school bus table?

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


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


Question: What are the aircraft IDs that are greater than 3 and also have an ID of 5 or more, considering both the aircraft and airport-aircraft information?

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


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

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 that are either less than or equal to 3 in the aircraft table, or greater than or equal to 5 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 >= 5


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

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


Question: What are the aircraft IDs that are either 2 from the aircraft table or less than 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 maximum page size, DPI, interface, color pages per minute, dimensions, product ID, and product name for products that either don't use USB 2.0, have a product ID less than 6, have a DPI greater than 600, aren't the ScanShell 3000DN, or have different dimensions than 298 x 209 x 99, or have color pages per minute less than 3.0, use USB 2.0, aren't the Canon imageFORMULA P-150, have a DPI not equal to 600, or have different dimensions than 280 x 95 x 40?

SELECT max_page_size, dpi, interface, pages_per_minute_color, dimensions, product_id, product FROM product WHERE interface <> "USB 2.0" AND "product_id" < 6 AND "dpi" > 600.0 AND product <> "ScanShell 3000DN" AND "pages_per_minute_color" <> 3.0 OR dimensions <> "298 x 209 x 99" UNION ALL SELECT max_page_size, dpi, interface, pages_per_minute_color, dimensions, product_id, product FROM product WHERE "pages_per_minute_color" < 3.0 OR interface = "USB 2.0" OR product <> "Canon imageFORMULA P-150" OR "dpi" != 600.0 OR dimensions != "280 x 95 x 40"


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

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


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


Question: What are the IDs of the addresses that received mailed documents, where the address ID is less than or equal to zero and the mailing date is not February 21, 1973, or the document ID is greater than 12, and also the mailing date is not November 7, 1992, or the document ID is greater than 20 and the address ID is greater than 3?

SELECT mailed_to_address_id FROM Documents_Mailed WHERE "mailed_to_address_id" <= 0 AND mailing_date <> "1973-02-21 10:17:01" OR "document_id" > 12 INTERSECT SELECT mailed_to_address_id FROM Documents_Mailed WHERE mailing_date != "1992-11-07 15:03:41" OR "document_id" > 20 AND "mailed_to_address_id" > 3


Question: What are the enrollment, maximum location, average school name, sum of county, and IHSAA football class for schools that either aren't class A in football, have school ID 6, have enrollment less than 379, are class AAA, or aren't named New Prairie 1 and don't have the Redskins mascot and are located in Knox? Also, what are the same statistics for schools located in Walkerton that aren't class A in IHSAA, aren't named Bremen, or have an enrollment of 601 or less?

SELECT Enrollment, MAX(Location), AVG(School_name), SUM(County), IHSAA_Football_Class FROM School WHERE IHSAA_Football_Class != "A" OR School_id = "6" OR "Enrollment" < 379 OR IHSAA_Class = "AAA" OR School_name != "New Prairie 1" AND Mascot != "Redskins" AND Location = "Knox" UNION ALL SELECT Enrollment, MAX(Location), AVG(School_name), SUM(County), IHSAA_Football_Class FROM School WHERE Location = "Walkerton" AND IHSAA_Class <> "A" AND School_name != "Bremen" OR "Enrollment" <= 601


Question: What are the genders and ranks of coaches who are not male, or whose coach ID is less than 3 and club ID is not 3, or whose name is not James Wong? Also, what are the genders and ranks of players who are not ranked 3rd?

SELECT Gender, Rank FROM coach WHERE Gender <> "M" OR "Coach_ID" < 3 AND "Club_ID" <> 3 OR Coach_name <> "James Wong" UNION ALL SELECT Gender, Rank FROM player WHERE Rank <> "3rd"


Question: Which driver IDs are greater than 5 in the driver table or greater than or equal to 3 in the school bus table?

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


Question: What are the aircraft IDs that are less than 1, and also the aircraft IDs that are greater than 3, considering the aircraft and airport-aircraft tables?

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


Question: What are the driver IDs from the driver table that are at least 1, combined with the driver IDs from the school bus table that are at least 10?

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


Question: What are the aircraft IDs that are not 4, and also what is the aircraft ID that is 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 all aircraft, excluding aircraft ID 5, that are either listed in the aircraft table or in the airport_aircraft table?

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


Question: Give me the customer details including amount outstanding, date became customer, customer status code, phone number, email address, customer address ID, first name, last name, and customer ID for customers who meet the following criteria: either their customer ID is less than 4 and their customer address ID is not 1, or their date of becoming a customer is not "2016-02-17 08:26:23", or their date of birth is "1996-05-23 01:21:54" and their last name is not "Koelpin", or their cell mobile phone number is not "081-097-3684"; and also meet these criteria: their cell mobile phone number is not "+57(9)4602098297" and their customer address ID is not 9, or their phone number is not "(662)490-3108" and their first name is "Dameon" and their customer ID is less than 6, or their date of birth is not "1994-05-07 01:32:16" and their last name is not "Terry".

SELECT amount_outstanding, date_became_customer, customer_status_code, phone_number, email_address, customer_address_id, first_name, last_name, customer_id FROM Customers WHERE "customer_id" < 4 AND "customer_address_id" <> 1 OR date_became_customer != "2016-02-17 08:26:23" OR date_of_birth = "1996-05-23 01:21:54" AND last_name != "Koelpin" OR cell_mobile_phone_number <> "081-097-3684" INTERSECT SELECT amount_outstanding, date_became_customer, customer_status_code, phone_number, email_address, customer_address_id, first_name, last_name, customer_id FROM Customers WHERE cell_mobile_phone_number <> "+57(9)4602098297" AND "customer_address_id" != 9 OR phone_number <> "(662)490-3108" AND first_name = "Dameon" AND "customer_id" < 6 OR date_of_birth <> "1994-05-07 01:32:16" AND last_name <> "Terry"


Question: Which driver IDs, excluding driver ID 3, are found in the driver table, and which driver IDs, up to and including 7, are found in 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 <= 7


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


Question: What are the aircraft IDs less than 4, and also any aircraft IDs that are not 1, considering both the aircraft and airport_aircraft tables?

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


Question: What are the driver IDs, names, and home cities of drivers who are not affiliated with the "Dem" party, and also the driver IDs, names, and home cities of drivers who are 36 years old and live in Bethel, or are not affiliated with the "Dem" party, or do not have the name "Timothy Ackert" and have a driver ID greater than 3?

SELECT Driver_ID, Name, Home_city FROM driver WHERE Party != "Dem" UNION SELECT Driver_ID, Name, Home_city FROM driver WHERE "Age" = 36 AND Home_city = "Bethel" OR Party != "Dem" OR Name != "Timothy Ackert" AND "Driver_ID" > 3


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

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


Question: Which school IDs are in the budget table for years other than 1999, or with a budgeted amount less than or equal to 6803, a school ID greater than or equal to 4, and a total budget percentage invested of 2.2, or with an invested amount greater than or equal to 5840; and also which school IDs are in the endowment table where the donor name is not "Com. Dom. En Estados Unidos", or the amount is 9.73, or the endowment ID is not 3 and the school ID is greater than 2?

SELECT School_id FROM budget WHERE "Year" != 1999 OR "Budgeted" <= 6803 AND "School_id" >= 4 AND "total_budget_percent_invested" = 2.2 OR "Invested" >= 5840 UNION SELECT School_id FROM endowment WHERE donator_name <> "Com. Dom. En Estados Unidos" OR "amount" = 9.73 OR "endowment_id" != 3 AND "School_id" > 2


Question: Which driver IDs are greater than or equal to 9, but not equal to 3 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 <> 3


Question: What are the aircraft IDs that appear in both the aircraft table (with IDs greater than 1) and the airport_aircraft table (with IDs not 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 that are greater than or equal to 1, excluding those driver IDs that are less than 7 in the school bus records?

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


Question: Which driver IDs are either less than or equal to 6, or greater than or 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: What are the aircraft IDs that are either equal to 1 in the aircraft table or less than 1 in the airport_aircraft table?

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


Question: What are the driver IDs that are either 8 or less than 3?

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


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

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


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


Question: What are the aircraft IDs that are less than 2, excluding any aircraft ID that is equal to 2 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 = 2


Question: What are the names of companies headquartered in the USA, combined with the names of people who are not British, are not Darryl Kennedy, are older than 27, and either have a People_ID other than 5 or graduated from Virginia?

SELECT Name FROM company WHERE Headquarters = "USA" UNION SELECT Name FROM people WHERE Nationality != "United Kindom" AND "People_ID" != 5 AND "Age" > 27 AND Name <> "Darryl Kennedy" OR Graduation_College = "Virginia"


Question: What are the aircraft IDs that are both less than or equal to 16 and have an employee ID greater than 567354612?

SELECT aid FROM aircraft WHERE "aid" <= 16 INTERSECT SELECT aid FROM certificate WHERE "eid" > 567354612


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

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


Question: Can you list the major, sex, last name, advisor, and student ID for students who meet any of the following criteria: their major is greater than 600, their sex is male, their student ID is less than or equal to 1004, their first name is not Lisa and their last name is Kumar and their advisor is greater than or equal to 1121 and their age is greater than 27, or their city code is HOU; or for students whose first name is not Ian and their student ID is less than 1035 and their advisor is less than 1121 and their sex is not male, or their city code is not PIT, or their age is 19?

SELECT Major, Sex, LName, Advisor, StuID FROM Student WHERE "Major" > 600 OR Sex = "M" OR "StuID" <= 1004 OR Fname <> "Lisa" AND LName = "Kumar" AND "Advisor" >= 1121 AND "Age" > 27 OR city_code = "HOU" UNION SELECT Major, Sex, LName, Advisor, StuID FROM Student WHERE Fname <> "Ian" AND "StuID" < 1035 AND "Advisor" < 1121 AND Sex != "M" OR city_code != "PIT" OR "Age" = 19


Question: What are the coach IDs and starting years for coaches with ID 1 or players with ID 4 or higher, combined with the coach IDs and starting years for coaches whose starting year isn't 2011 and coach ID isn't 5?

SELECT Coach_ID, Starting_year FROM player_coach WHERE "Coach_ID" = 1 OR "Player_ID" >= 4 UNION SELECT Coach_ID, Starting_year FROM player_coach WHERE "Starting_year" <> 2011 AND "Coach_ID" <> 5


Question: What are the aircraft IDs that are less than or equal to 2, but not aircraft IDs greater than 1 that are associated with airports?

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


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

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


Question: What are the average altitude, minimum pilot, airport ID, sum of dates, and velocity for flights where the airport ID is less than 6 and the flight ID is not 13, or the vehicle flight number is not "M2-F1 #73" and the altitude is not 3650.0, or the velocity is greater than 240.0, excluding the results where the velocity is less than 240.0, or the date is October 25, 1963 and the altitude is less than 3650.0, or the flight ID is not 3 and the airport ID is less than or equal to 1 and the pilot is Thompson, or the company ID is not 5?

AVG(Altitude) MIN(Pilot) airport_id SUM(Date) Velocity

SELECT AVG(Altitude), MIN(Pilot), airport_id, SUM(Date), Velocity FROM flight WHERE "airport_id" < 6 AND "id" <> 13 OR Vehicle_Flight_number <> "M2-F1 #73" AND "Altitude" <> 3650.0 OR "Velocity" > 240.0 EXCEPT SELECT AVG(Altitude), MIN(Pilot), airport_id, SUM(Date), Velocity FROM flight WHERE "Velocity" < 240.0 OR Date = "October 25, 1963" AND "Altitude" < 3650.0 OR "id" <> 3 AND "airport_id" <= 1 AND Pilot = "Thompson" OR "company_id" <> 5


Question: What are the staff ID, lesson ID, vehicle ID, lesson time, lesson date, and lesson status code for all lessons, excluding those on March 7, 2018 at 4:12:36 PM, and also those with lesson ID greater than 8 and customer ID less than or equal to 9, or a price not equal to 495 and lesson status is cancelled and staff ID less than 15, or vehicle ID less than or equal to 2?

SELECT staff_id, lesson_id, vehicle_id, lesson_time, lesson_date, lesson_status_code FROM Lessons WHERE lesson_date <> "2018-03-07 16:12:36" UNION ALL SELECT staff_id, lesson_id, vehicle_id, lesson_time, lesson_date, lesson_status_code FROM Lessons WHERE "lesson_id" > 8 AND "customer_id" <= 9 OR "price" != 495.0 AND lesson_status_code = "Cancelled" AND "staff_id" < 15 OR "vehicle_id" <= 2


Question: What are the IDs of drivers who have an ID of 5 or greater, and also the IDs of drivers who are not assigned to school bus with ID 10?

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


Question: Which driver IDs are less than 2, and also which driver IDs from the school bus table are not equal to 7?

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 item IDs that have either a rank other than 6, a rating not equal to 5, or an ID less than or equal to 1, and also have a rating of 5 and a user ID greater than 1?

SELECT i_id FROM review WHERE "rank" != 6 OR "rating" <> 5 OR "i_id" <= 1 INTERSECT SELECT i_id FROM review WHERE "rating" = 5 AND "u_id" > 1


Question: What are the driver IDs, excluding driver ID 7, from the driver table, combined with driver IDs from the school bus table that are 7 or greater?

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


Question: What are the publication IDs for publications that are not published by Pearson, or have a publication ID less than 4, a publication date of October 2005, and a price greater than 6,000,000, or have a book ID not equal to 4, but exclude those publications with a publication ID not equal to 6, a price greater than or equal to 2,000,000, and a publication date of June 2006?

SELECT Publication_ID FROM publication WHERE Publisher <> "Pearson" OR "Publication_ID" < 4 AND Publication_Date = "October 2005" AND "Price" > 6000000.0 OR "Book_ID" <> 4 EXCEPT SELECT Publication_ID FROM publication WHERE "Publication_ID" <> 6 AND "Price" >= 2000000.0 AND Publication_Date = "June 2006"


Question: What are the type, maximum group equity shareholding, ID, average name, sum of principal activities, and incorporation location for "Air China Cargo" companies not incorporated in China, combined with the same information for companies that are either not "Cathay Pacific Services Limited" or have an ID other than 11 and are a subsidiary not incorporated in Taiwan?

SELECT Type, MAX(Group_Equity_Shareholding), id, AVG(name), SUM(Principal_activities), Incorporated_in FROM operate_company WHERE name = "Air China Cargo" AND Incorporated_in != "China" UNION ALL SELECT Type, MAX(Group_Equity_Shareholding), id, AVG(name), SUM(Principal_activities), Incorporated_in FROM operate_company WHERE name != "Cathay Pacific Services Limited" OR "id" != 11 AND Type = "Subsidiary" AND Incorporated_in <> "Taiwan"


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

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


Question: How many roles are not "Proof Manager" and what is the longest description, and also, how many "PT" roles are not "Photo" and what is the longest description?

SELECT COUNT(role_code), MAX(role_description) FROM Roles WHERE role_description != "Proof Manager" UNION SELECT COUNT(role_code), MAX(role_description) FROM Roles WHERE role_description <> "Photo" AND role_code = "PT"


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

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


Question: What are the names and user IDs of users named Rosie or with a user ID greater than or equal to 1, combined with the names and user IDs of all users except Helen?

SELECT name, u_id FROM useracct WHERE name = "Rosie" OR "u_id" >= 1 UNION ALL SELECT name, u_id FROM useracct WHERE name <> "Helen"


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


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

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


Question: Which driver IDs are present in both the driver and school bus tables, excluding driver ID 5 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 <> 5 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 7


Question: What are the item IDs of items that are not titled "orange" and have an ID of 3, combined with the item IDs from reviews where the author ID is 3 or the item ID is 1?

SELECT i_id FROM item WHERE title != "orange" AND "i_id" = 3 UNION ALL SELECT i_id FROM review WHERE "a_id" = 3 OR "i_id" = 1


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

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


Question: Which driver IDs are greater than 9, excluding driver ID 7?

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


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

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


Question: Which driver IDs are equal to 11 but not associated with a school bus where the driver ID is not 4?

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 aircraft IDs that are either aircraft ID 4 or any aircraft ID except 1?

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


Question: Which driver IDs, excluding driver ID 10, are in the driver table, and which driver IDs, up to and including 4, are in the school bus table?

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


Question: Which driver IDs are either 4 or not 3, 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 <> 3


Question: What are the names of branches where the membership amount is not 91, excluding any names that are also members with a level greater than 6, or are not named Corey Peters, or don't live in Fort Campbell, Kentucky, or have a member ID less than 10, or have a card number that isn't SLB51?

SELECT Name FROM branch WHERE membership_amount != "91" EXCEPT SELECT Name FROM member WHERE "Level" > 6 OR Name != "Corey Peters" OR Hometown != "Fort Campbell, Kentucky" OR "Member_ID" < 10 OR Card_Number <> "SLB51"


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

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


Question: What are the driver IDs that are either less than or equal to 4 in the driver table or less than 9 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 < 9


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

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


Question: What are the driver IDs, excluding driver ID 4, 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 <> 4 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID < 9


Question: What are the driver IDs that are both less than or equal to 10 and also not equal to 7, considering only those drivers who are 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 <> 7


Question: Which driver IDs are greater than 5 and also appear in the school bus table, excluding driver ID 4?

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


Question: Which driver IDs are in the driver table but not ID 1, and also which driver IDs are in the school bus table with ID 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 either greater than or equal to 4 in the aircraft table, or less than 3 in the airport_aircraft table?

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


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

SELECT T1.Freight_Metric_Tonnes, MAX(T2.ID) FROM airport as T1 JOIN airport_aircraft as T2 ON T1.Airport_ID = T2.Airport_ID


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

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


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

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


Question: Give me the student ID, sex, average major, and city code for all students, including those whose last name isn't Gompers, and also those whose major is less than or equal to 550, or are older than 19, or are not female, or live in BAL, or have a student ID of 1030 or greater, or whose first name isn't Jandy and last name isn't Han.

SELECT StuID, Sex, AVG(Major), city_code FROM Student WHERE LName != "Gompers" UNION SELECT StuID, Sex, AVG(Major), city_code FROM Student WHERE "Major" <= 550 OR "Age" > 19 OR Sex != "F" OR city_code = "BAL" OR "StuID" >= 1030 OR Fname <> "Jandy" AND LName <> "Han"


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

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


Question: What is the sum of the document type descriptions where the description is not "b" and the code is "Hard Drive", combined with the sum of the document type descriptions where the description is "u" and the code is not "Paper"?

SELECT SUM(document_type_description) FROM Ref_Document_Types WHERE document_type_description != "b" AND document_type_code = "Hard Drive" UNION ALL SELECT SUM(document_type_description) FROM Ref_Document_Types WHERE document_type_description = "u" AND document_type_code != "Paper"


Question: Which driver IDs are equal to 9 in the driver table, and which driver IDs are less than 10 in the school bus table?

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


Question: What are the club IDs, excluding club ID 2, and also including club IDs from members who are in clubs with ID 4 or higher and are not CTOs?

SELECT ClubID FROM Club WHERE "ClubID" != 2 UNION ALL SELECT ClubID FROM Member_of_club WHERE "ClubID" >= 4 AND Position <> "CTO"


Question: What are the driver IDs that are 6 or greater, but not 7 or greater, based on the driver and school bus information?

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


Question: What are the album IDs less than 224 or not titled "Live [Disc 2]", and what are the genre IDs where the name isn't "Latin" or the ID isn't 3?

SELECT id FROM albums WHERE "id" < 224 OR title != "Live [Disc 2]" UNION SELECT id FROM genres WHERE name <> "Latin" OR "id" != 3


Question: What is the sum of all 'aid' values from the 'certificate' table where the 'eid' is 269734834 or 'aid' is less than or equal to 3, excluding the sum of 'aid' values from the 'flight' table where 'aid' is less than 9, the price is not 425.98, the destination is Los Angeles, the departure date is 04/12/2005 09:30, and the flight number is less than 99?

SELECT SUM(aid) FROM certificate WHERE "eid" = 269734834 OR "aid" <= 3 EXCEPT SELECT SUM(aid) FROM flight WHERE "aid" < 9 AND "price" != 425.98 AND destination = "Los Angeles" AND departure_date = "04/12/2005 09:30" AND "flno" < 99


Question: What is the highest property type code from the Properties table where apt_feature_3 isn't "None", or oth_feature_1 is "None", or date_on_market is "2016-05-06 16:53:39", or fld_feature_1 isn't "None" and shp_feature_2 isn't "None" and property_name isn't "chelsea", and also the highest property type code from the Ref_Property_Types table where the code is "Shop"?

SELECT MAX(property_type_code) FROM Properties WHERE apt_feature_3 != "None" OR oth_feature_1 = "None" OR date_on_market = "2016-05-06 16:53:39" OR fld_feature_1 <> "None" AND shp_feature_2 != "None" AND property_name != "chelsea" UNION ALL SELECT MAX(property_type_code) FROM Ref_Property_Types WHERE property_type_code = "Shop"


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 are not equal to 10, but are not found in the school bus table with driver IDs greater 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: What are the driver IDs that are either greater than or equal to 7 in the driver table, or equal to 9 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 = 9


Question: What is the sum of the IDs from the airport table where the city is not Anchorage and the ICAO code is LEBL, combined with the sum of the IDs from the flight table where the pilot is not Thompson and the company ID is not 5 or the airport ID is 2 or the velocity is greater than 240 or the date is not May 19, 1964 or the altitude is greater than 3650 or the ID is not 12?

SELECT SUM(id) FROM airport WHERE City <> "Anchorage" AND ICAO = "LEBL" UNION ALL SELECT SUM(id) FROM flight WHERE Pilot <> "Thompson" AND "company_id" <> 5 OR "airport_id" = 2 OR "Velocity" > 240.0 OR Date != "May 19, 1964" OR "Altitude" > 3650.0 OR "id" <> 12


Question: What are the aircraft IDs that are not 5, but are not present in the airport_aircraft table with an ID other than 1?

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


Question: What are the names of aircraft that are not aircraft ID 5 and have a distance of 6900 or less, and are not a Boeing 727, combined with the names of employees where the employee ID is 159542516 and the name is Angela Martinez, or whose salary is not 289950?

SELECT name FROM aircraft WHERE "aid" != 5 AND "distance" <= 6900 AND name != "Boeing 727" UNION ALL SELECT name FROM employee WHERE "eid" = 159542516 AND name = "Angela Martinez" OR "salary" != 289950


Question: Which driver IDs are not equal to 9 but are not present in the school bus table where the driver ID is greater than 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 2, and also the driver IDs from school buses that are less than 4?

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


Question: What are the driver IDs, excluding driver ID 8, that are present in both the driver and school bus tables, but with school bus driver IDs limited to those less than or equal to 3?

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


Question: What is the maximum branch name, excluding any branch where the membership amount is not "11" and the address road is not "Abbey Rise", or the branch ID is 7 and the city is London, or the open year is not "2013", but also excluding any member where the card number is "MLB4" or the name is "Micah Johnson" or the member ID is greater than 9 and the hometown is not "Red Jacket, West Virginia"?

SELECT MAX(Name) FROM branch WHERE membership_amount <> "11" AND Address_road != "Abbey Rise" OR "Branch_ID" = 7 AND City = "London" OR Open_year != "2013" EXCEPT SELECT MAX(Name) FROM member WHERE Card_Number = "MLB4" OR Name = "Micah Johnson" OR "Member_ID" > 9 AND Hometown != "Red Jacket, West Virginia"


Question: What is the average club name and the maximum club ID for clubs that are not "Gefle IF" or have a club ID less than 1 and are not in the UK, combined with the average club name and maximum club ID for clubs not in Russia, started before 2001, and are not "Djurgårdens IF"?

SELECT AVG(Club_name), MAX(Club_ID) FROM club WHERE Club_name <> "Gefle IF" OR "Club_ID" < 1 AND Region <> "UK" UNION SELECT AVG(Club_name), MAX(Club_ID) FROM club WHERE Region <> "Russia" AND "Start_year" < 2001 AND Club_name <> "Djurgårdens IF"


Question: How many aircraft have a distance less than 2128 or are named "Airbus A319", and what are the corresponding employee IDs?

SELECT COUNT(T1.distance), T2.eid FROM aircraft as T1 JOIN certificate as T2 ON T1.aid = T2.aid WHERE "distance" < 2128 OR name = "Airbus A319"


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

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


Question: Which driver IDs are less than 9 but not present in the school bus table with 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 greater than 10, or are driver IDs from school buses that are not 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 driver IDs that are present in both the driver and school bus tables, excluding driver ID 4 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 <> 4 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID >= 3


Question: What are the IDs of pets belonging to students with IDs less than or equal to 1001, combined with the IDs of cats that weigh 12.0, are younger than 2, and have pet IDs greater than 2002?

SELECT PetID FROM Has_Pet WHERE "StuID" <= 1001 UNION SELECT PetID FROM Pets WHERE "PetID" > 2002 AND "weight" = 12.0 AND PetType = "cat" AND "pet_age" < 2


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

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


Question: Which driver IDs are less than 2, but not driver IDs that are 10 or greater, considering only the driver and school bus information?

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


Question: What are the type, area size, and number of product categories for stores that meet the following criteria: they are not "City Mall", have a store ID less than or equal to 3, a ranking less than 2, an area size not equal to 28.74, and a number of product categories not equal to 1678, or are named "Doaktown"; and also meet these criteria: have a number of product categories equal to 1678, or are not "Village Store", or have a store ID greater than or equal to 4, or are not named "Doaktown" and have an area size less than or equal to 26.69 and a ranking not equal to 10?

SELECT Type, Area_size, Number_of_product_category FROM store WHERE Type != "City Mall" AND "Store_ID" <= 3 AND "Ranking" < 2 AND "Area_size" <> 28.74 AND "Number_of_product_category" <> 1678.0 OR Store_Name = "Doaktown" INTERSECT SELECT Type, Area_size, Number_of_product_category FROM store WHERE "Number_of_product_category" = 1678.0 OR Type <> "Village Store" OR "Store_ID" >= 4 OR Store_Name <> "Doaktown" AND "Area_size" <= 26.69 AND "Ranking" != 10


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

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


Question: What is the sum of all continents except "america", excluding the sum of continents where the continent value is 2?

SELECT SUM(Continent) FROM continents WHERE Continent <> "america" EXCEPT SELECT SUM(Continent) FROM countries WHERE "Continent" = 2


Question: What car models are not "chevrolet" or have a "MakeId" other than 263 or are "dodge d200", and also have a "Maker" other than 16 or a "ModelId" other than 29?

SELECT Model FROM car_names WHERE Model != "chevrolet" OR "MakeId" <> 263 OR Make = "dodge d200" INTERSECT SELECT Model FROM model_list WHERE "Maker" <> 16 OR "ModelId" <> 29


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


Question: What are the driver IDs that are not 6 and also appear in the school bus table with a driver ID of 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 is the average title for items that are not "comb" or have an i_id not equal to 1, and also the average title for items with an i_id greater than 5?

SELECT AVG(title) FROM item WHERE title <> "comb" OR "i_id" != 1 INTERSECT SELECT AVG(title) FROM item WHERE "i_id" > 5


Question: What are the nationalities of people who are not from the United States and are not 25 years old or graduated from Iowa, combined with the nationalities of people whose name is not Tim Naegeli or whose People ID is not 2 and are not from the United States and are 37 years old?

SELECT Nationality FROM people WHERE Nationality != "United States" AND "Age" != 25 OR Graduation_College = "Iowa" UNION SELECT Nationality FROM people WHERE Name <> "Tim Naegeli" OR "People_ID" != 2 AND Nationality <> "United States" AND "Age" = 37


Question: What are the IDs of drivers who have an ID greater than 1, combined with the IDs of school buses that don't have an ID of 10?

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


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

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


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

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


Question: What are the staff IDs from lessons that weren't priced at 306.0, were on March 12, 2018, at 00:41:59, and weren't cancelled, or had a lesson time of 9, or had a vehicle ID greater than 2 and a customer ID not equal to 8? Also, what are the staff IDs from the staff table where the staff ID is greater than 15, and they didn't leave on March 4, 2018, at 17:13:53, or didn't join on June 6, 2016, at 08:54:28, and their date of birth isn't April 27, 1998, at 12:55:05, or their middle name isn't Liam, and their first name isn't Kaitlin, and their nickname isn't nicholaus92, and their last name isn't Hermann?

SELECT staff_id FROM Lessons WHERE "price" != 306.0 AND lesson_date = "2018-03-12 00:41:59" AND lesson_status_code <> "Cancelled" OR lesson_time = "9" OR "vehicle_id" > 2 AND "customer_id" <> 8 UNION SELECT staff_id FROM Staff WHERE "staff_id" > 15 AND date_left_staff != "2018-03-04 17:13:53" OR date_joined_staff != "2016-06-06 08:54:28" AND date_of_birth <> "1998-04-27 12:55:05" OR middle_name != "Liam" AND first_name <> "Kaitlin" AND nickname != "nicholaus92" AND last_name <> "Hermann"


Question: What are the aircraft IDs greater than 5, combined with the aircraft IDs from airport_aircraft that are less than or equal to 3?

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


Question: Which driver IDs are not from East Hartford, have an ID greater than 3, are 36 years old, are not named Douglas McCrory, or are affiliated with the Democratic party, but are not full-time school bus drivers?

SELECT Driver_ID FROM driver WHERE Home_city != "East Hartford" AND "Driver_ID" > 3 OR "Age" = 36 OR Name != "Douglas McCrory" OR Party = "Dem" EXCEPT SELECT Driver_ID FROM school_bus WHERE If_full_time = "T"


Question: What are the election details, including the election ID, party, district, delegate, counties represented, and committee, for elections where the delegate is not Guzzone, Guy Guy Guzzone and the election ID is 5 or greater, combined with the election details for elections where the election ID is less than 7 and the delegate is not DeBoy, Steven J. Sr. and the committee is not Ways and Means, or the counties represented is not 13, or the first elected year is before 1994?

Election_ID Party District Delegate Counties_Represented Committee

DeBoy, Steven J. Sr. Steven J. DeBoy, Sr.

Malone, James E. Jr. James E. Malone, Jr.

SELECT Election_ID, Party, District, Delegate, Counties_Represented, Committee FROM election WHERE Delegate != "Guzzone, Guy Guy Guzzone" AND "Election_ID" >= 5 AND "District" > 1 UNION ALL SELECT Election_ID, Party, District, Delegate, Counties_Represented, Committee FROM election WHERE "Election_ID" < 7 AND Delegate != "DeBoy, Steven J. Sr. Steven J. DeBoy, Sr." AND Committee != "Ways and Means" OR Counties_Represented != "13" OR "First_Elected" < 1994.0


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

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


Question: What are the aircraft IDs that are equal to 2 in the aircraft table, but not 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 = 2 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID <= 1