Question: What are the minimum other details, average receipt number, sum of document type codes, and receipt date for documents that are not "working" or not "CD", excluding those where the document status is not "done", or the other details are not "y" and the receipt date is not "1973-11-05 21:48:53", the shipping agent code is not "UP", the receipt number is not "114", and the document ID is at least 23?

SELECT MIN(other_details), shipping_agent_code, AVG(receipt_number), SUM(document_type_code), receipt_date FROM Documents WHERE document_status_code <> "working" OR document_type_code <> "CD" EXCEPT SELECT MIN(other_details), shipping_agent_code, AVG(receipt_number), SUM(document_type_code), receipt_date FROM Documents WHERE document_status_code != "done" OR other_details != "y" AND receipt_date <> "1973-11-05 21:48:53" AND shipping_agent_code <> "UP" AND receipt_number <> "114" AND "document_id" >= 23


Question: Which driver IDs are not 12 and are in the driver table but not in the school bus table, where the school bus driver IDs are 3 or less?

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


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

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


Question: What are the IDs of airports that are not in Norway or are named "National Airport", and also the IDs of operating companies that are not incorporated in Hong Kong or are a subsidiary and don't provide catering services?

SELECT id FROM airport WHERE Country != "Norway" OR name = "National Airport" INTERSECT SELECT id FROM operate_company WHERE Incorporated_in <> "Hong Kong" OR Type = "Subsidiary" AND Principal_activities <> "Catering services"


Question: What are the driver IDs that are 6 or greater, but not driver IDs less than 4?

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


Question: What are the largest document IDs from the Circulation History table where the copy number is no more than 4, the employee ID is greater than 1, and the draft number is less than 17, combined with the largest document IDs where the document ID is not 2, the draft number is not 20, the employee ID is not 2, and the copy number is 15?

SELECT MAX(document_id) FROM Circulation_History WHERE "copy_number" <= 4 AND "employee_id" > 1 AND "draft_number" < 17 UNION SELECT MAX(document_id) FROM Circulation_History WHERE "document_id" != 2 AND "draft_number" <> 20 AND "employee_id" <> 2 AND "copy_number" = 15


Question: Which driver IDs are less than or equal to 11 but not present in the school bus table with driver IDs less than 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: Which driver IDs are in the driver table but not in the school bus table, excluding driver ID 12 from the driver table and driver ID 4 from the school bus table?

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


Question: What are the driver IDs that are either less than or equal to 12 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 <= 12 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 7 from the driver table, combined with the driver IDs that are less than or equal to 3 from the school bus table?

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


Question: Which driver IDs are less than or equal to 8, and which driver ID is 10, 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 = 10


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

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


Question: Which driver IDs are present in both the driver table (excluding ID 10) and the school bus table (with IDs less than 7)?

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


Question: What driver IDs are present in both the driver table (excluding driver ID 12) and the school bus table (with 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: What are the driver IDs that are less than 4, excluding those that are not equal to 9?

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


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


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

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


Question: What is the sum of area codes and the corresponding phone numbers, excluding votes created on "2018-03-09 19:03:21", grouped by the creation date, where the vote ID is no more than 5 and the contestant number is at least 3?

SELECT SUM(T1.area_code), T2.phone_number FROM AREA_CODE_STATE as T1 JOIN VOTES as T2 ON T1.state = T2.state WHERE created <> "2018-03-09 19:03:21" GROUP BY created HAVING vote_id <= 5 AND contestant_number >= 3


Question: What are the aircraft IDs that are greater than 2 and also present in the airport aircraft table, excluding aircraft ID 5?

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


Question: What are the driver IDs that are either less than or equal to 2, or not equal to 10?

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


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

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


Question: What are the sales in billions and people IDs for companies, grouped by assets in billions, where the assets are less than or equal to 2039.1, or the headquarters is in the USA, or profits are over 11.1 billion, or the year worked is less than 1, or the company is Wells Fargo and the industry is Banking, or the market value is 107.5 billion and sales are less than or equal to 143.7 billion?

SELECT T1.Sales_in_Billion, T2.People_ID FROM company as T1 JOIN employment as T2 ON T1.Company_ID == T2.Company_ID GROUP BY Assets_in_Billion HAVING Assets_in_Billion <= 2039.1 OR Headquarters = "USA" OR Profits_in_Billion > 11.1 OR Year_working < 1 OR Name = "Wells Fargo" AND Industry = "Banking" OR Market_Value_in_Billion = 107.5 AND Sales_in_Billion <= 143.7


Question: What are the descriptions of the aircraft and the corresponding airport IDs?

SELECT T1.Description, T2.Airport_ID FROM aircraft as T1 JOIN airport_aircraft as T2 ON T1.Aircraft_ID = T2.Aircraft_ID


Question: What are the aircraft IDs that are equal to 3 in the aircraft table but not equal to 3 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 != 3


Question: Which employee IDs are associated with George Chuter, are under 30 years old, or have an ID of 5, and also include all employee IDs from the hiring table except for employee ID 6?

SELECT Employee_ID FROM employee WHERE Name = "George Chuter" OR "Age" < 30 OR "Employee_ID" = 5 UNION ALL SELECT Employee_ID FROM hiring WHERE "Employee_ID" <> 6


Question: What are the driver IDs that are not 5 and are present in the driver table but not in the school bus table, where the school bus driver IDs are 4 or greater?

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


Question: Which driver IDs are either 10 or less than 3, considering both drivers and school buses?

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 driver IDs that are equal to 6, excluding those driver IDs greater than 3 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 > 3


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

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


Question: What are the aircraft IDs that are equal to 2 in the aircraft table, but not aircraft IDs less than 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 is the sum of employee IDs from the circulation history where the copy number is at least 10, the document ID is not 10, and the draft number is 2, combined with the sum of employee IDs from the Employees table where the role code is MG, the other details are not v, or the employee name is Haley, or the employee ID is greater than 5?

SELECT SUM(employee_id) FROM Circulation_History WHERE "copy_number" >= 10 AND "document_id" <> 10 AND "draft_number" = 2 UNION ALL SELECT SUM(employee_id) FROM Employees WHERE role_code = "MG" AND other_details != "v" OR employee_name = "Haley" OR "employee_id" > 5


Question: What is the maximum disk loading, the count of maximum gross weights, and the minimum aircraft ID for aircraft where the disk loading is not "15 lb/ft² (72 kg/m²)" or the maximum gross weight is "1,370 lb (635 kg)" and the aircraft ID is greater than 5, combined with the results for aircraft where the aircraft ID is less than or equal to 2, or the aircraft is a "Robinson R-22", or the maximum gross weight is "73,500 lb (33,300 kg)" and the total disk area is "497 ft² (46.2 m²)"?

SELECT MAX(Max_disk_Loading), COUNT(Max_Gross_Weight), MIN(Aircraft_ID) FROM aircraft WHERE Max_disk_Loading <> "15 lb/ft² (72 kg/m²)" OR Max_Gross_Weight = "1,370 lb (635 kg)" AND "Aircraft_ID" > 5 UNION SELECT MAX(Max_disk_Loading), COUNT(Max_Gross_Weight), MIN(Aircraft_ID) FROM aircraft WHERE "Aircraft_ID" <= 2 OR Aircraft = "Robinson R-22" OR Max_Gross_Weight = "73,500 lb (33,300 kg)" AND Total_disk_area = "497 ft² (46.2 m²)"


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

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


Question: What are the flight details, including flight number, company ID, airport ID, date, ID, velocity, and pilot, for flights that meet any of the following criteria: the date is not October 25, 1963, and the altitude is 3650.0; or the ID is less than or equal to 5 and the velocity is less than or equal to 240.0; or the flight number is M2-F1 #1 and the company ID is greater than or equal to 5; or the altitude is less than or equal to 3650.0; or the airport ID is 9; or the flight number is not M2-F1 #0 and the velocity is greater than or equal to 240.0; or the ID is 12 and the pilot is not Thompson; or the company ID is not 6; or the date is not March 30, 1964?

SELECT Vehicle_Flight_number, company_id, airport_id, Date, id, Velocity, Pilot FROM flight WHERE Date <> "October 25, 1963" AND "Altitude" = 3650.0 OR "id" <= 5 AND "Velocity" <= 240.0 OR Vehicle_Flight_number = "M2-F1 #1" AND "company_id" >= 5 UNION SELECT Vehicle_Flight_number, company_id, airport_id, Date, id, Velocity, Pilot FROM flight WHERE "Altitude" <= 3650.0 OR "airport_id" = 9 OR Vehicle_Flight_number != "M2-F1 #0" AND "Velocity" >= 240.0 OR "id" = 12 AND Pilot <> "Thompson" OR "company_id" != 6 OR Date != "March 30, 1964"


Question: How many flights occurred on May 19, 1964 with flight number M2-F1 #33, or where the airport ID is greater than 6, or the flight ID is not 1, or the altitude is less than 3650.0, the company ID is less than 4, the velocity is not 240.0, and the pilot is not Thompson? Also, how many operate companies have an ID of 6 and a group equity shareholding of 60.0, or principal activities of Laundry, or are not incorporated in Taiwan?

SELECT COUNT(id) FROM flight WHERE Date = "May 19, 1964" AND Vehicle_Flight_number = "M2-F1 #33" OR "airport_id" > 6 OR "id" != 1 OR "Altitude" < 3650.0 AND "company_id" < 4 AND "Velocity" <> 240.0 AND Pilot != "Thompson" UNION ALL SELECT COUNT(id) FROM operate_company WHERE "id" = 6 AND "Group_Equity_Shareholding" = 60.0 OR Principal_activities = "Laundry" OR Incorporated_in != "Taiwan"


Question: What are the driver IDs, excluding driver ID 9, and also driver ID 3?

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 driver IDs that are either 5 or 9, considering driver IDs from both the driver and school bus tables?

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 user IDs, article IDs, ranks, and item IDs from the reviews where the item ID is 1, combined with the user IDs, article IDs, ranks, and item IDs from the reviews where the item ID is not 1 or the rank is not 1 and the user ID is greater than 2?

SELECT u_id, a_id, rank, i_id FROM review WHERE "i_id" = 1 UNION SELECT u_id, a_id, rank, i_id FROM review WHERE "i_id" <> 1 OR "rank" != 1 AND "u_id" > 2


Question: What are the aircraft IDs that are both less than or equal to 5 and present in both the aircraft and airport aircraft tables?

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


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

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


Question: What are the driver IDs greater than 9, and also the driver IDs less than or equal to 7, from the driver and school bus records?

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 pet and student IDs where the student ID is less than or equal to 1002 or the pet ID is 2003, combined with the pet and student IDs where the student ID is not 1001 or the pet ID is not 2003, from the pet ownership records?

SELECT PetID, StuID FROM Has_Pet WHERE "StuID" <= 1002 OR "PetID" = 2003 UNION ALL SELECT PetID, StuID FROM Has_Pet WHERE "StuID" != 1001 OR "PetID" != 2003


Question: Which contestant numbers are less than 3 and also appear in votes from New York that were not created at a specific time, where the contestant number is also less than 3?

SELECT contestant_number FROM CONTESTANTS WHERE "contestant_number" < 3 INTERSECT SELECT contestant_number FROM VOTES WHERE "contestant_number" < 3 AND created != "2018-03-09 19:03:36" AND state = "NY"


Question: What are the document IDs from the circulation history where the draft number is at least 17, or the copy number is 5 and the document ID is not 2, or the employee ID is less than or equal to 8? Also, what are the document IDs from the documents mailed table where the mailing address ID isn't 3, the document ID is 7, and the mailing date is January 14, 1982 at 5:50:54 AM? Combine both sets of document IDs.

SELECT document_id FROM Circulation_History WHERE "draft_number" >= 17 OR "copy_number" = 5 AND "document_id" != 2 OR "employee_id" <= 8 UNION ALL SELECT document_id FROM Documents_Mailed WHERE "mailed_to_address_id" != 3 AND "document_id" = 7 AND mailing_date = "1982-01-14 05:50:54"


Question: What are the aircraft IDs that are greater than or equal to 1, but not equal to 2, based on the aircraft table and excluding those found in the airport_aircraft table?

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


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


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

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


Question: What are the aircraft IDs, excluding aircraft ID 1, and also the aircraft IDs that are less than or equal to 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: Which driver IDs are not 9, and which driver IDs are 7, considering both drivers and school buses?

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


Question: What are the document IDs that are mailed and have an ID of 10 or less, but are not draft copies with a draft number less than 8?

SELECT document_id FROM Documents_Mailed WHERE "document_id" <= 10 EXCEPT SELECT document_id FROM Draft_Copies WHERE "draft_number" < 8


Question: Which driver IDs are equal to 4, or greater than 3?

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


Question: Which driver IDs are present in both the driver table (with IDs 4 or greater) and the school bus table (with IDs greater than 9)?

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


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

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


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

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


Question: What are the driver IDs that are 7 or greater, but not driver IDs less than 10 from the school bus table?

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


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 10 INTERSECT 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, where the driver ID is at least 8 in the driver table and at least 10 in the school bus table?

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


Question: Which driver IDs are not equal to 1, and which driver IDs are equal to 10, considering both drivers and school buses?

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


Question: What are the other details and document IDs for paragraphs with IDs less than or equal to 7, and also for paragraphs that don't have document ID 16514113 and don't have paragraph ID 608931827?

SELECT Other_Details, Document_ID FROM Paragraphs WHERE "Paragraph_ID" <= 7 UNION ALL SELECT Other_Details, Document_ID FROM Paragraphs WHERE "Document_ID" != 16514113 AND "Paragraph_ID" != 608931827


Question: What is the maximum gender of coaches who are not male, have Coach ID 4 and Club ID 1, or whose name is James Wong and rank is less than 4? Also, what is the maximum gender of players with Player ID greater than 13, or with votes greater than or equal to 12285, and who are not named Judy Wasylycia-Leis and are parliamentarians?

SELECT MAX(Gender) FROM coach WHERE Gender <> "M" AND "Coach_ID" = 4 AND "Club_ID" = 1 OR Coach_name = "James Wong" AND "Rank" < 4 UNION ALL SELECT MAX(Gender) FROM player WHERE "Player_ID" > 13 OR "Votes" >= 12285 AND Player_name != "Judy Wasylycia-Leis" AND Occupation = "Parliamentarian"


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

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


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

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


Question: What are the IDs of drivers who are either 35 or younger, or not driver ID 1, and also drive a school bus for school ID 1?

SELECT Driver_ID FROM driver WHERE "Age" <= 35 OR "Driver_ID" != 1 INTERSECT SELECT Driver_ID FROM school_bus WHERE "School_ID" = 1


Question: Which driver IDs, excluding driver ID 10, are found in the driver table, and which driver IDs, starting from 3, are found 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: What are the aircraft IDs that are both aircraft ID 3 and not aircraft ID 2?

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


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

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


Question: What are the aircraft names and corresponding airport aircraft IDs?

SELECT T1.Aircraft, T2.ID FROM aircraft as T1 JOIN airport_aircraft as T2 ON T1.Aircraft_ID = T2.Aircraft_ID


Question: What are the aircraft IDs, excluding aircraft ID 2, from the aircraft table, and also aircraft IDs greater than 2 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 > 2


Question: What are the names of branches called "Alexandre" and the names of members who don't have the card number "SLB51"?

SELECT Name FROM branch WHERE Name = "Alexandre" UNION ALL SELECT Name FROM member WHERE Card_Number <> "SLB51"


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

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


Question: What are the aircraft IDs that are less than 1, and also the aircraft ID 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 states, excluding Illinois, from the area code data, combined with the states from the votes data where the creation time isn't "2018-03-09 19:03:36" or the vote ID isn't 1 and the phone number is 6209222712 or the contestant number is less than 3 or the state isn't New York?

SELECT state FROM AREA_CODE_STATE WHERE state != "IL" AND "area_code" <> 563 UNION ALL SELECT state FROM VOTES WHERE created != "2018-03-09 19:03:36" OR "vote_id" <> 1 AND "phone_number" = 6209222712 OR "contestant_number" < 3 OR state != "NY"


Question: How many companies have a market value less than or equal to 213.7 billion, or are named "Industrial and Commercial Bank of China", or have profits not equal to 20.1 billion, or are in an industry other than "Conglomerate" and have assets of 1563.9 billion and an average year working less than or equal to 1, or have a people ID greater than 3, or have sales of 447.0 billion, or have headquarters not in "China", and for each of these conditions, what are the corresponding people IDs?

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 OR Industry <> "Conglomerate" AND Assets_in_Billion = 1563.9 AND AVG(Year_working) <= 1 OR People_ID > 3 OR COUNT(Sales_in_Billion) = 447.0 OR Headquarters <> "China"


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


Question: What are the driver IDs that are both greater than 7 in the school bus table and at least 10 in the driver table?

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


Question: Which driver IDs are greater than 9, combined with the driver IDs from school buses that are 9 or less?

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


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

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


Question: What are the IDs of employees who are not named Erling and do not have the role code PR?

SELECT employee_id FROM Employees WHERE employee_name <> "Erling" INTERSECT SELECT employee_id FROM Employees WHERE role_code <> "PR"


Question: How many employees are not named Steve Borthwick, or don't live in Bristol, or have an employee ID greater than or equal to 1? Also, how many evaluations have a bonus less than or equal to 3200, and don't belong to employee ID 1, or weren't awarded in 2016?

SELECT COUNT(Employee_ID) FROM employee WHERE Name <> "Steve Borthwick" OR City != "Bristol" OR "Employee_ID" >= 1 UNION ALL SELECT COUNT(Employee_ID) FROM evaluation WHERE "Bonus" <= 3200.0 AND Employee_ID != "1" OR Year_awarded != "2016"


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

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


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

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


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

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


Question: What are the school IDs of schools that meet at least one of these criteria: not located in "46 LaPorte 71 St. Joseph", are in IHSAA Class "AA", or are not in IHSAA Football Class "AAA", or are not in "Bourbon", and are not named "Glenn", and have ID "1", and have enrollment not equal to 605, excluding any school IDs where the school ID is less than or equal to 3 or the endowment ID is greater than 6?

SELECT School_id FROM School WHERE County != "46 LaPorte 71 St. Joseph" OR IHSAA_Class = "AA" OR IHSAA_Football_Class <> "AAA" OR Location != "Bourbon" AND School_name != "Glenn" AND School_id = "1" AND "Enrollment" <> 605 EXCEPT SELECT School_id FROM endowment WHERE "School_id" <= 3 OR "endowment_id" > 6


Question: What are the aircraft IDs that are not 4 and also have an ID of 5 or greater, considering aircraft and airport information?

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: How many documents don't have a description of "y", or have a document ID greater than 16514113, or don't have the name "How Google people work" and have other details as "None", minus the number of templates where the effective date isn't "1979-10-20 21:23:20", or the version number is greater than 0 and the template details aren't empty, or the effective end date isn't "1973-01-12 14:13:34"?

SELECT COUNT(Template_ID) FROM Documents WHERE Document_Description != "y" OR "Document_ID" > 16514113 OR Document_Name != "How Google people work" AND Other_Details = "None" EXCEPT SELECT COUNT(Template_ID) FROM Templates WHERE Date_Effective_From <> "1979-10-20 21:23:20" OR "Version_Number" > 0 AND Template_Details <> "" OR Date_Effective_To != "1973-01-12 14:13:34"


Question: Which driver IDs are less than 3, and which driver ID is 10, 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 = 10


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

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


Question: What are the IDs of albums that don't belong to artist 262, combined with the IDs of media types that aren't "Protected AAC audio file"?

SELECT id FROM albums WHERE "artist_id" != 262 UNION SELECT id FROM media_types WHERE name != "Protected AAC audio file"


Question: What are the lesson status codes, dates, and staff IDs for lessons where the vehicle ID is not 3, the staff ID is greater than 11, and the price is less than or equal to 277, or the lesson date is not "2018-03-08 16:05:05", or the lesson status is not "Cancelled" and the customer ID is 8? Also, what are the lesson status codes, dates, and staff IDs for lessons where the lesson date is not "2018-03-08 16:05:05" and the lesson ID is not 9, or the lesson status is not "Cancelled"?

SELECT lesson_status_code, lesson_date, staff_id FROM Lessons WHERE "vehicle_id" != 3 AND "staff_id" > 11 AND "price" <= 277.0 OR lesson_date <> "2018-03-08 16:05:05" OR lesson_status_code <> "Cancelled" AND "customer_id" = 8 UNION SELECT lesson_status_code, lesson_date, staff_id FROM Lessons WHERE lesson_date != "2018-03-08 16:05:05" AND "lesson_id" <> 9 OR lesson_status_code != "Cancelled"


Question: Which driver IDs are not equal to 1 but are not also driver ID 3 in the school bus table?

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


Question: Which branch IDs and member IDs are in the membership register but not in the purchase records, where the member ID is at least 6 and the branch ID isn't 8, and also where the branch ID isn't 6 or the member ID is less than 3?

SELECT Branch_ID, Member_ID FROM membership_register_branch WHERE "Member_ID" >= 6 AND Branch_ID != "8" EXCEPT SELECT Branch_ID, Member_ID FROM purchase WHERE Branch_ID != "6" OR "Member_ID" < 3


Question: What are the descriptions of document types that are not "CD"?

SELECT document_type_description FROM Ref_Document_Types WHERE document_type_code != "CD" INTERSECT SELECT document_type_description FROM Ref_Document_Types WHERE document_type_code <> "CD"


Question: Give me the city code, first name, last name, sex, advisor, student ID, major, and age for students who meet at least one of the following conditions: their student ID is 1014, their age is not 18, their first name is not Mark, or their last name is not Apap. Also, give me the same information for students who meet at least one of these conditions: their major is less than or equal to 100 and their first name is not Eric and their city code is not SFO, or their sex is not M and their last name is not Simms, or their age is greater than 22, or their advisor is greater than or equal to 1148, or their student ID is greater than or equal to 1003. Only include students who satisfy both sets of conditions.

city_code Fname LName Sex Advisor StuID Major Age

SELECT city_code, Fname, LName, Sex, Advisor, StuID, Major, Age FROM Student WHERE "StuID" = 1014 OR "Age" <> 18 OR Fname != "Mark" OR LName != "Apap" INTERSECT SELECT city_code, Fname, LName, Sex, Advisor, StuID, Major, Age FROM Student WHERE "Major" <= 100 AND Fname <> "Eric" AND city_code != "SFO" OR Sex != "M" AND LName != "Simms" OR "Age" > 22 OR "Advisor" >= 1148 OR "StuID" >= 1003


Question: Which driver IDs are less than 3, or any driver IDs from school buses that are 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: What are the driver IDs that are greater than or equal to 3 and also not equal to 9, 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 >= 3 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 9


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

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


Question: What are the date, total velocity, minimum airport ID, maximum company ID, pilot, total altitude, average vehicle flight number, and minimum ID for flights, excluding those where the pilot is Thompson or the vehicle flight number is not M2-F1 #6 and the airport ID is less than 9, but including flights where the pilot is not Peterson and the vehicle flight number is not M2-F1 #61 and the ID is less than 10 or the velocity is less than 240.0 and the date is not October 25, 1963 or the airport ID is not 9?

SELECT Date, SUM(Velocity), MIN(airport_id), MAX(company_id), Pilot, SUM(Altitude), AVG(Vehicle_Flight_number), MIN(id) FROM flight WHERE Pilot <> "Thompson" OR Vehicle_Flight_number != "M2-F1 #6" AND "airport_id" < 9 EXCEPT SELECT Date, SUM(Velocity), MIN(airport_id), MAX(company_id), Pilot, SUM(Altitude), AVG(Vehicle_Flight_number), MIN(id) FROM flight WHERE Pilot != "Peterson" AND Vehicle_Flight_number != "M2-F1 #61" AND "id" >= 10 OR "Velocity" >= 240.0 AND Date != "October 25, 1963" OR "airport_id" = 9


Question: What are the aircraft IDs that are less than 5, and also the aircraft IDs less than 3, considering both the aircraft and airport_aircraft tables?

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


Question: What are the employee IDs that received an award in a year other than 2018, but did not start working in 2011?

SELECT Employee_ID FROM evaluation WHERE Year_awarded != "2018" EXCEPT SELECT Employee_ID FROM hiring WHERE Start_from != "2011"


Question: Which driver IDs, excluding driver ID 6, are in the driver table, and which driver IDs greater than 3 are in the school bus table?

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


Question: What are the email addresses, customer IDs, outstanding amounts, and dates of birth, along with the sum of cell phone numbers, for customers who meet any of the following criteria: their cell phone number is not "1-197-686-2849x8761" or their date of birth is not "1998-12-15 13:24:40" and their customer address ID is greater than 13 or their customer status is "Good Customer" and their outstanding amount is less than 5494.0 or their first name is not "Estelle" or their customer ID is less than 4; or who meet any of these other criteria: their date of becoming a customer is not "2017-11-25 01:42:26" and their customer status is not "Bad Customer" or their first name is not "Ray" or their email address is not "asha.kilback@example.org" and their phone number is not "753.921.0871" or their customer ID is not 12 and their customer address ID is greater than 8 and their date of birth is not "1993-03-08 08:48:42" and their last name is not "Tromp" or their outstanding amount is not 9500.0 or their cell phone number is "861-638-9797"?

SELECT email_address, customer_id, amount_outstanding, date_of_birth, SUM(cell_mobile_phone_number) FROM Customers WHERE cell_mobile_phone_number <> "1-197-686-2849x8761" OR date_of_birth <> "1998-12-15 13:24:40" AND "customer_address_id" > 13 OR customer_status_code = "Good Customer" AND "amount_outstanding" < 5494.0 OR first_name <> "Estelle" OR "customer_id" < 4 UNION ALL SELECT email_address, customer_id, amount_outstanding, date_of_birth, SUM(cell_mobile_phone_number) FROM Customers WHERE date_became_customer <> "2017-11-25 01:42:26" AND customer_status_code <> "Bad Customer" OR first_name != "Ray" OR email_address <> "asha.kilback@example.org" AND phone_number != "753.921.0871" OR "customer_id" <> 12 AND "customer_address_id" > 8 AND date_of_birth != "1993-03-08 08:48:42" AND last_name != "Tromp" OR "amount_outstanding" <> 9500.0 OR cell_mobile_phone_number = "861-638-9797"


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

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


Question: What are the driver IDs that are greater than or equal to 4, and also the driver ID 9?

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: Which driver IDs are not equal to 7, but are not found in the school bus table with a driver ID of 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 positions, student IDs, and club IDs for members in club 2 who are not Vice-Presidents, and also for members whose student ID is 1001, or whose position is not President, or whose club ID is 1 or greater?

SELECT Position, StuID, ClubID FROM Member_of_club WHERE "ClubID" = 2 AND Position <> "Vice-President" UNION SELECT Position, StuID, ClubID FROM Member_of_club WHERE "StuID" = 1001 OR Position <> "President" OR "ClubID" >= 1


Question: Which coach IDs are associated with James Wong, excluding those with rank 4 or ID 1, or are linked to players with player IDs less than 2 or coach ID 5 and a starting year from 2012 onwards?

SELECT Coach_ID FROM coach WHERE "Rank" != 4 AND "Coach_ID" <> 1 AND Coach_name = "James Wong" OR "Club_ID" <> 1 UNION ALL SELECT Coach_ID FROM player_coach WHERE "Player_ID" < 2 OR "Coach_ID" = 5 AND "Starting_year" >= 2012


Question: What are the aircraft IDs that are less than 1, and what is the aircraft ID 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 not 5 and also have an ID greater than 1 in the airport aircraft table?

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


Question: What are the club IDs of clubs named "Helsingborgs IF" or located in "USA", combined with the club IDs from match results where "Gold" is not 6, or "Bronze" is at least 10 and "Big_Silver" is no more than 9 and "Small_Silver" is not 16 and the club ID is not 3 and points are 102 or the rank is at least 1?

SELECT Club_ID FROM club WHERE Club_name = "Helsingborgs IF" OR Region = "USA" UNION SELECT Club_ID FROM match_result WHERE "Gold" <> 6 OR "Bronze" >= 10 AND "Big_Silver" <= 9 AND "Small_Silver" <> 16 AND "Club_ID" != 3 AND "Points" = 102 OR "Rank" >= 1


Question: Which driver IDs are not equal to 3, but are not also driver IDs for school buses with driver ID 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 county IDs where the population is not 79000 or the zip code is D09 and the county ID is not 4, excluding any county IDs where the county ID is greater than 1 or the zip code is D09 and the county name is Colony?

SELECT County_Id FROM county WHERE "Population" != 79000.0 OR Zip_code = "D09" AND "County_Id" <> 4 EXCEPT SELECT County_Id FROM county WHERE "County_Id" > 1 OR Zip_code = "D09" AND County_name = "Colony"


Question: Which driver IDs are equal to 2 but not equal to 4 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 <> 4


Question: Which driver IDs are equal to 4 in the driver table but not equal to 4 in the school bus table?

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


Question: Which driver IDs are in the driver table but not in the school bus table, excluding driver ID 1 from the driver table and driver ID 9 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 != 9


Question: What are the populations of counties that have a population of at least 90,000, or a population greater than 21,000 and a county ID less than 5?

SELECT Population FROM county WHERE "Population" >= 90000.0 UNION SELECT Population FROM county WHERE "Population" > 21000.0 AND "County_Id" < 5


Question: Which driver IDs, excluding driver ID 1, are found in the driver table, and which driver IDs, excluding driver ID 10, are found in the school bus table?

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


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

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


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

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


Question: What are the aircraft IDs that are less than or equal to 5, excluding those aircraft IDs that are not equal to 1 in the airport aircraft table?

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


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

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


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

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


Question: Which driver IDs are less than 4, and also driver ID 7, from the driver and school bus tables?

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 either greater than or equal to 5 in the driver table, or are not equal to 4 in the school bus table?

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


Question: What are the IDs of pets belonging to student 1002, and also the IDs of pets that are 2 years old or younger?

SELECT PetID FROM Has_Pet WHERE "StuID" = 1002 UNION ALL SELECT PetID FROM Pets WHERE "pet_age" <= 2


Question: What are the driver IDs that are greater than or equal to 1 in the driver table, but not present 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 >= 1 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 3 or not equal to 7, considering both the driver and school bus information?

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


Question: What are the IDs of people who graduated from Iowa and are not named David Butler, or have an ID less than or equal to 2, or are 27 or older, but exclude the IDs of people who are not ID 4 and did not graduate from Virginia, or are not named Darryl Kennedy?

SELECT People_ID FROM people WHERE Graduation_College = "Iowa" AND Name <> "David Butler" OR "People_ID" <= 2 OR "Age" >= 27 EXCEPT SELECT People_ID FROM people WHERE "People_ID" <> 4 AND Graduation_College <> "Virginia" OR Name != "Darryl Kennedy"


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

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


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

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


Question: What are the sums of School IDs, the school names, sums of counties, IHSAA football classes, enrollments, IHSAA classes, and sums of locations for schools that either have a school ID of "5" and a mascot that isn't "Lancers", or are located in Bourbon and aren't in class "A", excluding schools not located in Walkerton?

SELECT SUM(School_id), School_name, SUM(County), IHSAA_Football_Class, Enrollment, IHSAA_Class, SUM(Location) FROM School WHERE Mascot <> "Lancers" AND School_id = "5" OR IHSAA_Class <> "A" AND Location = "Bourbon" EXCEPT SELECT SUM(School_id), School_name, SUM(County), IHSAA_Football_Class, Enrollment, IHSAA_Class, SUM(Location) FROM School WHERE Location <> "Walkerton"


Question: What are the employee IDs of employees who don't live in Bristol, combined with the employee IDs of those who weren't awarded in 2016?

SELECT Employee_ID FROM employee WHERE City != "Bristol" UNION ALL SELECT Employee_ID FROM evaluation WHERE Year_awarded != "2016"


Question: What are the driver IDs that are 7 or greater, excluding those driver IDs that are greater than 3 in the school bus table?

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


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 drivers and school buses?

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


Question: What is the highest Club ID from clubs outside of France, combined with the highest Club ID from match results where certain silver, gold, bronze, points, rank, or club ID conditions are met?

SELECT MAX(Club_ID) FROM club WHERE Region != "France" UNION SELECT MAX(Club_ID) FROM match_result WHERE "Big_Silver" > 7 OR "Small_Silver" <> 6 AND "Gold" < 12 OR "Bronze" < 8 AND "Points" >= 66 OR "Rank" > 6 OR "Club_ID" >= 3


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

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


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

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


Question: What are all the template type codes that are not "PPT" or have a description other than "CV", combined with the template type codes from templates where the effective dates are not the specified dates?

SELECT Template_Type_Code FROM Ref_Template_Types WHERE Template_Type_Code != "PPT" OR Template_Type_Description != "CV" UNION ALL SELECT Template_Type_Code FROM Templates WHERE Date_Effective_To <> "1975-07-16 04:52:10" OR Date_Effective_From != "1996-02-04 11:27:24"


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 is the maximum driver ID and years working for drivers, considering drivers not from Manchester, or with school ID 1, or older than 46 and with more than 8 years of experience, or belonging to the Dem party named Douglas McCrory, or full-time drivers? Group the results by home city, excluding those from Bethel, with more than 6 years of experience, and a count of ages not equal to 36, or not belonging to the Dem party, or not full-time, or named Tim Larson with a school ID greater than or equal to 1?

SELECT MAX(T1.Driver_ID), T2.Years_Working FROM driver as T1 JOIN school_bus as T2 ON T1.Driver_ID = T2.Driver_ID WHERE Home_city <> "Manchester" OR "School_ID" = 1 OR "Age" > 46 AND "Years_Working" > 8 OR Party = "Dem" AND Name = "Douglas McCrory" OR If_full_time = "T" GROUP BY Home_city HAVING Home_city <> "Bethel" AND Years_Working > 6 AND COUNT(Age) <> 36 OR Party <> "Dem" OR If_full_time <> "T" OR Name = "Tim Larson" AND School_ID >= 1


Question: What are the club IDs that are either from clubs with an ID of 2 or higher or have a description other than "Venture capital fund for student business.", combined with the club IDs from members of clubs with an ID greater than 4 or a position that is not "CTO"?

SELECT ClubID FROM Club WHERE "ClubID" >= 2 OR ClubDesc <> "Venture capital fund for student business." UNION ALL SELECT ClubID FROM Member_of_club WHERE "ClubID" > 4 OR Position <> "CTO"


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

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


Question: What are the player IDs and starting years for players where the starting year is after 2013 or the coach ID is less than 3 and the player ID is less than 6, and also for players where the player ID is greater than 3 and the starting year is after 2012 or the coach ID is not 1?

SELECT Player_ID, Starting_year FROM player_coach WHERE "Starting_year" > 2013 OR "Coach_ID" < 3 AND "Player_ID" < 6 INTERSECT SELECT Player_ID, Starting_year FROM player_coach WHERE "Player_ID" > 3 AND "Starting_year" > 2012 OR "Coach_ID" <> 1


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

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


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

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


Question: What is the sum of employee IDs and the bonus, excluding employees where the maximum age is not 28?

SELECT SUM(T1.Employee_ID), T2.Bonus FROM employee as T1 JOIN evaluation as T2 ON T1.Employee_ID = T2.Employee_ID WHERE MAX(Age) <> 28


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 10 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 5 and also appear in the airport aircraft table, excluding aircraft ID 3?

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


Question: What are the item IDs of items with ID 3, and also the item IDs of reviews with a rating greater than 7 or a user ID greater than 2?

SELECT i_id FROM item WHERE "i_id" = 3 UNION ALL SELECT i_id FROM review WHERE "rating" > 7 OR "u_id" > 2


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

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


Question: What are the aircraft IDs, excluding aircraft ID 5, and also the aircraft IDs 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: What are the aircraft IDs that are equal to 4, but not equal to 5, considering only aircraft IDs from the aircraft table and excluding those from the airport_aircraft table?

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


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

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


Question: What are the driver IDs greater than 12 from the driver table, combined with the driver IDs less 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: Which driver IDs are either less than or equal to 10 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 <= 10 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 9


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

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


Question: What are the sum of advisors, the count of first names, the age, major, last name, and the sum of student IDs for students named Jones where the advisor value is greater than 7792, the first name is not Lisa, and the age is 20 or older, or the sex is not male, or the student ID is less than 1029, excluding those students named Mark where the city code is not PIT, the advisor is 7723, and the age is 19, or the student ID is less than 1025, or the sex is female?

SUM(Advisor) COUNT(Fname) Age Major LName SUM(StuID)

SELECT SUM(Advisor), COUNT(Fname), Age, Major, LName, SUM(StuID) FROM Student WHERE LName = "Jones" AND "Advisor" > 7792 AND Fname <> "Lisa" AND "Age" >= 20 OR Sex != "M" OR "StuID" < 1029 EXCEPT SELECT SUM(Advisor), COUNT(Fname), Age, Major, LName, SUM(StuID) FROM Student WHERE Fname = "Mark" AND city_code != "PIT" AND "Advisor" = 7723 AND "Age" = 19 OR "StuID" < 1025 OR Sex = "F"


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

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


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

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


Question: Which driver IDs are either 5 or not 7, considering driver IDs from both the driver and school bus tables?

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


Question: What are the book IDs, titles, and issues for books written by Elaine Lee or those with issues not equal to 1.0, and also for books with a book ID less than or equal to 9, a title that isn't "BrainBanx", a writer other than Howard Chaykin, and more than 6 issues?

SELECT Book_ID, Title, Issues FROM book WHERE Writer = "Elaine Lee" OR "Issues" != 1.0 UNION ALL SELECT Book_ID, Title, Issues FROM book WHERE "Book_ID" <= 9 AND Title <> "BrainBanx" AND Writer <> "Howard Chaykin" AND "Issues" > 6.0


Question: What are the driver IDs that are not 6 and are also driver IDs of school buses with ID 9?

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


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

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


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


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

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 are the details for properties that meet a complex set of criteria, including specific dates, feature values, prices, and property types, and also share the same details as properties where 'apt_feature_2' is not 'eos'?

107 Roob Courts
Erdmanburgh, IA 42926-0873

60845 Else Highway Apt. 826
South Dougfort, CO 43200-4258

4745 Emerson Stravenue Suite 829
South Garret, IN 16772-5682

743 Ephraim Greens
Anniemouth, HI 47084-3853

062 Micaela Court Apt. 707
Margretville, WV 51628-3617

986 Hagenes Drives
Draketon, UT 83411-3393

098 Tremaine Highway Suite 569
South Wilford, NJ 46587-3537

6837 Darien Views Apt. 475
South Maraview, KS 77770

084 Lakin Vista Apt. 394
Fishertown, MA 16876

2088 Bashirian Fork Suite 337
Faustinoport, MT 16771-9320

092 Paucek Highway Apt. 772
East Erika, IA 61358

24365 Ulices Run
Homenicktown, MD 88485-6198

49578 Ayden Mountains
New Russellhaven, UT 46626

2765 Schulist Stream
Lindmouth, UT 03391-3817

SELECT date_sold, fld_feature_1, buyer_offered_price, property_type_code, oth_feature_2, property_id, other_property_details, fld_feature_3, shp_feature_2, property_address, hse_feature_2, vendor_requested_price, shp_feature_3, oth_feature_1, apt_feature_1, apt_feature_2, agreed_selling_price, shp_feature_1, date_on_market, room_count, property_name, apt_feature_3, oth_feature_3, hse_feature_3, hse_feature_1, fld_feature_2 FROM Properties WHERE date_sold != "1973-02-24 02:56:06" AND oth_feature_3 <> "None" OR shp_feature_2 != "None" OR hse_feature_1 != "None" OR date_on_market = "2016-05-24 09:57:45" OR apt_feature_1 != "enim" AND hse_feature_3 <> "None" OR "vendor_requested_price" != 983.8596 AND shp_feature_3 <> "None" AND property_name <> "longacre" AND apt_feature_2 <> "et" OR other_property_details != "None" OR oth_feature_1 != "None" AND apt_feature_3 <> "None" AND fld_feature_2 = "None" OR "room_count" <> 2 OR "buyer_offered_price" = 8.7122 AND hse_feature_2 != "None" OR property_address <> "6837 Darien Views Apt. 475 South Maraview, KS 77770" AND fld_feature_1 = "None" OR shp_feature_1 = "None" AND "property_id" = 8 OR "agreed_selling_price" <= 4514.807 OR property_type_code != "Apartment" OR oth_feature_2 <> "None" OR fld_feature_3 != "None" INTERSECT SELECT date_sold, fld_feature_1, buyer_offered_price, property_type_code, oth_feature_2, property_id, other_property_details, fld_feature_3, shp_feature_2, property_address, hse_feature_2, vendor_requested_price, shp_feature_3, oth_feature_1, apt_feature_1, apt_feature_2, agreed_selling_price, shp_feature_1, date_on_market, room_count, property_name, apt_feature_3, oth_feature_3, hse_feature_3, hse_feature_1, fld_feature_2 FROM Properties WHERE apt_feature_2 != "eos"


Question: What are the IDs of drivers who are in both the driver table (with driver IDs greater than 4) and the school bus table (with driver IDs not equal to 9)?

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


Question: What are the store IDs of stores that have more than 793 product categories and are not ranked 3, along with the store IDs from the store_product table where the product ID is 2 or greater, or the store ID is 1?

SELECT Store_ID FROM store WHERE "Number_of_product_category" > 793.0 AND "Ranking" <> 3 UNION ALL SELECT Store_ID FROM store_product WHERE "Product_ID" >= 2 OR "Store_ID" = 1


Question: What are the aircraft IDs greater than 5, combined with aircraft IDs from airport-aircraft that are not equal to 2?

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 other details and descriptions for documents named "A history of Arts" that are not described as "b" and have an ID less than 3830, combined with the other details and descriptions for documents with an ID greater than 50123 or described as "b" and have a template ID greater or equal to 25?

SELECT Other_Details, Document_Description FROM Documents WHERE Document_Name = "A history of Arts" AND Document_Description != "b" AND "Document_ID" < 3830 UNION SELECT Other_Details, Document_Description FROM Documents WHERE "Document_ID" > 50123 OR Document_Description = "b" AND "Template_ID" >= 25


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

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


Question: Which driver IDs are not equal to 9, but are not driver IDs from school buses with driver ID 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: What are the driver IDs, excluding driver ID 7, and also the driver IDs from school buses that are less than 9?

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


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

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


Question: Which driver IDs are not equal to 10 and are in the driver table but not in the school bus table, where the school bus driver IDs are less than 10?

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


Question: What is the highest shop ID for shops that are not full-time or didn't start in 2003, combined with the highest shop ID for shops not managed by Job Dragtsma?

SELECT MAX(Shop_ID) FROM hiring WHERE Is_full_time = "F" OR Start_from != "2003" UNION SELECT MAX(Shop_ID) FROM shop WHERE Manager_name != "Job Dragtsma"


Question: What are the driver IDs that are either 3 or greater than 3, considering driver and school bus information?

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


Question: What are the aircraft IDs greater than 3 that are not in the list of aircraft IDs that are not equal to 2?

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


Question: What are the aircraft IDs, excluding aircraft ID 4, from the aircraft table, and also aircraft IDs greater than or equal to 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 is the sum of enrollments and the budget invested percentage for schools where the budget invested percentage is 122.5 or the total budget percentage budgeted is greater than 2.0?

SELECT SUM(T1.Enrollment), T2.Budget_invested_percent FROM School as T1 JOIN budget as T2 ON T1.School_id = T2.School_id WHERE Budget_invested_percent = "122.5" OR total_budget_percent_budgeted > 2.0


Question: What are the maximum ranks and club IDs from the coach table where the gender is not male, or the coach's name is Robert Chen, and the rank is greater than 2, or the coach ID is greater than or equal to 2, but not including the maximum ranks and club IDs from the match result table where small silver is less than 9, or bronze is not 8, and big silver is not 6, or points are less than 102, or rank is greater than 3, or club ID is less than 6 and gold is less than 6?

SELECT MAX(Rank), Club_ID FROM coach WHERE Gender != "M" OR Coach_name = "Robert Chen" AND "Rank" > 2 OR "Coach_ID" >= 2 EXCEPT SELECT MAX(Rank), Club_ID FROM match_result WHERE "Small_Silver" < 9 OR "Bronze" != 8 AND "Big_Silver" != 6 OR "Points" < 102 OR "Rank" > 3 OR "Club_ID" < 6 AND "Gold" < 6


Question: What are the IDs of drivers who are either not driver ID 3 in the school bus table or have a driver ID greater than 1 in the driver table?

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


Question: What are the names and user IDs of users where the user ID is less than 6 and the name isn't Helen, combined with the names and user IDs of all users except those with a user ID of 6?

SELECT name, u_id FROM useracct WHERE "u_id" < 6 AND name != "Helen" UNION SELECT name, u_id FROM useracct WHERE "u_id" != 6


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

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


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

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: Which store IDs meet either of the following conditions: their area size is less than or equal to 179.84, their ranking is at least 1, their ID is not 3, their type is not "City Mall", and their name is not "Blackville"; or their store ID is greater than or equal to 2 in the store_district table?

SELECT Store_ID FROM store WHERE "Area_size" <= 179.84 OR "Ranking" >= 1 AND "Store_ID" <> 3 AND Type <> "City Mall" AND Store_Name != "Blackville" UNION ALL SELECT Store_ID FROM store_district WHERE "Store_ID" >= 2


Question: What are the document IDs from the draft documents that don't have "p" as draft details, combined with the document IDs from the documents that don't have "q" as other details, and also don't have a receipt number of "55" and aren't of document type "CD"?

SELECT document_id FROM Document_Drafts WHERE draft_details <> "p" UNION ALL SELECT document_id FROM Documents WHERE other_details <> "q" AND receipt_number != "55" AND document_type_code != "CD"


Question: How many aircraft are associated with each airport?

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


Question: What are the driver IDs less than 4 that are in the driver table but not in the school bus table, excluding driver ID 3?

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


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

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


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

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


Question: Which driver IDs are either less than or equal to 4, or greater than 10?

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


Question: What is the maximum branch ID and the level for branches on Glebe Street that weren't opened in 2009?

SELECT MAX(T1.Branch_ID), T2.Level FROM branch as T1 JOIN member as T2 ON T1.Name = T2.Name WHERE Open_year <> "2009" AND Address_road = "Glebe Street"


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

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


Question: What is the sum of the 'Creation' values from the 'department' table where 'Creation' is '1977' or 'Ranking' is not 10, combined with the sum of 'Creation' where 'Name' is 'Labor' or 'Ranking' is 3 or 'Creation' is not '2002' and 'Budget_in_Billions' is 6.2 and 'Department_ID' is less than or equal to 11 or 'Num_Employees' is less than or equal to 10600?

SELECT SUM(Creation) FROM department WHERE Creation = "1977" OR "Ranking" <> 10 UNION SELECT SUM(Creation) FROM department WHERE Name = "Labor" OR "Ranking" = 3 OR Creation <> "2002" AND "Budget_in_Billions" = 6.2 AND "Department_ID" <= 11 OR "Num_Employees" <= 10600.0


Question: Which driver IDs are in the driver table but not in the school bus table, excluding driver ID 10 from the driver table and driver ID 4 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 != 4


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

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


Question: What are the aircraft IDs that appear in the aircraft table with an ID of 2 or greater, combined with the aircraft IDs from the airport_aircraft table that have an ID less than 2?

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


Question: What are the club IDs of clubs that started in or before 2011, or have a club ID greater than 4 and the name "Halmstads BK", or are located in the "USA", along with the club IDs of male coaches ranked 1 or higher who are associated with club ID 3?

SELECT Club_ID FROM club WHERE "Start_year" <= 2011 OR "Club_ID" > 4 AND Club_name = "Halmstads BK" OR Region = "USA" UNION SELECT Club_ID FROM coach WHERE Gender = "M" AND "Rank" >= 1 AND "Club_ID" = 3


Question: What are the IDs of drivers who are in both the driver and school bus tables, excluding driver ID 10, and whose driver ID is at least 2?

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


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

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


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

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


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

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


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID != 12 EXCEPT 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 7 from the driver table or not equal to 10 from the school bus table?

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


Question: What is the country with the highest alphabetical value for addresses in West Virginia that are not on "00704 Zoe Alley", and also what is the country with the highest alphabetical value for addresses in Georgia that are not in "Port Jackelinemouth", or for addresses with an ID less than 15 that are not in the USA?

SELECT MAX(country) FROM Addresses WHERE line_1_number_building <> "00704 Zoe Alley" AND state_province_county = "WestVirginia" UNION ALL SELECT MAX(country) FROM Addresses WHERE city <> "Port Jackelinemouth" AND state_province_county = "Georgia" OR "address_id" < 15 AND country != "USA"


Question: What is the sum of album IDs where the title isn't "Grieg: Peer Gynt Suites & Sibelius: Pelléas et Mélisande", or the ID isn't 136, or the artist ID is less than 110, combined with the sum of media type IDs where the ID isn't 4 and the name is "AAC audio file"?

SELECT SUM(id) FROM albums WHERE title <> "Grieg: Peer Gynt Suites & Sibelius: Pelléas et Mélisande" OR "id" != 136 OR "artist_id" < 110 UNION ALL SELECT SUM(id) FROM media_types WHERE "id" != 4 AND name = "AAC audio file"


Question: What states are in area code 757 or not California, but not states from votes where the phone number is 5112677315 or greater, or the creation date isn't '2018-03-09 19:03:36', or the contestant number is 3 or greater, or the state is New York and the vote ID is greater than 2?

SELECT state FROM AREA_CODE_STATE WHERE "area_code" = 757 OR state <> "CA" EXCEPT SELECT state FROM VOTES WHERE "phone_number" >= 5112677315 OR created != "2018-03-09 19:03:36" OR "contestant_number" >= 3 OR state = "NY" AND "vote_id" > 2


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


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

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: Which club IDs are in the club table but not named "Gefle IF" and also have match results where "Big_Silver" is at least 12 and "Points" are at most 89, or the rank isn't 4, or the club ID is greater than 1?

SELECT Club_ID FROM club WHERE Club_name <> "Gefle IF" INTERSECT SELECT Club_ID FROM match_result WHERE "Big_Silver" >= 12 AND "Points" <= 89 OR "Rank" != 4 OR "Club_ID" > 1


Question: What is the longest paragraph text and the number of documents for paragraphs that are not "Papua New Guinea" or have a Document ID greater than 3830, combined with the longest paragraph text and the number of documents for paragraphs that are not "Korea" or have other details that are not "None" or have a Document ID of 50123?

SELECT MAX(Paragraph_Text), COUNT(Document_ID) FROM Paragraphs WHERE Paragraph_Text != "Papua New Guinea" OR "Document_ID" > 3830 UNION ALL SELECT MAX(Paragraph_Text), COUNT(Document_ID) FROM Paragraphs WHERE Paragraph_Text != "Korea" OR Other_Details != "None" OR "Document_ID" = 50123


Question: Which driver IDs are both less than or equal to 5 and are also driver ID 3, considering driver and school bus information?

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


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

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


Question: What are the rank, gold, minimum big silver, small silver, count of club IDs, minimum bronze, and average points for club 2 where small silver isn't 16 and points are at least 168, and also for results where the rank is greater than 3 or the small silver is less than or equal to 6, or the club ID is not 2?

SELECT Rank, Gold, MIN(Big_Silver), Small_Silver, COUNT(Club_ID), MIN(Bronze), AVG(Points) FROM match_result WHERE "Small_Silver" != 16 AND "Points" >= 168 AND "Club_ID" = 2 UNION SELECT Rank, Gold, MIN(Big_Silver), Small_Silver, COUNT(Club_ID), MIN(Bronze), AVG(Points) FROM match_result WHERE "Rank" > 3 AND "Small_Silver" <= 6 OR "Club_ID" != 2


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


Question: What feature type codes are associated with features that are not feature ID 2 or are named "AirCon" but not "Security" and also have feature type names that are not "Securiyt, eg Burglar Alarm."?

SELECT feature_type_code FROM Other_Available_Features WHERE "feature_id" <> 2 OR feature_type_code != "Security" AND feature_name = "AirCon" INTERSECT SELECT feature_type_code FROM Ref_Feature_Types WHERE feature_type_name <> "Securiyt, eg Burglar Alarm."


Question: What are the aircraft IDs of aircraft with a distance of at least 6475, excluding those aircraft IDs that are 11 or less?

SELECT aid FROM aircraft WHERE "distance" >= 6475 EXCEPT SELECT aid FROM certificate WHERE "aid" <= 11


Question: What are the driver IDs, where one driver ID is 5 and another is 7, considering the driver IDs from both the driver and school bus tables?

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


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


Question: What are the IDs of heads who are 69 or younger, excluding those in management where the department ID is greater than 11 and not temporarily acting, or whose head ID is 10 or less?

SELECT head_ID FROM head WHERE "age" <= 69.0 EXCEPT SELECT head_ID FROM management WHERE "department_ID" > 11 AND temporary_acting = "No" OR "head_ID" <= 10


Question: What are the IDs of drivers who are not driver ID 3, and also the IDs of school buses that are not driver ID 4?

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


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

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


Question: What are the IDs of car makers where the ID is 13 or greater, combined with the IDs of car makers where the country is not "2" or the maker is not "ford"?

SELECT Id FROM car_makers WHERE "Id" >= 13 UNION ALL SELECT Id FROM car_makers WHERE Country != "2" OR Maker <> "ford"


Question: What are the employee IDs of people who don't work at shop 6 and started in 2009, combined with the employee IDs of those who are not full-time and didn't start in 2010?

SELECT Employee_ID FROM hiring WHERE "Shop_ID" <> 6 AND Start_from = "2009" UNION SELECT Employee_ID FROM hiring WHERE Is_full_time != "T" AND Start_from != "2010"


Question: Which driver IDs are either 8 from the driver table or 4 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 = 4


Question: What are the names and user IDs of users who are not named "Roxi" and also have a user ID greater than 3 or are named "Mark"?

SELECT name, u_id FROM useracct WHERE name != "Roxi" INTERSECT SELECT name, u_id FROM useracct WHERE "u_id" > 3 OR name = "Mark"


Question: What are the student IDs of students who have pets, excluding student ID 1002, and also the student IDs of students aged 16 or younger?

SELECT StuID FROM Has_Pet WHERE "StuID" != 1002 UNION ALL SELECT StuID FROM Student WHERE "Age" <= 16


Question: For each country, give me the count of airport names, the count of IATA codes, the count of cities, and the minimum airport ID, but only consider airports where the ID is greater than 6, or the IATA code isn't "AEY" and the ICAO code isn't "BIAR", or the country isn't "Netherlands". Group the results by country, and only include countries where the minimum ID is less than 1 and the count of IATA codes is greater than 1, or the count of airport names isn't 1. Also, for airports where the name isn't "El Prat Airport", the city is "Bergen", and the IATA code isn't "BOS", give me the same information grouped by country, but only include countries where the count of airport names isn't 1, or the count of IATA codes isn't 1 and the count of cities is greater than 1. Combine these two sets of results.

COUNT(name) COUNT(IATA) COUNT(City) MIN(id) Country

SELECT COUNT(name), COUNT(IATA), COUNT(City), MIN(id), Country FROM airport WHERE "id" > 6 OR IATA != "AEY" AND ICAO <> "BIAR" OR Country <> "Netherlands" GROUP BY Country HAVING MIN(id) < 1 AND COUNT(IATA) > 1 OR COUNT(name) != 1 UNION SELECT COUNT(name), COUNT(IATA), COUNT(City), MIN(id), Country FROM airport WHERE name != "El Prat Airport" AND City = "Bergen" AND IATA != "BOS" GROUP BY Country HAVING COUNT(name) != 1 OR COUNT(IATA) != 1 AND COUNT(City) > 1


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


Question: What are the IDs of drivers who are not driver ID 3 and are not assigned to school buses?

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


Question: What driver IDs are present in both the driver table (excluding driver ID 1) and the school bus table (specifically driver ID 4)?

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 aircraft IDs that are either greater than or equal to 1 in the aircraft table or not equal to 5 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 != 5


Question: What are the aircraft IDs, excluding aircraft ID 3, and also aircraft IDs less than 2, considering both aircraft and airport-aircraft information?

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


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

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


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

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


Question: Which driver IDs, greater than 4, are found in either the driver or school bus tables?

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: What are the aircraft IDs greater than 3 or less than 3, considering both the aircraft and airport-aircraft tables?

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


Question: What are the IDs of drivers, excluding driver 8, and also the IDs of drivers with an ID greater than 3, considering both driver and school bus records?

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 driver IDs that are less than 7 from the driver table, combined with the driver IDs that are less than or equal to 10 from the school bus table?

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


Question: What are the aircraft IDs that are either greater than or equal to 5 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 >= 5 UNION SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID < 3


Question: What is the average driver ID, along with the driver ID, for drivers in the driver table and school bus table who are under 52 years old, grouped by years working, where the school ID is greater than 7 and they are full-time, or are affiliated with the Republican party, or are not 40 years old, or have worked less than 6 years and live in Hartford?

SELECT AVG(T1.Driver_ID), T2.Driver_ID FROM driver as T1 JOIN school_bus as T2 ON T1.Driver_ID = T2.Driver_ID WHERE "Age" < 52 GROUP BY Years_Working HAVING School_ID > 7 AND If_full_time = "T" OR Party = "Rep" OR Age <> 40 OR Years_Working < 6 AND Home_city = "Hartford"


Question: What are the enrollment numbers and the percentage of the total budget that was budgeted, grouped by enrollment, where the percentage of the total budget invested is less than 2.7, or the percentage of the total budget budgeted is greater than or equal to 1.3 and the county is "46 LaPorte 71 St. Joseph", or the enrollment is not 601, or the mascot is not "Lancers", or the location is not "Bourbon", or the IHSAA class is not "A", or the school name is not "Culver Community", or the budgeted amount is less than 74849?

SELECT T1.Enrollment, T2.total_budget_percent_budgeted FROM School as T1 JOIN budget as T2 ON T1.School_id == T2.School_id GROUP BY Enrollment HAVING total_budget_percent_invested < 2.7 OR total_budget_percent_budgeted >= 1.3 AND County = "46 LaPorte 71 St. Joseph" OR Enrollment <> 601 OR Mascot <> "Lancers" OR Location <> "Bourbon" OR IHSAA_Class <> "A" OR School_name <> "Culver Community" OR Budgeted < 74849


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

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


Question: Which driver IDs are greater than 11 but not found in the school bus records with IDs of 9 or greater?

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 aircraft IDs that are less than 3, and also the aircraft IDs that are not 5, considering both the aircraft and airport_aircraft tables?

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


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

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


Question: What aircraft IDs appear in both the aircraft table with an ID greater than 1 and the airport_aircraft table with an ID count of at least 2?

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


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

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


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: What are the driver IDs that are either greater than or equal to 5 in the driver table or not equal to 4 in the school bus table?

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


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

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


Question: What are the names and heights of people who are not born on August 16, 1982, or are Russian, and also have a People ID greater than 1?

SELECT Name, Height FROM people WHERE Birth_Date <> "August 16, 1982" AND "Height" != 193.0 OR Nationality = "Russia" INTERSECT SELECT Name, Height FROM people WHERE "People_ID" > 1


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


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

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


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

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


Question: What are the ages and department IDs, but only for those departments where the temporary acting status isn't "Yes", or the birth state is Delaware, or the age is 69, or the name isn't "Dudley Hart", or the department ID is 7?

SELECT T1.age, T2.department_ID FROM head as T1 JOIN management as T2 ON T1.head_ID == T2.head_ID GROUP BY department_ID HAVING temporary_acting <> "Yes" OR born_state = "Delaware" OR age = 69.0 OR name <> "Dudley Hart" OR department_ID = 7


Question: What is the highest document ID from the Circulation History table where the document ID is not 2 or the copy number is 15 or greater and the employee ID is less than 1, combined with the highest document ID from the Documents Mailed table where the mailing date is not "1992-11-07 15:03:41" or the document ID is 23 or greater?

SELECT MAX(document_id) FROM Circulation_History WHERE "document_id" != 2 OR "copy_number" >= 15 AND "employee_id" < 1 UNION ALL SELECT MAX(document_id) FROM Documents_Mailed WHERE mailing_date <> "1992-11-07 15:03:41" OR "document_id" >= 23