Question: Can you show me the smallest city area and corresponding store ID for each store, considering only stores where the city population isn't 530438, the store ID is 1 or less, the city area isn't 22, and the district name isn't "Chiniot District", and then only including stores where the store ID is greater than 1 and the city population is 134936, or the headquartered city isn't "Khanewal City" and the district name isn't "Khanewal District"?

SELECT MIN(T1.City_Area), T2.Store_ID FROM district as T1 JOIN store_district as T2 ON T1.District_ID = T2.District_ID WHERE "City_Population" <> 530438.0 OR "Store_ID" <= 1 AND "City_Area" <> 22.0 AND District_name <> "Chiniot District" GROUP BY Store_ID HAVING Store_ID > 1 AND City_Population = 134936.0 OR Headquartered_City <> "Khanewal City" AND District_name <> "Khanewal District"


Question: Which driver has an ID of 4 and also drives a school bus, but not one with an ID of 3?

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


Question: Can you give me a list of driver IDs that are less than 12, excluding those driver IDs that are also less than or equal to 9 and are associated with a school bus?

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


Question: Could you list all the company IDs from the employment table, including those where the working year is at least one, and also those where the working year is exactly four, or where the company ID isn't 11 and the people ID is no more than three?

SELECT Company_ID FROM employment WHERE "Year_working" >= 1 UNION ALL SELECT Company_ID FROM employment WHERE "Year_working" = 4 OR "Company_ID" != 11 AND "People_ID" <= 3


Question: Can you list the aircraft IDs that are greater than or equal to 3, excluding those aircraft IDs that are also greater than 2 in the airport aircraft list?

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


Question: Which driver IDs are both greater than or equal to 2 and also not equal to 4, considering only unique driver IDs from the driver and school_bus tables?

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


Question: Can you give me a list of driver IDs that are 11 or greater, excluding those driver IDs that appear in the school bus list, except for driver ID 3?

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


Question: Can you give me a list of driver IDs that are either 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: Which driver IDs are equal to 6, but not equal to 10 and present 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 = 10


Question: What is the total student ID and the age of pets that are not dogs?

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


Question: Can you give me the IDs of documents that were mailed on February 21, 1973, at 10:17:01 AM, but are not draft copies with a draft number greater than 9, a document ID that is not 12, and a copy number of 4?

SELECT document_id FROM Documents_Mailed WHERE mailing_date = "1973-02-21 10:17:01" EXCEPT SELECT document_id FROM Draft_Copies WHERE "draft_number" > 9 AND "document_id" != 12 AND "copy_number" = 4


Question: Can you give me a list of driver IDs from the driver table that are less than 5, combined with a list of driver IDs from the school_bus table that are not equal to 7?

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


Question: Can you give me a list of document status codes, combining those from the Documents table where the document ID isn't 3 or the status isn't "overdue" but the shipping agent is "SH", with those from the Ref_Document_Status table where the status isn't "overdue" or the description isn't "currently working on"?

SELECT document_status_code FROM Documents WHERE "document_id" <> 3 OR document_status_code != "overdue" AND shipping_agent_code = "SH" UNION SELECT document_status_code FROM Ref_Document_Status WHERE document_status_code != "overdue" OR document_status_description <> "currently working on"


Question: Can you give me a list of occupations and residences of players, excluding Patricia Cordner or those not sponsored by Elmwood—Transcona and not living in Winnipeg, or those with a Player ID of 6, but then remove any occupations and residences from that list where the player's votes aren't 12285 and their Player ID is not greater than 6, or they live in Winnipeg, or they aren't sponsored by Winnipeg North and are retired, or they are male and ranked 1st, or their name is Jim Maloway?

SELECT Occupation, Residence FROM player WHERE Player_name <> "Patricia Cordner" OR Sponsor_name != "Elmwood—Transcona" AND Residence != "Winnipeg" OR "Player_ID" = 6 EXCEPT SELECT Occupation, Residence FROM player WHERE "Votes" <> 12285 AND "Player_ID" <= 6 OR Residence = "Winnipeg" OR Sponsor_name != "Winnipeg North" AND Occupation = "Retired" OR Gender = "M" AND Rank = "1st" OR Player_name = "Jim Maloway"


Question: Can you give me the head ID, department ID, and temporary acting status for management entries that are in departments other than department 7, and also in departments other than department 15 where the temporary acting status is not "No", or where the head ID is 6?

SELECT head_ID, department_ID, temporary_acting FROM management WHERE "department_ID" != 7 INTERSECT SELECT head_ID, department_ID, temporary_acting FROM management WHERE "department_ID" <> 15 AND temporary_acting != "No" OR "head_ID" = 6


Question: Can you give me a list of driver IDs, including driver ID 10 from the driver table, and all driver IDs except 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: Which driver IDs are both less than 9 and also greater than or equal to 4?

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


Question: Can you give me a list of driver IDs that are both less than or equal to 9 from the driver table and not equal to 10 from the school_bus table?

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


Question: Can you give me a list of first names of customers, excluding any first names of staff members, where the customers meet at least one of these conditions: their birthdate isn't 1988-09-19 14:45:56, their customer ID is less than 7, their customer address ID isn't 10, their last name isn't Mertz, their customer status code isn't "Good Customer" and their phone number is "417.136.2900x672" and their date became customer isn't "2017-11-25 01:42:26" and their first name is "Amya" and their amount outstanding is less than 5494.0, or their email address isn't "karina.carroll@example.net"; and the staff members meet at least one of these conditions: their staff address ID is less than or equal to 6 and their first name isn't "Camylle", their date joined staff is "2017-08-30 15:08:37", their last name is "Weissnat", their nickname isn't "lsenger", their birthdate isn't "1997-03-29 10:55:45" and their date left staff is "2018-03-09 05:08:35", or their middle name isn't "Madelyn"?

SELECT first_name FROM Customers WHERE date_of_birth <> "1988-09-19 14:45:56" AND "customer_id" < 7 OR "customer_address_id" != 10 OR last_name <> "Mertz" OR customer_status_code != "Good Customer" AND phone_number = "417.136.2900x672" AND date_became_customer <> "2017-11-25 01:42:26" AND first_name = "Amya" AND "amount_outstanding" < 5494.0 OR email_address <> "karina.carroll@example.net" EXCEPT SELECT first_name FROM Staff WHERE "staff_address_id" <= 6 AND first_name != "Camylle" OR date_joined_staff = "2017-08-30 15:08:37" OR last_name = "Weissnat" OR nickname <> "lsenger" OR date_of_birth <> "1997-03-29 10:55:45" AND date_left_staff = "2018-03-09 05:08:35" OR middle_name != "Madelyn"


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

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


Question: Can you list all the driver IDs, including those from the driver table where the ID is 10 or greater, and those from the school bus table where the ID is not 9?

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


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

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


Question: Can you give me the IDs of documents that have a document ID less than 2 and also have a receipt date that isn't July 2nd, 2017 at 5:39:09 PM, or are in "working" status and not of type "CD", or have a shipping agent code of "FE", or have other details that are not "p"?

SELECT document_id FROM Circulation_History WHERE "document_id" < 2 INTERSECT SELECT document_id FROM Documents WHERE receipt_date <> "2017-07-02 17:39:09" OR document_status_code = "working" AND document_type_code <> "CD" OR shipping_agent_code = "FE" OR other_details != "p"


Question: For each club, can you tell me the number of regions, the earliest start year, and the number of club names, but only for clubs where the number of regions isn't exactly one or the earliest start year is 2000 or earlier? Also, include the same information for clubs where the number of regions isn't exactly one or the earliest start year is 2001 or earlier.

SELECT Club_ID, COUNT(Region), MIN(Start_year), COUNT(Club_name) FROM club GROUP BY Club_ID HAVING COUNT(Region) != 1 OR MIN(Start_year) <= 2000 UNION ALL SELECT Club_ID, COUNT(Region), MIN(Start_year), COUNT(Club_name) FROM club GROUP BY Club_ID HAVING COUNT(Region) <> 1 OR MIN(Start_year) <= 2001


Question: Can you list the aircraft IDs that are greater than 3 when grouped in the aircraft table, and also include aircraft ID 5 when grouped in the airport_aircraft table?

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


Question: What was the highest enrollment and the invested amount for each IHSAA class, considering only schools where the year was 2005 or earlier, the invested amount was less than 5840, the IHSAA class was AAA but not A for football, the total budget percentage was less than 2.0, the enrollment was 620 or less, or the location was not Culver, and further filtering to only include those with enrollment less than 495 and school name Glenn, budget invested percentage not equal to 42.9, or county 71 St. Joseph?

SELECT MAX(T1.Enrollment), T2.Invested FROM School as T1 JOIN budget as T2 ON T1.School_id = T2.School_id WHERE "Year" <= 2005 OR "Invested" < 5840 AND IHSAA_Class = "AAA" AND IHSAA_Football_Class <> "A" AND "total_budget_percent_budgeted" < 2.0 OR "Enrollment" <= 620 OR Location <> "Culver" GROUP BY IHSAA_Class HAVING Enrollment < 495 AND School_name = "Glenn" OR Budget_invested_percent <> "42.9" OR County = "71 St. Joseph"


Question: Can you give me a list of airport names, excluding those that are either "Baltimore-Washington Airport" or have an IATA code of "BWI" and are not in Belgium, but then remove any names that also appear in a list of operate_company names where the type is "Subsidiary", the ID is not 7, the name is not "Vogue Laundry Service Limited", or the Group_Equity_Shareholding is less than 30%?

SELECT name FROM airport WHERE name != "Baltimore-Washington Airport" OR IATA <> "BWI" AND Country <> "Belgium" EXCEPT SELECT name FROM operate_company WHERE Type = "Subsidiary" AND "id" <> 7 AND name <> "Vogue Laundry Service Limited" OR "Group_Equity_Shareholding" < 30.0


Question: Can you give me a list of driver IDs that are greater than or equal to 1 from the driver table, excluding those driver IDs that are not equal to 4 from the school bus table?

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


Question: Which driver has a Driver ID of 10 and is also associated with a school bus having a Driver ID of 7 or greater?

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


Question: Can you list the driver IDs that are less than 3 from the driver table, and combine that with a list of driver IDs that are not equal to 4 from the school bus table, removing any duplicates?

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


Question: Can you give me the driver ID that appears exactly once with the value 8 in the driver table, but does not appear with a value greater than 4 in the school bus table?

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


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

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


Question: Can you give me a list of driver IDs that are greater than 1 from the driver table, combined with a list of driver IDs that are greater than 10 from the school bus table?

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


Question: Could you list all the document status codes from the Documents table where the receipt number is not "114", and also list all the document status codes from the Ref_Document_Status table where the document status description is not "currently working on"?

SELECT document_status_code FROM Documents WHERE receipt_number <> "114" UNION ALL SELECT document_status_code FROM Ref_Document_Status WHERE document_status_description <> "currently working on"


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

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


Question: Which driver IDs are greater than 4 and also greater than 7 in the school bus records?

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


Question: What aircraft IDs, excluding aircraft ID 4, are present in the aircraft table but not in the airport_aircraft table where the aircraft ID is at least 3?

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


Question: Can you give me a list of driver IDs that are not 6, and also are not driver IDs less than 7 that are 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 < 7


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

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


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

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


Question: Could you give me the student IDs of students who either have an allergy other than to cats or whose ID is 1025 or less, and who are also majoring in subject 520?

SELECT StuID FROM Has_Allergy WHERE "StuID" <= 1025 OR Allergy != "Cat" INTERSECT SELECT StuID FROM Student WHERE "Major" = 520


Question: Can you give me the driver IDs that are less than 10 and also less than 7 in the school bus list?

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


Question: Can you give me the locations and school IDs of schools that are either not Noelani Elementary School, don't have grades 1st-3rd, or have a School ID less than 2 and are located in Jakarta, Indonesia, or are public, but only if they are also not private?

SELECT Location, School_ID FROM school WHERE School != "Noelani Elementary School" OR Grade != "1st-3rd grade" OR "School_ID" < 2 AND Location = "Jakarta, Indonesia" OR Type = "Public" INTERSECT SELECT Location, School_ID FROM school WHERE Type != "Private"


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

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


Question: Which driver IDs, excluding driver ID 9, appear in the driver table but not in the school_bus table, where we only consider driver IDs less than 3 in the school_bus table?

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


Question: Which driver IDs, excluding driver ID 8, are also driver ID 4 in the school bus list?

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


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

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: Can you give me a list of template type codes, combining those that aren't "Paper" or "CV" from the template types reference with those from the templates that either aren't template ID 1 and aren't PP, or have a different effective from date than 1975-10-20 02:28:58 and a different effective to date than 2015-09-06 01:08:44 and aren't version number 4, or have empty template details?

SELECT Template_Type_Code FROM Ref_Template_Types WHERE Template_Type_Description != "Paper" AND Template_Type_Code <> "CV" UNION SELECT Template_Type_Code FROM Templates WHERE "Template_ID" != 1 AND Template_Type_Code <> "PP" OR Date_Effective_From != "1975-10-20 02:28:58" AND Date_Effective_To <> "2015-09-06 01:08:44" AND "Version_Number" != 4 OR Template_Details = ""


Question: How many document drafts have a draft number of 1 or higher, and how many mailed documents were sent to an address ID less than 5?

SELECT COUNT(document_id) FROM Document_Drafts WHERE "draft_number" >= 1 UNION ALL SELECT COUNT(document_id) FROM Documents_Mailed WHERE "mailed_to_address_id" < 5


Question: Which driver IDs are present in both the driver list (excluding driver 9) and the school bus list (excluding driver 7)?

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


Question: Could you give me a list of document IDs, including those with the description "w" that don't have "None" in Other Details and aren't Template ID 14, along with any document IDs that don't have the name "About Korea"?

SELECT Document_ID FROM Documents WHERE Document_Description = "w" AND Other_Details <> "None" AND "Template_ID" <> 14 UNION ALL SELECT Document_ID FROM Documents WHERE Document_Name <> "About Korea"


Question: What are the trust values where the source user ID is at least 2, excluding the trust values where the target user ID is greater than 6?

SELECT trust FROM trust WHERE "source_u_id" >= 2 EXCEPT SELECT trust FROM trust WHERE "target_u_id" > 6


Question: Can you give me a list of driver IDs that are 3 or greater from the driver table, excluding any driver IDs that are 7 or less from the school_bus table?

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


Question: Can you list the driver IDs that are less than 4 from the driver table, combined with the driver IDs that are less than 10 from the school bus table?

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


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

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


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

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


Question: Can you give me a list of document IDs from the circulation history where either the employee ID is 2 or less, or the document ID is 20 or more and the copy number is 5, or the draft number is 1 or more, combined with a list of document IDs where the copy number is 15 or more and the employee ID is 8 or less?

SELECT document_id FROM Circulation_History WHERE "employee_id" <= 2 OR "document_id" >= 20 AND "copy_number" = 5 OR "draft_number" >= 1 UNION SELECT document_id FROM Circulation_History WHERE "copy_number" >= 15 AND "employee_id" <= 8


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

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


Question: Can you give me a list of driver IDs that are both less than or equal to 9 and not equal to 3, considering drivers from 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: Which driver IDs are both greater than or equal to 8 in the driver table and greater than or equal to 3 in the school_bus table?

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


Question: Can you give me a list of driver IDs, including driver ID 7 from the driver table, and any driver IDs greater than 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: Can you give me a list of driver IDs, including those from the driver table excluding driver ID 5, and those from the school bus table with driver IDs up to 9?

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


Question: Can you give me the IDs of drivers, up to ID 7, who are listed as drivers but not associated with any school bus?

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


Question: Can you give me the sum of the levels, the highest name, the sum of the hometowns, and the member IDs for members who either aren't named Johnny Williams and are from Columbia, South Carolina, or have a card number other than RCB32, or have a member ID greater than 10, combined with the sum of the levels, the highest name, the sum of the hometowns, and the member IDs for members who either have a level of 6 or are not from LaGrange, Georgia and don't have a card number of FS10?

SUM(Level) MAX(Name) SUM(Hometown) Member_ID

SELECT SUM(Level), MAX(Name), SUM(Hometown), Member_ID FROM member WHERE Name <> "Johnny Williams" AND Hometown = "Columbia, South Carolina" OR Card_Number <> "RCB32" OR "Member_ID" > 10 UNION ALL SELECT SUM(Level), MAX(Name), SUM(Hometown), Member_ID FROM member WHERE "Level" = 6 OR Hometown <> "LaGrange, Georgia" AND Card_Number != "FS10"


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

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


Question: Which driver IDs are both greater than 2 and also equal to 7?

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


Question: Can you give me a list of driver IDs, including driver ID 1 from the driver table, and all driver IDs less than 7 from the school bus table?

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


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

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


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

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


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

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


Question: Can you list the aircraft IDs that are greater than 2 in the aircraft table, and also list the aircraft IDs that are less than 3 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 < 3


Question: Can you give me a list of driver IDs that are not equal to 3 and are also less than 9, considering only the unique driver IDs from 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: Could you give me the District IDs that are both from districts where either the city area is less than 17 and the headquarters are in Faisalabad City, or the city population is not 1526168 and the District ID is 14 or greater, and also from store districts where the District ID is 15 or greater?

SELECT District_ID FROM district WHERE "City_Area" < 17.0 AND Headquartered_City = "Faisalabad City" OR "City_Population" <> 1526168.0 AND "District_ID" >= 14 INTERSECT SELECT District_ID FROM store_district WHERE "District_ID" >= 15


Question: Which aircraft IDs are not equal to 3 and appear in the aircraft table, and are also not equal to 2 and appear in the airport_aircraft table?

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


Question: Which driver IDs, when considered individually, are equal to 8 in the driver table but not equal to 9 in the school bus table?

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


Question: Can you give me a list of aircraft IDs that are greater than 1, grouping by aircraft ID from the aircraft table, combined with a list of aircraft IDs that are greater than 2, grouping by aircraft ID from the airport_aircraft table?

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


Question: Can you give me a list of driver IDs, including those that are not 12 from the driver table, and those greater than 7 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 > 7


Question: Can you give me a list of driver IDs that are less than 3 from the driver table, combined with a list of driver IDs that are exactly 10 from the school bus table?

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


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

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


Question: Can you give me a list of driver IDs that are greater than 11 from the driver table, combined with a list of driver IDs that are greater than 9 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 > 9


Question: Which aircraft IDs are both greater than or equal to 3 (when considering all aircraft) and equal to 5 (when considering aircraft at airports)?

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


Question: Which driver IDs are equal to 6, but not equal to 10 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 = 10


Question: Which aircraft have an ID of 3 in the aircraft table, but not in the airport_aircraft table if we only consider aircraft IDs that are not 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: Can you list all the driver IDs that are greater than or equal to 12 from the driver table, and combine that with a list of all driver IDs that are greater than 10 from the school bus table, removing any duplicates?

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


Question: Could you list the Aircraft ID from the aircraft table alongside the corresponding ID from the airport_aircraft table, matching them by Aircraft ID?

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


Question: Can you give me a list of aircraft IDs that are greater than 3, but exclude any aircraft IDs from the airport aircraft list that are not equal to 5?

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


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

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


Question: What aircraft IDs are greater than or equal to 3, but not less than 5, considering all aircraft and airport aircraft?

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


Question: Which document IDs in the drafts, excluding document ID 1, are not associated with documents received on May 8, 1974?

SELECT document_id FROM Document_Drafts WHERE "document_id" != 1 EXCEPT SELECT document_id FROM Documents WHERE receipt_date = "1974-05-08 00:00:46"


Question: Can you give me a list of driver IDs less than 5 that appear in both the driver table and the school bus table, where in the school bus table, the driver IDs are also less than 4?

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


Question: Can you give me a list of employee IDs that either received a bonus greater than or equal to $3200 in a year other than 2016 and are not employee ID 2, or are from hiring records where the shop ID is not 1, the employee ID is less than 6 and they are not full-time, or their start year is not 2009?

SELECT Employee_ID FROM evaluation WHERE Year_awarded <> "2016" AND "Bonus" >= 3200.0 AND Employee_ID <> "2" UNION SELECT Employee_ID FROM hiring WHERE "Shop_ID" <> 1 OR "Employee_ID" < 6 AND Is_full_time != "T" OR Start_from != "2009"


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

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


Question: Can you give me a list of aircraft IDs, excluding aircraft ID 4, that are not also aircraft ID 5 found in the airport aircraft list?

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: Can you give me a list of driver IDs, excluding driver ID 11, that are not also driver IDs less than 3 in the school bus table?

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


Question: What is the highest airport ID associated with each number of transit passengers?

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


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

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


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


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

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


Question: Could you give me a list of People IDs from the employment table where either the Company ID is not 17 or the Year Working is not 1, combined with a list of People IDs from the people table where the name is not Tim Naegeli?

SELECT People_ID FROM employment WHERE "Company_ID" != 17 OR "Year_working" != 1 UNION ALL SELECT People_ID FROM people WHERE Name <> "Tim Naegeli"


Question: What are the average zip code and county ID for counties that aren't named Mansfield and have a zip code of D02, combined with the average zip code and county ID for counties with a county ID less than 4 or a name other than Manning?

SELECT AVG(Zip_code), AVG(County_Id) FROM county WHERE County_name != "Mansfield" AND Zip_code = "D02" UNION SELECT AVG(Zip_code), AVG(County_Id) FROM county WHERE "County_Id" < 4 OR County_name != "Manning"


Question: Can you give me the last names and birth dates of customers, excluding staff members, based on a complex set of criteria involving address IDs, email addresses, names, customer status, phone numbers, birth dates, staff IDs, middle names, join/leave dates, nicknames, and first names?

SELECT last_name, date_of_birth FROM Customers WHERE "customer_address_id" < 7 OR email_address != "kitty.hand@example.net" AND last_name != "Spinka" OR first_name != "Dameon" AND customer_status_code != "Good Customer" AND cell_mobile_phone_number != "(630)964-2426" AND date_of_birth <> "1996-08-30 06:17:50" OR phone_number <> "(297)122-0086" EXCEPT SELECT last_name, date_of_birth FROM Staff WHERE "staff_address_id" >= 3 AND middle_name <> "Stephania" AND last_name <> "Carroll" OR date_joined_staff = "2016-06-06 08:54:28" OR date_left_staff = "2018-03-10 15:25:00" AND nickname != "ynader" OR date_of_birth != "1995-06-03 08:09:17" AND "staff_id" <= 15 AND first_name = "Kaitlin"


Question: Which driver IDs, excluding driver ID 10, are also driver IDs for school buses, excluding driver ID 9?

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


Question: Which driver IDs are greater than or equal to 6, but not less than 10, considering all drivers and school bus drivers?

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


Question: Which driver IDs are both not equal to 3 and less than or equal to 4?

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


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

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


Question: What are the total maximum gross weight, total disk area, and the number of maximum disk loadings for aircraft meeting certain criteria, excluding those aircraft that meet other criteria?

SELECT SUM(Max_Gross_Weight), Total_disk_area, COUNT(Max_disk_Loading) FROM aircraft WHERE "Aircraft_ID" <= 2 AND Aircraft != "Robinson R-22" OR Max_Gross_Weight != "1,370 lb (635 kg)" OR Description != "Heavy-lift helicopter" AND Max_disk_Loading <> "8.8 lb/ft² (43 kg/m²)" EXCEPT SELECT SUM(Max_Gross_Weight), Total_disk_area, COUNT(Max_disk_Loading) FROM aircraft WHERE Max_Gross_Weight != "1,370 lb (635 kg)" AND "Aircraft_ID" >= 5 OR Max_disk_Loading <> "8.8 lb/ft² (43 kg/m²)"


Question: Can you give me a list of driver IDs that are less than 8, but not if they are also driver IDs that are less than or equal to 9 in the school bus list?

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


Question: Can you list the driver IDs that are less than 1 from the driver table, and also list the driver IDs that are less than 7 from the school_bus table, combining the results into a single list?

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


Question: Can you give me a list of property IDs that either have a feature ID of 4 or higher, or a property feature description that isn't "ad", combined with a list of property IDs from the Properties table that meet a long list of criteria related to various features, dates, prices, and property types?

SELECT property_id FROM Other_Property_Features WHERE "feature_id" >= 4 OR property_feature_description <> "ad" UNION SELECT property_id FROM Properties WHERE fld_feature_1 <> "None" OR other_property_details <> "None" OR "property_id" != 6 AND date_on_market != "1981-08-23 05:40:38" OR property_name != "wall street" AND hse_feature_2 = "None" OR oth_feature_2 != "None" OR hse_feature_1 != "None" OR shp_feature_3 <> "None" OR fld_feature_3 != "None" OR date_sold <> "2003-02-27 18:17:11" AND fld_feature_2 != "None" AND apt_feature_1 <> "ut" AND shp_feature_1 != "None" AND property_type_code != "Apartment" AND apt_feature_2 != "est" AND apt_feature_3 = "None" AND "agreed_selling_price" <= 4201.8 OR oth_feature_3 != "None" OR hse_feature_3 = "None" OR "buyer_offered_price" <= 296733.0


Question: Can you give me the customer address ID, phone number, last name, amount outstanding, first name, customer status code, customer ID, email address, date of birth, cell phone number, and date they became a customer for all customers who are either not named Koelpin, or don't have the email kitty.hand@example.net, or don't have a customer address ID of 1 and a cell phone number that isn't 578-518-4785x612 and didn't become a customer on 2017-11-12 04:34:44, but only if their email address is also not asha.kilback@example.org?

SELECT customer_address_id, phone_number, last_name, amount_outstanding, first_name, customer_status_code, customer_id, email_address, date_of_birth, cell_mobile_phone_number, date_became_customer FROM Customers WHERE last_name != "Koelpin" OR email_address != "kitty.hand@example.net" OR "customer_address_id" <> 1 AND cell_mobile_phone_number != "578-518-4785x612" AND date_became_customer != "2017-11-12 04:34:44" INTERSECT SELECT customer_address_id, phone_number, last_name, amount_outstanding, first_name, customer_status_code, customer_id, email_address, date_of_birth, cell_mobile_phone_number, date_became_customer FROM Customers WHERE email_address <> "asha.kilback@example.org"


Question: What is the highest member ID from the member table, considering only members with card number OLB56, or a name other than Myron Pryor, or who are from Fort Campbell, Kentucky, excluding those with level 6 and member ID greater than or equal to 7, except for the highest member ID from the purchase table, considering only purchases where the total pounds is not 20.99, the member ID is not 3, and the year is not 2018?

SELECT MAX(Member_ID) FROM member WHERE Card_Number = "OLB56" OR Name <> "Myron Pryor" OR Hometown = "Fort Campbell, Kentucky" AND "Level" != 6 AND "Member_ID" >= 7 EXCEPT SELECT MAX(Member_ID) FROM purchase WHERE "Total_pounds" <> 20.99 AND "Member_ID" <> 3 AND Year != "2018"


Question: Can you give me a list of driver IDs, including those from the driver table excluding driver ID 4, and those from the school bus table that are less 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: Which aircraft IDs, excluding aircraft ID 4, are also aircraft IDs of at least 5 in the airport aircraft list?

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: Can you list all the aircraft IDs, including aircraft ID 5 from the aircraft table and any aircraft IDs greater than or equal to 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: Can you give me a list of driver IDs that are less than 6 and also not equal to 3, considering driver IDs from both the driver and school bus lists?

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


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

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


Question: Could you list the Aircraft IDs and Airport IDs, grouped by ID, but only for those groups where the total disk area is 497 square feet, or the Airport ID is less than 1 and the maximum gross weight is 50,000 pounds?

SELECT T1.Aircraft_ID, T2.Airport_ID FROM aircraft as T1 JOIN airport_aircraft as T2 ON T1.Aircraft_ID == T2.Aircraft_ID GROUP BY ID HAVING Total_disk_area = "497 ft² (46.2 m²)" OR Airport_ID < 1 AND Max_Gross_Weight = "50,000 lb (22,680 kg)"


Question: Which aircraft have an ID of 2 in the aircraft table, and also have an ID of 2 or less in the airport_aircraft table?

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


Question: Can you list the driver IDs that are less than 6 from the driver table, combined with the driver IDs that are greater than 3 from the school_bus table, removing any duplicates?

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: Can you give me a list of all the driver IDs, combining those from the driver table excluding driver ID 4, and those from the school bus table excluding driver ID 7?

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


Question: Can you list the aircraft IDs that appear in the aircraft table, excluding aircraft ID 5, but only if they don't appear in the airport_aircraft table, excluding aircraft ID 1?

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


Question: Can you give me the aircraft IDs that are less than or equal to 4, excluding those aircraft IDs that are not equal to 3 and are found in the airport aircraft list?

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


Question: What is the smallest model name, excluding "amc" or where the ModelId is not 16, and also the smallest model name where the Maker is not 15 or the ModelId is not 25?

SELECT MIN(Model) FROM model_list WHERE Model != "amc" OR "ModelId" <> 16 UNION ALL SELECT MIN(Model) FROM model_list WHERE "Maker" != 15 OR "ModelId" != 25


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

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


Question: Can you give me a list of driver IDs, excluding driver ID 11, that are not also driver IDs less than or equal to 9 in the school bus table?

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


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

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: Can you give me the student IDs of students who have allergies other than tree pollen and whose ID is not 1029, excluding those who are male students with the last name Epp?

SELECT StuID FROM Has_Allergy WHERE Allergy <> "Tree Pollen" AND "StuID" != 1029 EXCEPT SELECT StuID FROM Student WHERE LName = "Epp" AND Sex = "M"


Question: Can you give me a list of Pet IDs from the Has_Pet table, including those greater than 2002 or where the StuID is greater than or equal to 1002, and also including Pet ID 2002?

SELECT PetID FROM Has_Pet WHERE "PetID" > 2002 OR "StuID" >= 1002 UNION SELECT PetID FROM Has_Pet WHERE "PetID" = 2002


Question: Which driver has an ID of 4 and is also the driver of a school bus with a driver ID of 4 or greater?

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


Question: Can you list the driver IDs from the driver table, but only those less than or equal to 2, combined with the driver IDs from the school bus table that are less than 3, removing any duplicates?

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


Question: Can you give me a list of driver IDs, where each ID is greater than 6, but not also less than 9 and associated with a school bus?

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


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

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


Question: Can you give me a list of all driver IDs, excluding driver ID 5 from the driver table and excluding driver ID 3 from the school_bus table?

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


Question: What is the smallest address ID that is at least 3, and whose address details are not "PT" and also not the smallest address ID with address details not equal to "MX"?

SELECT MIN(address_id) FROM Addresses WHERE "address_id" >= 3 AND address_details != "PT" IN (SELECT MIN(address_id) FROM Addresses WHERE address_details != "MX")


Question: Could you list the school IDs from the budget table where either the year is after 2005, the budget invested percent is 127.6, the total budget percent invested is 2.7, the school ID is not 2, or the budgeted amount is greater than 3666, combined with the school IDs from the endowment table where the endowment ID is not 7 or the amount is not 9.51?

SELECT School_id FROM budget WHERE "Year" > 2005 OR Budget_invested_percent = "127.6" OR "total_budget_percent_invested" = 2.7 OR "School_id" != 2 OR "Budgeted" > 3666 UNION SELECT School_id FROM endowment WHERE "endowment_id" != 7 OR "amount" != 9.51


Question: Can you give me a list of driver IDs that are less than 5 and also appear in the list of school bus driver IDs that are less than 9?

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


Question: Which driver IDs, excluding driver ID 9, are not also driver IDs associated with school buses, excluding 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: Can you give me a list of driver IDs that are greater than or equal to 1, excluding those driver IDs from the school bus table that are less than 4?

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


Question: Could you list the group equity shareholding, name, and incorporation location for all companies, including those that are not joint ventures, or have a group equity shareholding of at least 60%, or whose principal activities are not cargo, or are incorporated in Hong Kong, along with companies that are not subsidiaries, have an ID less than 1, and are not named Dragonair?

Cathay Pacific Catering Services (HK) Limited

100.0
Cathay Pacific Services Limited
Hong Kong

100.0
Hong Kong Airport Services
Hong Kong

100.0
Vogue Laundry Service Limited
Hong Kong

45.0
China Pacific Laundry Services
Taiwan

40.0
VN/CX Catering Services Limited
Vietnam

30.0
CLS Catering Services Limited
Canada

SELECT Group_Equity_Shareholding, name, Incorporated_in FROM operate_company WHERE Type != "Joint Venture" OR "Group_Equity_Shareholding" >= 60.0 OR Principal_activities <> "Cargo" OR Incorporated_in = "Hong Kong" UNION ALL SELECT Group_Equity_Shareholding, name, Incorporated_in FROM operate_company WHERE Type != "Subsidiary" AND "id" < 1 AND name != "Dragonair"


Question: Can you give me a list of driver IDs that are greater than 11 from the driver table, combined with a list of driver IDs that are greater than 3 from the school bus table?

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


Question: Can you list the aircraft IDs that are equal to 5 from the aircraft table, and combine that with a list of aircraft IDs less than 3 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 < 3


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

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


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

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: Can you give me a list of driver IDs that are less than 11, excluding driver ID 4 if it appears in the school bus records?

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


Question: Which driver IDs, other than 4, are present in both the driver list and the school bus list?

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


Question: Can you give me the sex, student ID, major, city code, advisor, first name, and last name of all students who either have a major other than 600, don't live in PEK, have a student ID of 1010 or less, have an advisor ID of 1121 or less, or are at least 16 years old, or whose first name is not Linda and are not male, combined with the sex, student ID, major, city code, advisor, first name, and last name of all students whose first name is not Susan, live in PEK, and whose last name is not Thornton, or whose advisor ID is 5718 or greater, or whose major is 600 or less, or whose student ID is 1010 or less, or who are 20 years old?

Sex StuID Major city_code Advisor Fname LName

SELECT Sex, StuID, Major, city_code, Advisor, Fname, LName FROM Student WHERE "Major" != 600 AND city_code != "PEK" AND "StuID" <= 1010 AND "Advisor" <= 1121 AND "Age" >= 16 OR Fname != "Linda" AND Sex != "M" UNION ALL SELECT Sex, StuID, Major, city_code, Advisor, Fname, LName FROM Student WHERE Fname != "Susan" AND city_code = "PEK" AND LName != "Thornton" AND "Advisor" >= 5718 OR "Major" <= 600 OR "StuID" <= 1010 OR "Age" = 20


Question: Can you list the aircraft IDs that are greater than 4 from the aircraft table, and also list the aircraft IDs that are less than 1 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 < 1


Question: Which driver IDs are greater than or equal to 7, excluding those driver IDs that are not equal to 9 and are also in the school bus table?

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


Question: How many times has each aircraft been to an airport?

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


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

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


Question: What is the highest age and corresponding head ID for heads who were born in California and are 68 years old, or whose department ID is greater than 2, or whose name is Nick Faldo and are temporarily acting?

SELECT MAX(T1.age), T2.head_ID FROM head as T1 JOIN management as T2 ON T1.head_ID = T2.head_ID WHERE born_state = "California" AND age = 68.0 OR department_ID > 2 OR name = "Nick Faldo" AND temporary_acting = "Yes"


Question: What is the sum of shipping agent codes from documents where the receipt number is 34 and the document ID is not 4, or the receipt date is May 31, 1996, at 6:51:58 AM, or the shipping agent code is not SH, but only if it's also the sum of shipping agent codes from shipping agents where the shipping agent code is US or the shipping agent description is not g?

SELECT SUM(shipping_agent_code) FROM Documents WHERE receipt_number = "34" AND "document_id" != 4 OR receipt_date = "1996-05-31 06:51:58" OR shipping_agent_code != "SH" INTERSECT SELECT SUM(shipping_agent_code) FROM Ref_Shipping_Agents WHERE shipping_agent_code = "US" OR shipping_agent_description <> "g"


Question: Which driver IDs are both not equal to 2 and also 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 is the earliest year a coach other than coach ID 1 started coaching since 2013, excluding the earliest year any player other than player ID 10 started playing?

SELECT MIN(Starting_year) FROM player_coach WHERE "Coach_ID" <> 1 AND "Starting_year" >= 2013 EXCEPT SELECT MIN(Starting_year) FROM player_coach WHERE "Player_ID" != 10


Question: Can you give me a list of driver IDs, excluding driver ID 1 from the driver table, combined with a list of driver IDs, excluding driver ID 3 from the school_bus table?

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


Question: Can you give me a list of driver IDs that are less than 11 and also greater than or equal to 10, considering only the driver IDs that appear in both the driver and school bus tables?

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


Question: Can you find the minimum gold, bronze, sum of rank, minimum big silver, and maximum club ID from the match results, first considering only results where small silver is not 4 or where big silver is at most 7 and points are at least 168 and rank is greater than 4, and then combining those with results where points are at most 139 and big silver is not 14 or club ID is not 2 or gold is not 13 and rank is less than 2 or bronze is greater than 9 or small silver is at most 16?

SELECT MIN(Gold), Bronze, SUM(Rank), MIN(Big_Silver), MAX(Club_ID) FROM match_result WHERE "Small_Silver" != 4 OR "Big_Silver" <= 7 AND "Points" >= 168 AND "Rank" > 4 UNION ALL SELECT MIN(Gold), Bronze, SUM(Rank), MIN(Big_Silver), MAX(Club_ID) FROM match_result WHERE "Points" <= 139 AND "Big_Silver" != 14 OR "Club_ID" != 2 OR "Gold" != 13 AND "Rank" < 2 OR "Bronze" > 9 OR "Small_Silver" <= 16


Question: What are the highest mailed-to address ID and document ID, along with the earliest mailing date, from the Documents Mailed table, both when the mailing date is not November 3, 1971, and when the document ID is greater than 24 and the mailing date is not May 22, 1999?

SELECT MAX(mailed_to_address_id), MAX(document_id), MIN(mailing_date) FROM Documents_Mailed WHERE mailing_date <> "1971-11-03 12:32:14" UNION SELECT MAX(mailed_to_address_id), MAX(document_id), MIN(mailing_date) FROM Documents_Mailed WHERE "document_id" > 24 AND mailing_date <> "1999-05-22 23:21:07"


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

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


Question: What is the highest name among people who are either older than 25 or not person number 3, and whose name isn't Brad Lohaus and who graduated from Northeastern, excluding the highest name among people with a person ID less than 3?

SELECT MAX(Name) FROM people WHERE "Age" > 25 OR "People_ID" != 3 AND Name != "Brad Lohaus" AND Graduation_College = "Northeastern" EXCEPT SELECT MAX(Name) FROM people WHERE "People_ID" < 3


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

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


Question: Which aircraft IDs are present in both the aircraft and airport_aircraft tables, considering only those aircraft IDs that are greater than or equal to 2?

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


Question: Can you give me a list of driver IDs, excluding driver ID 6 from the driver table and driver ID 3 from the school_bus table, making sure to remove any duplicates?

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: Can you give me a list of driver IDs, excluding driver ID 11, that are not also driver IDs greater than 4 in the school bus table?

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


Question: Could you give me a list of document IDs, including those from document drafts that don't have draft details marked as "p", and also those from mailed documents that weren't mailed on "1991-05-27 14:17:37"?

SELECT document_id FROM Document_Drafts WHERE draft_details != "p" UNION ALL SELECT document_id FROM Documents_Mailed WHERE mailing_date != "1991-05-27 14:17:37"


Question: Could you give me a list of employee IDs for people who either live in Bath, are at least 32 years old and have an employee ID of 1 or less, or have a name other than Louis Deacon, but excluding anyone who received an evaluation award in a year other than 2016?

SELECT Employee_ID FROM employee WHERE City = "Bath" OR "Age" >= 32 AND "Employee_ID" <= 1 OR Name != "Louis Deacon" EXCEPT SELECT Employee_ID FROM evaluation WHERE Year_awarded <> "2016"


Question: What are the aircraft IDs that are greater than or equal to 3, excluding those aircraft IDs that are less than or equal to 3 and are also associated with airports?

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


Question: Can you give me a list of driver IDs, excluding driver ID 12, from the driver table, but then remove any driver IDs that are also driver ID 4 in the school bus table?

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


Question: Could you give me a list of member IDs, including those from members whose name isn't Ventrell Jenkins and whose level is 6 or higher, along with those from purchases where the member ID is greater than 1, the year isn't 2018, the total pounds isn't 232.09, or the branch ID isn't 2?

SELECT Member_ID FROM member WHERE Name != "Ventrell Jenkins" AND "Level" >= 6 UNION ALL SELECT Member_ID FROM purchase WHERE "Member_ID" > 1 AND Year != "2018" OR "Total_pounds" <> 232.09 OR Branch_ID != "2"


Question: Which club IDs and positions are held by members who either have a student ID less than 1007 or are not Vice-President, and also either have a student ID not equal to 1007, or a club ID greater than or equal to 2, or are not President?

SELECT ClubID, Position FROM Member_of_club WHERE "StuID" < 1007 OR Position != "Vice-President" INTERSECT SELECT ClubID, Position FROM Member_of_club WHERE "StuID" <> 1007 OR "ClubID" >= 2 OR Position <> "President"


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


Question: Can you list the aircraft IDs that are either aircraft ID 3 from the aircraft table or 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 = 3 UNION SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID >= 2


Question: Can you give me a list of driver IDs, up to and including 6, that are not also driver ID 3?

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


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

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


Question: How many aircraft meet these conditions: either their description isn't "Light utility helicopter" or their total disk area isn't "497 ft² (46.2 m²)", and their aircraft type isn't "Robinson R-22", and their max disk loading isn't "14.5 lb/ft² (71 kg/m²)", or their max gross weight is "73,500 lb (33,300 kg)" and their Aircraft ID is greater than 4, but only counting those that also have an Aircraft ID less than or equal to 5 in the airport aircraft table?

SELECT COUNT(Aircraft_ID) FROM aircraft WHERE Description <> "Light utility helicopter" OR Total_disk_area != "497 ft² (46.2 m²)" AND Aircraft <> "Robinson R-22" AND Max_disk_Loading <> "14.5 lb/ft² (71 kg/m²)" OR Max_Gross_Weight = "73,500 lb (33,300 kg)" AND "Aircraft_ID" > 4 INTERSECT SELECT COUNT(Aircraft_ID) FROM airport_aircraft WHERE "Aircraft_ID" <= 5


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

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


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

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


Question: Can you list the aircraft IDs from the aircraft table that are less than or equal to 4, and also list the aircraft IDs from the airport_aircraft table that are not equal to 3?

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


Question: Can you give me a list of aircraft IDs from the aircraft table, excluding aircraft ID 3, but only if those IDs are not also in the airport_aircraft table where the aircraft ID is greater than or equal to 1?

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


Question: What is the average draft number for document 20, excluding the average draft numbers for documents with IDs greater than 12?

SELECT AVG(draft_number) FROM Document_Drafts WHERE "document_id" = 20 EXCEPT SELECT AVG(draft_number) FROM Draft_Copies WHERE "document_id" > 12


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

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: Could you give me the member IDs of members who either live in Simpsonville, South Carolina, have a card number other than LE99, have a member ID of 5 or greater, or are not named Braxton Kelley, but only if those members also made purchases where the total pounds purchased was not 430.29 or the purchase year was not 2017?

SELECT Member_ID FROM member WHERE Hometown = "Simpsonville, South Carolina" OR Card_Number <> "LE99" OR "Member_ID" >= 5 OR Name <> "Braxton Kelley" INTERSECT SELECT Member_ID FROM purchase WHERE "Total_pounds" <> 430.29 OR Year <> "2017"


Question: Can you list the document ID, draft number, and employee ID from the circulation history for documents with an ID of 20 or less and employees with an ID of 2 or less, combined with a list of the same information for circulation history entries where either the copy number isn't 4 and the document ID isn't 10, or the employee ID isn't 1 and the draft number isn't 17?

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


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

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


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

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


Question: Can you list all car models that are either a "cadillac" with a MakeId of 169 or greater, or a "toyota corolla", except for those models made by Maker 4?

SELECT Model FROM car_names WHERE Model = "cadillac" AND "MakeId" >= 169 OR Make = "toyota corolla" EXCEPT SELECT Model FROM model_list WHERE "Maker" <> 4


Question: Which aircraft IDs, excluding ID 4, appear in the aircraft table and are also less than ID 2 in the airport_aircraft table?

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


Question: Can you list all the feature names from the Other_Available_Features table, including those with a description of "Burglar Alarm", those that aren't named "BurglarAlarm" and have a feature ID greater than 2, those with a feature type code that isn't "Security", and also all feature names where the description is not "Burglar Alarm"?

SELECT feature_name FROM Other_Available_Features WHERE feature_description = "Burglar Alarm" OR feature_name <> "BurglarAlarm" AND "feature_id" > 2 OR feature_type_code != "Security" UNION ALL SELECT feature_name FROM Other_Available_Features WHERE feature_description != "Burglar Alarm"


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

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


Question: Can you give me a list of driver IDs, excluding driver ID 12, that are not also driver IDs, excluding driver ID 10, found 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 != 10


Question: Can you give me a list of item IDs, including those that are 6 or greater, and also those that don't have the title "apple"?

SELECT i_id FROM item WHERE "i_id" >= 6 UNION ALL SELECT i_id FROM item WHERE title <> "apple"


Question: Can you give me the name, ranking, creation date, number of employees, budget, and department ID for departments that meet two sets of criteria: first, they're either named "Transportation" or have a department ID of 2 or greater, a budget not equal to 59.7 billion, a creation date other than 1966, no more than 115,897 employees, and a ranking of 4 or less; and second, they have at least 17,347 employees, a department ID of 2, a ranking of 14 or less, or a name other than "Justice"?

SELECT Name, Ranking, Creation, Num_Employees, Budget_in_Billions, Department_ID FROM department WHERE Name = "Transportation" OR "Department_ID" >= 2 AND "Budget_in_Billions" != 59.7 AND Creation <> "1966" AND "Num_Employees" <= 115897.0 AND "Ranking" <= 4 INTERSECT SELECT Name, Ranking, Creation, Num_Employees, Budget_in_Billions, Department_ID FROM department WHERE "Num_Employees" >= 17347.0 AND "Department_ID" = 2 OR "Ranking" <= 14 OR Name != "Justice"


Question: What are the average branch ID and lowest member ID for members registered in 2016, excluding member ID 6, minus the average branch ID and lowest member ID from purchases made in years other than 2018 where the total pounds spent was no more than 343.76?

SELECT AVG(Branch_ID), MIN(Member_ID) FROM membership_register_branch WHERE "Member_ID" != 6 AND Register_Year = "2016" EXCEPT SELECT AVG(Branch_ID), MIN(Member_ID) FROM purchase WHERE Year <> "2018" AND "Total_pounds" <= 343.76


Question: Can you list all the aircraft IDs that are either equal to 5 in the aircraft table, or less than or equal to 1 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 <= 1


Question: Can you list all the aircraft IDs, excluding aircraft ID 2, and combine that with a list of all aircraft IDs from the airport aircraft, excluding aircraft ID 5?

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


Question: Can you give me a list of customer IDs from payments where either the payment amount isn't $6782.84 or the customer ID isn't 6, but exclude any customer IDs from lessons where the lesson date isn't March 5, 2018 at 6:05:31 PM, the vehicle ID isn't 2, the lesson ID isn't less than 5, the staff ID isn't greater than or equal to 8, or the lesson status is not completed?

SELECT customer_id FROM Customer_Payments WHERE "amount_payment" != 6782.84 OR "customer_id" != 6 EXCEPT SELECT customer_id FROM Lessons WHERE lesson_date <> "2018-03-05 18:05:31" OR "vehicle_id" != 2 OR "lesson_id" < 5 OR "staff_id" >= 8 OR lesson_status_code = "Completed"


Question: Can you give me a list of driver IDs that are both less than or equal to 9 and also greater than or equal to 3, considering only the unique driver IDs from 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: Which driver IDs are greater than 2 and also not equal to 10, considering only unique driver IDs from both the driver and school bus lists?

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: Can you give me the smallest aircraft ID and corresponding airport ID for each maximum gross weight, excluding airport ID 9, but only for those where the description is "Tandem rotor helicopter", the aircraft isn't "CH-47D Chinook", or the airport ID is less than 9, and the max disk loading isn't "14.5 lb/ft² (71 kg/m²)"?

SELECT MIN(T1.Aircraft_ID), T2.Airport_ID FROM aircraft as T1 JOIN airport_aircraft as T2 ON T1.Aircraft_ID = T2.Aircraft_ID WHERE "Airport_ID" <> 9 GROUP BY Max_Gross_Weight HAVING Description = "Tandem rotor helicopter" AND Aircraft <> "CH-47D Chinook" AND Max_disk_Loading <> "14.5 lb/ft² (71 kg/m²)" OR Airport_ID < 9


Question: Which driver IDs are greater than 2 and also greater than or equal to 4 in the school bus records?

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


Question: Can you give me the total number of issues, the sum of the titles, and the writer for books where either the writer isn't Dave Gibbons, or the title is Bloody Mary, the number of issues isn't 6, and the book ID isn't 2, combined with the total number of issues, the sum of the titles, and the writer for books where either the title isn't The Dome: Ground Zero, or the number of issues isn't 4, and the writer is Garth Ennis?

SELECT SUM(Issues), SUM(Title), Writer FROM book WHERE Writer <> "Dave Gibbons" OR Title = "Bloody Mary" AND "Issues" != 6.0 AND "Book_ID" != 2 UNION SELECT SUM(Issues), SUM(Title), Writer FROM book WHERE Title != "The Dome: Ground Zero" OR "Issues" <> 4.0 AND Writer = "Garth Ennis"


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

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


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

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


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

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: What is the smallest continent name when the continent is Australia and the ContId is less than 3, and also, what is the smallest continent name when the ContId is 5?

SELECT MIN(Continent) FROM continents WHERE Continent = "australia" AND "ContId" < 3 UNION ALL SELECT MIN(Continent) FROM continents WHERE "ContId" = 5


Question: Can you give me a list of driver IDs from the driver table that are greater than or equal to 7, excluding those driver IDs from the school_bus table that are not equal to 9?

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


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


Question: Could you list the names and budgets in billions for departments that are ranked 8 or lower, have a budget less than 21.5 billion, a department ID less than 7, and fewer than 115,897 employees, but exclude any departments with more than 116,100 employees?

SELECT Name, Budget_in_Billions FROM department WHERE "Ranking" <= 8 AND "Budget_in_Billions" < 21.5 AND "Department_ID" < 7 AND "Num_Employees" < 115897.0 EXCEPT SELECT Name, Budget_in_Billions FROM department WHERE "Num_Employees" > 116100.0


Question: Can you give me the IDs of drivers with IDs up to 12, excluding those drivers with IDs up to 9 who are also school bus drivers?

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


Question: Can you give me the amount, donator name, and school ID for endowments that meet these two conditions: first, the amount isn't 8.99 or the endowment ID isn't 7 and the school ID is 4; and second, the amount isn't 9.51 and the school ID is 3, or the endowment ID is 4?

SELECT amount, donator_name, School_id FROM endowment WHERE "amount" <> 8.99 OR "endowment_id" != 7 AND "School_id" = 4 INTERSECT SELECT amount, donator_name, School_id FROM endowment WHERE "amount" != 9.51 AND "School_id" = 3 OR "endowment_id" = 4


Question: Can you give me the address details and IDs for addresses with IDs less than 9 that also have IDs greater than or equal to 6?

SELECT address_details, address_id FROM Addresses WHERE "address_id" < 9 INTERSECT SELECT address_details, address_id FROM Addresses WHERE "address_id" >= 6


Question: Can you list the employee IDs and cities for all employees who either live in Bristol and are named Jason Hobson and have an employee ID that is not 1 or are 23 years old, along with the employee IDs and cities for all employees who are not named Jason Hobson?

SELECT Employee_ID, City FROM employee WHERE City = "Bristol" AND Name = "Jason Hobson" AND "Employee_ID" != 1 OR "Age" = 23 UNION ALL SELECT Employee_ID, City FROM employee WHERE Name <> "Jason Hobson"


Question: Which customer IDs are associated with direct debit payments made at times other than 2018-03-12 08:41:47, and also belong to customers who either have an amount outstanding greater than 3751.0 and were born on 1995-07-17 12:13:16, have a "Good Customer" status, became a customer on a date other than 2015-06-24 03:50:04, and have the email address mariela28@example.org, and whose customer address ID is less than or equal to 10, or whose last name is not Sanford and whose cell phone number is not 578-518-4785x612, or whose customer ID is less than 9 and whose first name is not Estelle?

SELECT customer_id FROM Customer_Payments WHERE datetime_payment != "2018-03-12 08:41:47" AND payment_method_code = "Direct Debit" INTERSECT SELECT customer_id FROM Customers WHERE "amount_outstanding" > 3751.0 AND date_of_birth = "1995-07-17 12:13:16" AND customer_status_code = "Good Customer" AND date_became_customer != "2015-06-24 03:50:04" AND email_address = "mariela28@example.org" AND "customer_address_id" <= 10 OR last_name <> "Sanford" AND cell_mobile_phone_number != "578-518-4785x612" OR "customer_id" < 9 AND first_name != "Estelle"


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

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


Question: Can you give me a list of driver IDs, including 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 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID = 4


Question: Can you give me a list of all Driver IDs, including those from the driver table where the ID is 1 or greater, and those from the school_bus table where the ID is not 7?

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


Question: Can you give me a list of aircraft IDs, including aircraft ID 5 from the aircraft table and aircraft ID 3 from the airport_aircraft table?

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


Question: Can you give me a list of aircraft IDs that are less than 3, and also appear in the list of aircraft IDs from the airport, excluding aircraft ID 1?

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


Question: Which driver IDs are not equal to 3 and are also not equal to 9?

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: Can you list the Aircraft IDs that are greater than 5 from the aircraft table, and combine that with a list of Aircraft IDs that are not equal to 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: Can you give me a list of driver IDs, including those from the driver table that are 10 or less, and those from the school_bus table that are greater than 10?

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


Question: Can you list all the aircraft IDs, first those from the aircraft table excluding ID 5, and then those from the airport_aircraft table that are less than 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: Which aircraft IDs, excluding aircraft ID 1, are also among the aircraft IDs less than or equal to 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: Can you give me a list of driver IDs, including those from the driver table that are less than 10, and those from the school bus table that are not equal to 3?

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: Can you give me a list of driver IDs, including those from the driver table excluding driver ID 6, and those from the school bus table with driver IDs of 3 or higher?

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: Can you give me a list of people IDs, including those who are Russian and at least 182 cm tall, as well as poker players with an ID of 1 or higher who have made fewer than 26 final tables?

SELECT People_ID FROM people WHERE Nationality = "Russia" AND "Height" >= 182.0 UNION SELECT People_ID FROM poker_player WHERE "People_ID" >= 1 AND "Final_Table_Made" < 26.0


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

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


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

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


Question: Can you give me a list of driver IDs that are both greater than or equal to 1 and not equal to 7, considering drivers from both the driver and school bus lists?

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


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

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


Question: Can you list the country and full name of all car makers with an ID less than 16, combined with the country and full name of car makers that are either Volkswagen, BMW, not from country code 3, or have an ID that is not 17?

SELECT Country, FullName FROM car_makers WHERE "Id" < 16 UNION ALL SELECT Country, FullName FROM car_makers WHERE Maker = "volkswagen" OR FullName = "BMW" OR Country <> "3" OR "Id" != 17


Question: Which aircraft IDs, excluding aircraft ID 4, are also aircraft IDs, excluding aircraft ID 1, found in the airport aircraft list?

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


Question: What is the total of all contestant numbers excluding contestant number 10, combined with the total of all contestant numbers from the votes table excluding contestant number 3?

SELECT SUM(contestant_number) FROM CONTESTANTS WHERE "contestant_number" <> 10 UNION SELECT SUM(contestant_number) FROM VOTES WHERE "contestant_number" <> 3


Question: Can you give me a list of aircraft IDs, including those that appear with an ID of 3 in the aircraft table and those that appear with an ID of 5 in the airport_aircraft table?

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


Question: Can you give me the IDs of drivers who have an ID less than 4 and also drive a school bus, but whose ID is not equal to 4?

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


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

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


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

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


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

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


Question: Could you list the store IDs that are not 1 and are in districts with an ID less than 15, combined with the store IDs that are 1 but have products that are not product 6?

SELECT Store_ID FROM store_district WHERE "Store_ID" != 1 AND "District_ID" < 15 UNION SELECT Store_ID FROM store_product WHERE "Store_ID" = 1 AND "Product_ID" != 6


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

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


Question: Can you give me a list of driver IDs that are greater than 11, excluding any driver IDs from the school bus list that aren't 10?

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


Question: Could you give me the IDs that are both in albums that don't have the title "Kill 'Em All" or don't have an ID of 164 or have an artist ID less than or equal to 240, and also in playlists named "Music Videos"?

SELECT id FROM albums WHERE title != "Kill 'Em All" OR "id" <> 164 OR "artist_id" <= 240 INTERSECT SELECT id FROM playlists WHERE name = "Music Videos"


Question: What is the highest book ID from the book table where the writer is not Howard Chaykin or the number of issues is not 12, combined with the highest book ID from the publication table where the publication ID is greater than 2?

SELECT MAX(Book_ID) FROM book WHERE Writer <> "Howard Chaykin" OR "Issues" != 12.0 UNION ALL SELECT MAX(Book_ID) FROM publication WHERE "Publication_ID" > 2


Question: What is the highest vehicle detail, excluding "Van", minus the highest vehicle detail when excluding vehicle ID 3?

SELECT MAX(vehicle_details) FROM Vehicles WHERE vehicle_details != "Van" EXCEPT SELECT MAX(vehicle_details) FROM Vehicles WHERE "vehicle_id" != 3


Question: Can you list all feature type codes and names, including those that are not "Security" and also those that are not "Amenity"?

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


Question: Which driver has an ID of 4 and also drives a school bus, but not school bus number 10?

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


Question: Could you list the Club IDs of coaches who are not female, have a rank of 4 or less, and are not named Smith Brown, excluding the Club IDs from match results where Bronze is not 8 and the rank is greater than 6, or where Big Silver is not 14, points are at least 89, and Gold is at least 7?

SELECT Club_ID FROM coach WHERE Gender <> "F" AND "Rank" <= 4 AND Coach_name <> "Smith Brown" EXCEPT SELECT Club_ID FROM match_result WHERE "Bronze" != 8 AND "Rank" > 6 OR "Big_Silver" != 14 AND "Points" >= 89 AND "Gold" >= 7


Question: Can you give me a list of driver IDs, including those less than 9 from the driver list and those greater than 7 from the school bus list?

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


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

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


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

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


Question: Can you give me the names and employee IDs of employees who either don't make $18,050 or aren't named William Jones, but only if they also aren't named Barbara Wilson and don't make $44,740?

SELECT name, eid FROM employee WHERE "salary" != 18050 OR name <> "William Jones" INTERSECT SELECT name, eid FROM employee WHERE name != "Barbara Wilson" AND "salary" <> 44740


Question: Which driver IDs are both less than 8 and present in the driver table, and also less than or equal to 10 and present 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: For each aircraft, what is the total number of IDs associated with it in the airport aircraft table?

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


Question: What are the allergy types that are either "Shellfish" or "Soy"?

SELECT Allergy FROM Allergy_Type WHERE Allergy = "Shellfish" UNION SELECT Allergy FROM Allergy_Type WHERE Allergy = "Soy"


Question: Can you give me a list of aircraft IDs that are less than 2 and appear in the aircraft table, and are also less than 5 and appear 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: Can you list the aircraft IDs that are greater than or equal to 4, excluding those aircraft IDs that are not equal to 5 and are found 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 != 5