Question: Can you give me a list of Member IDs from the member table, including those who don't live in Red Jacket, West Virginia, or are named Matt Lentz with a Member ID less than 7 and a Level of 6 or lower, or have a Card Number that isn't LCB7, combined with a list of Member IDs from the purchase table where the Year isn't 2018 or the Branch ID isn't 6?

SELECT Member_ID FROM member WHERE Hometown != "Red Jacket, West Virginia" OR Name = "Matt Lentz" AND "Member_ID" < 7 AND "Level" <= 6 OR Card_Number != "LCB7" UNION ALL SELECT Member_ID FROM purchase WHERE Year <> "2018" OR Branch_ID != "6"


Question: Can you list the aircraft IDs, excluding aircraft ID 5, that appear in the aircraft table but not in the airport_aircraft table where the aircraft ID is 3?

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


Question: Can you give me a list of driver IDs, excluding driver ID 11, that are not also driver IDs greater than or equal to 7 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 >= 7


Question: Can you list the number of issues for books where the Book ID is greater than 3 and the title isn't "Gemini Blood", or where the number of issues is less than or equal to 9, excluding the number of issues for books where the title isn't "Michael Moorcock's Multiverse" and either the Book ID is greater than 6 and the number of issues is less than or equal to 4, or the writer isn't "Garth Ennis"?

SELECT Issues FROM book WHERE "Book_ID" > 3 AND Title <> "Gemini Blood" OR "Issues" <= 9.0 NOT IN (SELECT Issues FROM book WHERE Title <> "Michael Moorcock's Multiverse" AND "Book_ID" > 6 AND "Issues" <= 4.0 OR Writer != "Garth Ennis")


Question: Can you show me the genders and ranks of coaches, including those who aren't named Jameson Tomas and have a Coach ID greater than 3, or whose rank isn't 1, or whose gender isn't male and have a Club ID of 3 or more, combined with the genders and ranks of players who aren't students, aren't female, and don't have Selkirk—Interlake as a sponsor, and don't live in Birtle, or have a different number of votes than 5502, or have a rank of 2nd, or have a Player ID other than 3, or are named Judy Wasylycia-Leis?

SELECT Gender, Rank FROM coach WHERE Coach_name != "Jameson Tomas" AND "Coach_ID" > 3 OR "Rank" != 1 OR Gender != "M" AND "Club_ID" >= 3 UNION ALL SELECT Gender, Rank FROM player WHERE Occupation <> "Student" AND Gender <> "F" AND Sponsor_name != "Selkirk—Interlake" AND Residence <> "Birtle" OR "Votes" <> 5502 OR Rank = "2nd" OR "Player_ID" <> 3 OR Player_name = "Judy Wasylycia-Leis"


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


Question: Can you list the driver IDs that are less than 5 from the driver table, and combine that 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 < 5 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 10


Question: Could you list the document IDs from the Documents_Mailed table where the document ID is not 13, or the mailed-to address ID is greater than 8 and the mailing date is May 24, 1993 at 10:13 PM, combined with the document IDs from the Draft_Copies table where the draft number is not 20?

SELECT document_id FROM Documents_Mailed WHERE "document_id" <> 13 OR "mailed_to_address_id" > 8 AND mailing_date = "1993-05-24 22:13:48" UNION SELECT document_id FROM Draft_Copies WHERE "draft_number" <> 20


Question: Can you list the aircraft IDs that are less than or equal to 4, excluding those aircraft IDs that appear in the airport aircraft list, unless that ID is 5?

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


Question: Can you give me the Country, Id, Maker, and FullName of all car makers, excluding those with an Id greater than 7 and a Maker that isn't Volvo, but only including those where the Country isn't "1" or the FullName isn't "Nissan Motors"?

SELECT Country, Id, Maker, FullName FROM car_makers WHERE Country != "1" OR FullName != "Nissan Motors" EXCEPT SELECT Country, Id, Maker, FullName FROM car_makers WHERE "Id" > 7 AND Maker <> "volvo"


Question: Can you list all the aircraft IDs, excluding aircraft ID 3 from the aircraft table, combined with all aircraft IDs, excluding aircraft ID 1 from the airport_aircraft table?

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


Question: Could you give me the names, ages, IDs, and graduation colleges of people who either have an ID of 7 or higher, are from the United Kingdom, or are younger than 37, but only if they also have an ID lower than 4 or are at least 27 years old?

SELECT Name, Age, People_ID, Graduation_College FROM people WHERE "People_ID" >= 7 OR Nationality = "United Kindom" OR "Age" < 37 INTERSECT SELECT Name, Age, People_ID, Graduation_College FROM people WHERE "People_ID" < 4 OR "Age" >= 27


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


Question: Can you give me a list of employee IDs from the circulation history where either the draft number isn't 2, or the document ID isn't 10 and the employee ID is 2 or greater, combined with a list of employee IDs from the employees table where the employee's name is Kenyon and their other details are "v"?

SELECT employee_id FROM Circulation_History WHERE "draft_number" != 2 OR "document_id" != 10 AND "employee_id" >= 2 UNION ALL SELECT employee_id FROM Employees WHERE employee_name = "Kenyon" AND other_details = "v"


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 of 9 or higher?

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 driver ID that appears exactly once as 10 in the driver table but does not appear as a driver ID greater than 10 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 > 10


Question: Which aircraft IDs, excluding aircraft ID 2, are also aircraft IDs less than 3 that 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 < 3


Question: Can you give me the city population, district name, headquartered city, district ID, and city area for districts that either have a District ID other than 4 and a city area greater than 15, or are headquartered in Kasur City, but only if they also have a district name of Khanewal District or a city population of at least 464742?

SELECT City_Population, District_name, Headquartered_City, District_ID, City_Area FROM district WHERE "District_ID" != 4 AND "City_Area" > 15.0 OR Headquartered_City = "Kasur City" INTERSECT SELECT City_Population, District_name, Headquartered_City, District_ID, City_Area FROM district WHERE District_name = "Khanewal District" OR "City_Population" >= 464742.0


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

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


Question: Can you give me a list of driver IDs that are less than 12, but exclude any driver IDs less than 10 that 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 < 10


Question: Can you give me a list of driver IDs that are greater than 6 from the driver table, excluding those 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 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 7


Question: Which driver IDs are greater than 4 and also not equal to 3, 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 > 4 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID <> 3


Question: Can you give me a list of aircraft IDs that appear in the aircraft table, excluding aircraft ID 4, but then remove any aircraft IDs that also appear in the airport_aircraft table and are greater than 1?

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


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

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


Question: Can you give me a list of driver IDs, combining those from the driver table excluding driver ID 7, and those from the school bus table excluding driver ID 9?

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


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


Question: How many payments were made and what are the mobile phone numbers of customers, considering only payments not made via direct debit on February 6, 2018, at 1:35 PM for good customers with phone numbers other than (662)490-3108, or payments of 1708.18, or customers who became customers on October 5, 2017, at 2:15 PM and were born on September 18, 1998, at 4:45 AM, or have an outstanding amount of at least 9332.0, or have the email address kroberts@example.org?

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


Question: Can you give me a list of all the driver IDs, excluding driver ID 9 from the driver table and excluding driver ID 7 from the school bus table, making sure there are no duplicates?

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, combining those from the driver table excluding driver ID 5, with those from the school bus table that are 10 or higher?

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


Question: Could you give me a list of album IDs for albums that aren't titled "The Doors", combined with a list of playlist IDs that are greater than 16 and don't have the name "On-The-Go 1"?

SELECT id FROM albums WHERE title <> "The Doors" UNION SELECT id FROM playlists WHERE "id" > 16 AND name != "On-The-Go 1"


Question: Can you list the aircraft IDs, including those from the aircraft table that are greater than or equal to 2, and those from the airport_aircraft table that are less than 2?

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


Question: Could you list the car models from the car names table where the make is not "toyota corona liftback", or where the "MakeId" is 25 and the model is not "ford", but exclude any models that are in the model list table where the "ModelId" is greater than 18, the "Maker" is 2, or the model is "peugeot"?

SELECT Model FROM car_names WHERE Make <> "toyota corona liftback" OR "MakeId" = 25 AND Model != "ford" EXCEPT SELECT Model FROM model_list WHERE "ModelId" > 18 OR "Maker" = 2 OR Model = "peugeot"


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

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 store IDs for stores named "Miramichi" that either don't have 793 product categories or don't have an area size of 26.69, along with the store IDs that are associated with products other than product ID 3?

SELECT Store_ID FROM store WHERE Store_Name = "Miramichi" AND "Number_of_product_category" <> 793.0 OR "Area_size" != 26.69 UNION SELECT Store_ID FROM store_product WHERE "Product_ID" <> 3


Question: Could you give me the school IDs for schools that either don't have an IHSAA football class of AAA, are named Triton, or don't have Cougars as their mascot, combined with the school IDs from the budget table where the school ID is less than 2, the budgeted amount is less than or equal to 3666, the total budget percent invested is greater than or equal to 2.2, the invested amount is greater than or equal to 8335, the budget invested percent is 122.5, the year is not 2001, or the total budget percent budgeted is less than 2.0?

SELECT School_id FROM School WHERE IHSAA_Football_Class != "AAA" OR School_name = "Triton" OR Mascot <> "Cougars" UNION SELECT School_id FROM budget WHERE "School_id" < 2 OR "Budgeted" <= 3666 OR "total_budget_percent_invested" >= 2.2 OR "Invested" >= 8335 OR Budget_invested_percent = "122.5" OR "Year" != 2001 OR "total_budget_percent_budgeted" < 2.0


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

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: Which driver IDs, other than driver ID 1, are also driver ID 3 in the school bus list?

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


Question: Can you give me a list of aircraft IDs, excluding aircraft ID 4, that are in the aircraft table but not in the airport_aircraft table, where the aircraft IDs in the airport_aircraft table are less than 1?

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


Question: Can you give me a list of driver IDs from the driver table that are less than or equal to 1, combined with a list of driver IDs from the school_bus table that are exactly 10?

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


Question: Can you give me the names and numbers of all contestants with numbers 10 or less, along with the name and number of any contestant named Jessie Alloway who has a number of 3 or greater?

SELECT contestant_name, contestant_number FROM CONTESTANTS WHERE "contestant_number" <= 10 UNION SELECT contestant_name, contestant_number FROM CONTESTANTS WHERE "contestant_number" >= 3 AND contestant_name = "Jessie Alloway"


Question: Can you show me the paragraph text, the earliest other details, the document ID, and the earliest paragraph ID from the paragraphs table, combining results where either the paragraph ID is greater than 9946, the document ID is less than or equal to 80, the paragraph text is "UK", or the other details are not "None", with results where the other details are "None"?

SELECT Paragraph_Text, MIN(Other_Details), Document_ID, MIN(Paragraph_ID) FROM Paragraphs WHERE "Paragraph_ID" > 9946 OR "Document_ID" <= 80 OR Paragraph_Text = "UK" OR Other_Details <> "None" UNION ALL SELECT Paragraph_Text, MIN(Other_Details), Document_ID, MIN(Paragraph_ID) FROM Paragraphs WHERE Other_Details = "None"


Question: Which driver has an ID of 3 and also has an ID less than or equal to 10?

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


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

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: Could you give me the School IDs for schools that are either "Columbia University" kindergartens with a School ID less than 2, or are private schools, or are not located in Jakarta, Indonesia, but excluding any School IDs that also appear in the school bus table with a Driver ID that is not 4?

SELECT School_ID FROM school WHERE School = "Columbia University" AND Grade = "Kindergarten" AND "School_ID" < 2 OR Type = "Private" OR Location <> "Jakarta, Indonesia" EXCEPT SELECT School_ID FROM school_bus WHERE "Driver_ID" != 4


Question: Could you give me a list of Book IDs from the book table where the number of issues is not 12, excluding any Book IDs that also appear in the publication table where the publication date is not in October 2005 and the price is not 15,000,000?

SELECT Book_ID FROM book WHERE "Issues" <> 12.0 EXCEPT SELECT Book_ID FROM publication WHERE Publication_Date <> "October 2005" AND "Price" != 15000000.0


Question: Can you give me a list of all Driver IDs, excluding Driver ID 9 from the driver table and Driver ID 3 from the school_bus table, making sure there are no duplicates in the final 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 <> 3


Question: Can you list the aircraft IDs, first from the aircraft table excluding aircraft ID 5, and then from the airport_aircraft table including only aircraft IDs up to 5?

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


Question: Which aircraft IDs are both greater than 1 when grouped in the aircraft table and equal to 3 when grouped in the airport_aircraft table?

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


Question: Can you list all the aircraft IDs, including those from the aircraft table that are not equal to 5, and those from the airport_aircraft table that are equal to 5?

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


Question: Can you list the rank and club ID for coaches, excluding James Wong, or those with a rank less than 3 who are not female and have a coach ID other than 4, except for those entries from match results where the club ID isn't 4, or the rank is greater than 5, or the bronze is at least 8 while the small silver is 16, the points are 84, and the gold isn't 5?

SELECT Rank, Club_ID FROM coach WHERE Coach_name != "James Wong" OR "Rank" < 3 AND Gender != "F" AND "Coach_ID" != 4 EXCEPT SELECT Rank, Club_ID FROM match_result WHERE "Club_ID" != 4 OR "Rank" > 5 OR "Bronze" >= 8 AND "Small_Silver" = 16 AND "Points" = 84 AND "Gold" != 5


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


Question: Could you list all the feature type names, including those with the feature type code "Security", but excluding any named "Amenity, eg Pool."?

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


Question: Can you give me the IDs of drivers with IDs less than or equal to 2, excluding those drivers whose IDs are not equal to 3 from the school bus list?

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


Question: Can you give me a list of driver IDs less than or equal to 8, excluding any driver IDs less than 9 that are also 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 give me a list of driver IDs that are both less than or equal to 4 and not equal to 3, 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 <= 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 greater than 11 from the driver table, combined with a list of driver IDs that are greater than 4 from the school bus table?

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


Question: Can you give me a list of driver IDs that are not 12 and are also greater than 9, considering only drivers who appear in both the driver and school bus tables?

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


Question: Can you give me a list of Club IDs, including those from clubs that aren't named "Bootup Baltimore", along with Club IDs from the Member_of_club table where the position isn't "Vice-President", the Club ID is less than or equal to 2, and the Student ID is less than 1010?

SELECT ClubID FROM Club WHERE ClubName <> "Bootup Baltimore" UNION ALL SELECT ClubID FROM Member_of_club WHERE Position <> "Vice-President" AND "ClubID" <= 2 AND "StuID" < 1010


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

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


Question: Can you give me the Driver IDs that are both less than or equal to 12 in the driver table and equal to 9 in the school_bus table?

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


Question: Can you give me a list of driver IDs, excluding driver ID 8, that are not also driver IDs less than or equal to 3 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 <= 3


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

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


Question: Can you give me a list of driver IDs that are less than 10, excluding the driver ID 4 if it's on the school bus driver list?

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, first from the driver table excluding driver ID 7, and then from the school bus table including only driver IDs less than 7, making sure to remove any duplicates?

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


Question: Can you give me a list of store IDs that either belong to a district with an ID of 4 or higher, or have a store ID less than 4, and also include the store IDs that sell product number 1?

SELECT Store_ID FROM store_district WHERE "District_ID" >= 4 OR "Store_ID" < 4 UNION ALL SELECT Store_ID FROM store_product WHERE "Product_ID" = 1


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

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


Question: Can you give me a list of driver IDs that are less than 10 and also not equal to 3, considering all driver IDs in both the driver and school bus records?

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


Question: Can you list the aircraft IDs that are less than or equal to 5 from the aircraft table, and also list the aircraft IDs that are greater than 3 from the airport_aircraft table, combining both lists into one?

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, including those from the driver table that are not 12, and those from the school bus table that are 7 or less?

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 list the Branch ID, Member ID, and Year for all purchases made in years other than 2018 where the Member ID is less than 2, combined with a list of Branch ID, Member ID, and Year for all purchases where the Member ID is 6 or greater, or the total pounds purchased is 232.09 or greater and the year is not 2018, or the Branch ID is not 5?

SELECT Branch_ID, Member_ID, Year FROM purchase WHERE Year <> "2018" AND "Member_ID" < 2 UNION ALL SELECT Branch_ID, Member_ID, Year FROM purchase WHERE "Member_ID" >= 6 OR "Total_pounds" >= 232.09 AND Year != "2018" OR Branch_ID != "5"


Question: Can you give me a list of driver IDs, excluding driver ID 10, that appear in the driver table but not in the school_bus table, where driver ID 7 is also excluded from the school_bus table?

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


Question: Which driver IDs are both less than or equal to 3 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 <= 3 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 from the driver table that are greater than or equal to 1, excluding any driver IDs from the school_bus table that are greater than or equal to 7?

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


Question: Can you show me the city population, district name, and smallest city area for districts where either the district name isn't Faisalabad District, or the city area is less than 75, or the headquartered city is Chakwal City, or the city population isn't 172073, combined with the city population, district name, and smallest city area for districts where the headquartered city is Khanewal City and the city area is greater than 147, or the district name isn't Hafizabad District?

SELECT City_Population, District_name, MIN(City_Area) FROM district WHERE District_name != "Faisalabad District" OR "City_Area" < 75.0 OR Headquartered_City = "Chakwal City" OR "City_Population" != 172073.0 UNION ALL SELECT City_Population, District_name, MIN(City_Area) FROM district WHERE Headquartered_City = "Khanewal City" AND "City_Area" > 147.0 OR District_name <> "Hafizabad District"


Question: Can you give me the driver ID that appears exactly once as driver but not as school bus driver, where the driver ID is 6 and not 7 respectively?

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


Question: What are the names of employees who don't live in Bristol, excluding the names of shop managers who aren't Pekka Lyyski?

SELECT Name FROM employee WHERE City <> "Bristol" EXCEPT SELECT Name FROM shop WHERE Manager_name <> "Pekka Lyyski"


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

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


Question: Can you give me a list of driver IDs, combining those from the driver table excluding ID 9, with those from the school bus table that are greater than 9?

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


Question: Could you give me the document IDs that are both from documents mailed where the document ID is greater than 4 or the mailed-to address ID is not 4, and from draft copies where the copy number is 4?

SELECT document_id FROM Documents_Mailed WHERE "document_id" > 4 OR "mailed_to_address_id" != 4 INTERSECT SELECT document_id FROM Draft_Copies WHERE "copy_number" = 4


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

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


Question: Can you list the aircraft IDs, first including those from the aircraft table that are not equal to 1, and then adding those from the airport_aircraft table that are less than or equal to 3?

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


Question: Which aircraft have an ID of 2 and are also associated with airports that don't have an aircraft ID of 1?

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


Question: Can you give me a list of driver IDs less than or equal to 12, excluding those driver IDs that are not equal to 3 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 <> 3


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

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


Question: Can you give me a list of driver IDs, combining those from the driver table that are greater than 6 with those from the school bus table that are 4 or greater?

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, including those from the driver table excluding driver ID 8, and those from the school bus table with driver IDs greater than 9?

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


Question: Can you give me a list of driver IDs that are greater than 2, and also include driver IDs from the school bus list that are not equal to 10?

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


Question: What is the total ClubID and the StuID for club presidents, excluding those in Hopkins Student Enterprises?

SELECT SUM(T1.ClubID), T2.StuID FROM Club as T1 JOIN Member_of_club as T2 ON T1.ClubID = T2.ClubID WHERE Position = "President" AND ClubName <> "Hopkins Student Enterprises"


Question: Can you list the driver IDs from the driver table that are less than or equal to 5, and combine that with a list of driver IDs from the school_bus table that are greater than or equal 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: Which driver IDs, excluding driver ID 10, are present in both the driver table and the school bus table?

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


Question: Which aircraft IDs are not equal to 5 and are also less than or equal to 2?

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


Question: Can you give me a list of driver IDs that are less than or equal to 1, 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 IDs, that are at least 7, appear in the driver table but not in the school_bus table?

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


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

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


Question: Can you give me a list of driver IDs that are not 7 and are also less than 9, 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 != 7 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 not equal to 6, and then remove from that list any driver IDs that are less than or equal to 4 and are also 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 <= 4


Question: Can you give me the driver ID that appears exactly once with the value 2 in the driver table, but does not appear with a value of 10 or greater in the school_bus table?

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


Question: Can you list the aircraft IDs, first from the aircraft table excluding ID 2, and then from the airport_aircraft table including only IDs up to 5, combining the two lists?

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: Could you give me a list of IDs, combining IDs from car makers that aren't Renault and aren't from country code 1, or where the ID isn't 7, with IDs from car data where the MPG isn't 26.5, the horsepower isn't 67, and the ID is greater than 34?

SELECT Id FROM car_makers WHERE FullName <> "Renault" AND Country != "1" OR "Id" != 7 UNION ALL SELECT Id FROM cars_data WHERE MPG <> "26.5" AND Horsepower <> "67" AND "Id" > 34


Question: Can you list the aircraft IDs, including those from the aircraft table that are greater than or equal to 2, and those from the airport_aircraft table that are less than or equal to 2?

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


Question: Can you give me the Member IDs, total pounds, and years from the purchase table, but exclude any records where the Branch ID is 3 and the year is 2018, and only include Member IDs that are 4 or greater?

SELECT Member_ID, Total_pounds, Year FROM purchase WHERE "Member_ID" >= 4 EXCEPT SELECT Member_ID, Total_pounds, Year FROM purchase WHERE Branch_ID = "3" AND Year = "2018"


Question: What colleges did people other than Reggie Lewis graduate from, that are also the graduation colleges of people at least 31 years old, excluding Northeastern?

SELECT Graduation_College FROM people WHERE Name != "Reggie Lewis" INTERSECT SELECT Graduation_College FROM people WHERE "Age" >= 31 AND Graduation_College != "Northeastern"


Question: Can you give me the mailing date, document ID, and mailed-to address ID for all documents mailed where the address ID is 8 or less, or the mailing date was January 1st, 2007 at 10:32 PM and the document ID is not 23, except for those documents where the mailing date was not November 3rd, 1971 at 12:32 PM?

SELECT mailing_date, document_id, mailed_to_address_id FROM Documents_Mailed WHERE "mailed_to_address_id" <= 8 OR mailing_date = "2007-01-01 22:32:11" AND "document_id" != 23 EXCEPT SELECT mailing_date, document_id, mailed_to_address_id FROM Documents_Mailed WHERE mailing_date <> "1971-11-03 12:32:14"


Question: Which driver IDs, excluding driver 6, are also bus driver IDs, excluding bus driver 9?

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


Question: Can you give me a list of driver IDs, including those from the driver table that are 11 or higher, and also including driver IDs from the school bus table that are not equal to 3?

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


Question: Can you give me a list of driver IDs that are not 12 and are also driver IDs of school buses where the driver ID is at least 7?

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


Question: Can you list the aircraft IDs that are less than 1, and also list the aircraft IDs from the airport aircraft list that are greater than 3?

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


Question: Can you give me a list of aircraft IDs that are greater than 2, excluding any aircraft IDs that are also equal to 3 in the airport aircraft list?

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


Question: Could you list the feature IDs from the 'Other_Available_Features' table where the feature name is not "AirCon", and also include the feature IDs from the 'Other_Property_Features' table where the feature ID is 2 or the property ID is less than or equal to 7?

SELECT feature_id FROM Other_Available_Features WHERE feature_name != "AirCon" UNION ALL SELECT feature_id FROM Other_Property_Features WHERE "feature_id" = 2 OR "property_id" <= 7


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

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


Question: What is the sum of the shipping agent codes and their descriptions that are both associated with the code "UP" and either the code "UP" or the name "Airline"?

SELECT SUM(shipping_agent_code), shipping_agent_description FROM Ref_Shipping_Agents WHERE shipping_agent_code = "UP" INTERSECT SELECT SUM(shipping_agent_code), shipping_agent_description FROM Ref_Shipping_Agents WHERE shipping_agent_code = "UP" OR shipping_agent_name = "Airline"


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

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


Question: Can you list the aircraft IDs, excluding aircraft ID 1, from the aircraft table, and combine that with a list of aircraft ID 5 from the airport_aircraft table?

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


Question: Can you give me a list of employee IDs from the certificate table where the ID is greater than or equal to 269734834, combined with a list of employee IDs from the employee table for anyone named William Moore or anyone with an ID not equal to 356187925?

SELECT eid FROM certificate WHERE "eid" >= 269734834 UNION ALL SELECT eid FROM employee WHERE name = "William Moore" OR "eid" != 356187925


Question: Can you give me the highest feature type code and the feature description for all features where the feature name is "AirCon" or the feature description is "Air Conditioning" and the feature ID is 3 or greater, combined with the highest feature type code and feature description for features where the feature ID is not 2 and the feature type code is "Security" or the feature description is "Swimming Pool"?

SELECT MAX(feature_type_code), feature_description FROM Other_Available_Features WHERE feature_name = "AirCon" OR feature_description = "Air Conditioning." AND "feature_id" >= 3 UNION ALL SELECT MAX(feature_type_code), feature_description FROM Other_Available_Features WHERE "feature_id" <> 2 AND feature_type_code = "Security" OR feature_description = "Swimming Pool."


Question: Can you give me the oldest first name, city code, age, and the most advanced major for students who either live in Atlanta, or whose last name is Andreou and first name is Charles, or whose advisor number is 7712 or greater and are not male and have major 520 and are older than 19, or whose student ID is 1001 or less, combined with the oldest first name, city code, age, and the most advanced major for students who are male and don't live in Houston, or whose student ID is 1022 or greater?

SELECT MAX(Fname), city_code, Age, MAX(Major) FROM Student WHERE city_code = "ATL" OR LName = "Andreou" AND Fname = "Charles" OR "Advisor" >= 7712 AND Sex <> "M" AND "Major" = 520 AND "Age" > 19 OR "StuID" <= 1001 UNION SELECT MAX(Fname), city_code, Age, MAX(Major) FROM Student WHERE Sex = "M" AND city_code != "HOU" OR "StuID" >= 1022


Question: What is the longest road address among branches that either aren't branch ID 5 and aren't on Oaks Crescent, or didn't open in 2014, and is also among the longest road addresses of branches that opened in 2001?

SELECT MAX(Address_road) FROM branch WHERE "Branch_ID" != 5 AND Address_road <> "Oaks Crescent" OR Open_year <> "2014" IN (SELECT MAX(Address_road) FROM branch WHERE Open_year = "2001")


Question: Can you give me a list of employee IDs that are either employee ID "1" from the evaluation table, or from the hiring table where the start year isn't 2011 and they're not full-time, or their shop ID is 4?

SELECT Employee_ID FROM evaluation WHERE Employee_ID = "1" UNION SELECT Employee_ID FROM hiring WHERE Start_from != "2011" AND Is_full_time != "T" OR "Shop_ID" = 4


Question: Could you give me the sum of Document IDs from the Documents table where the Document ID is not 3830, or the Document Name is not "Summer Show" and the Document Description is "y", or the Other Details are not "None" and the Template ID is greater than or equal to 1, combined with the sum of Document IDs from the Paragraphs table where the Other Details are not "None", or the Paragraph ID is less than or equal to 765713812, or the Paragraph Text is not "Fiji"?

SELECT SUM(Document_ID) FROM Documents WHERE "Document_ID" <> 3830 OR Document_Name <> "Summer Show" AND Document_Description = "y" OR Other_Details <> "None" AND "Template_ID" >= 1 UNION ALL SELECT SUM(Document_ID) FROM Paragraphs WHERE Other_Details <> "None" OR "Paragraph_ID" <= 765713812 OR Paragraph_Text <> "Fiji"


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 11 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 driver ID 2 from the driver table and all driver IDs except 10 from the school_bus table?

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


Question: Can you list the property type codes and descriptions from the property types table, including those described as "Other, to be determined." or with a code that isn't "Other", combined with those described as "House, Bungalow, etc." or with a code that isn't "Apartment"?

SELECT property_type_code, property_type_description FROM Ref_Property_Types WHERE property_type_description = "Other, to be determined." OR property_type_code <> "Other" UNION SELECT property_type_code, property_type_description FROM Ref_Property_Types WHERE property_type_description = "House, Bungalow, etc." OR property_type_code != "Apartment"


Question: Can you give me a list of driver IDs, including driver ID 6 and any driver ID from the school bus list that isn't 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 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 list the driver IDs that are either equal to 12 in the driver table or greater than 7 in the school_bus table?

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


Question: How many draft documents have an ID of 17 or less, and what is that number combined with the count of documents that are not papers received on May 31, 1996 at 6:51:58 AM, or shipped by US agents, excluding document ID 2, not overdue, with receipt number 189, or with other details not equal to 'r'?

SELECT COUNT(document_id) FROM Document_Drafts WHERE "document_id" <= 17 UNION ALL SELECT COUNT(document_id) FROM Documents WHERE document_type_code != "Paper" AND receipt_date = "1996-05-31 06:51:58" OR shipping_agent_code = "US" AND "document_id" != 2 AND document_status_code <> "overdue" AND receipt_number = "189" OR other_details <> "r"


Question: Can you list the aircraft IDs that appear in the aircraft table, excluding aircraft ID 2, but then remove any aircraft IDs that appear in the airport_aircraft table with an aircraft ID of 3?

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


Question: Can you give me the driver IDs that appear exactly once as '1' in the driver table, but do not appear with a value less than '9' in the school bus table?

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


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

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


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

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


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

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


Question: Which aircraft IDs are not equal to 2 and are also greater than 2 when considering aircraft IDs from both the aircraft and airport_aircraft tables?

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


Question: Can you give me a list of employee IDs for those with certificate IDs less than 550156548 or association IDs greater than or equal to 10, along with the employee IDs of anyone named Michael Miller?

SELECT eid FROM certificate WHERE "eid" < 550156548 OR "aid" >= 10 UNION ALL SELECT eid FROM employee WHERE name = "Michael Miller"


Question: Can you list the aircraft IDs that are greater than 3, but not present in the list of aircraft IDs that are greater than or equal to 1 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 >= 1


Question: Which driver IDs are both less than or equal to 7 and also equal to 7 in the school bus records?

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 driver IDs from the driver table that are greater than or equal to 6, excluding any driver IDs that are less than or equal to 7 from the school_bus table?

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


Question: Can you give me the starting year and coach ID combinations that appear both for coaches and players who started after 2011 or have a player ID of 1, and for coaches and players who either started in 2011 or earlier with a player ID less than 4, or have a coach ID of 5 or less?

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


Question: Which driver IDs are greater than 9, but not greater than 10 and associated with a school bus?

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


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

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


Question: Can you find the maximum population, county ID, number of zip codes, and number of county names for each county, first by only considering counties where the zip code isn't "D11" and the county name isn't "Colony", or where the county ID is less than 5, and only showing results where there's exactly one zip code, and then find the maximum population, county ID, number of zip codes, and number of county names for each county, this time only considering counties where the population is greater than 21000 or the zip code isn't "D21", and only showing results where the maximum population isn't 87200 and there's exactly one county name, or where there is more than one zip code, and finally give me the intersection of those two results?

SELECT MAX(Population), County_Id, COUNT(Zip_code), COUNT(County_name) FROM county WHERE Zip_code != "D11" AND County_name <> "Colony" OR "County_Id" < 5 GROUP BY County_Id HAVING COUNT(Zip_code) = 1 INTERSECT SELECT MAX(Population), County_Id, COUNT(Zip_code), COUNT(County_name) FROM county WHERE "Population" > 21000.0 OR Zip_code != "D21" GROUP BY County_Id HAVING MAX(Population) <> 87200.0 AND COUNT(County_name) = 1 OR COUNT(Zip_code) > 1


Question: Which driver IDs are greater than 3 and also greater than 9, considering drivers and school buses separately?

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 give me a list of driver IDs, including those from the driver table where the ID is 7 or higher, and those from the school bus table where the ID is 3 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 >= 3


Question: Can you list the aircraft IDs from the aircraft table that are less than or equal to 3, and also list the aircraft IDs from the airport_aircraft table that are less than 5, combining the two lists into one?

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 total number of people with the same nationality, their birth dates, names, the highest People ID, and the total height for people in the peoplepeople table, combining two sets of results: first, those who are not People ID 7 and not named Teodor Salparov, or whose height isn't 194.0 and are Russian, or whose birth date isn't May 26, 1986; and second, those whose height is at least 205.0, or whose People ID is greater than 3, or who are not named Roman Bragin and were not born on February 8, 1981?

SELECT SUM(Nationality), Birth_Date, Name, MAX(People_ID), SUM(Height) FROM people WHERE "People_ID" <> 7 AND Name != "Teodor Salparov" OR "Height" <> 194.0 AND Nationality = "Russia" OR Birth_Date != "May 26, 1986" UNION ALL SELECT SUM(Nationality), Birth_Date, Name, MAX(People_ID), SUM(Height) FROM people WHERE "Height" >= 205.0 OR "People_ID" > 3 OR Name != "Roman Bragin" AND Birth_Date <> "February 8, 1981"


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

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


Question: Which driver IDs, 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, excluding driver ID 10, that are not also driver IDs, excluding driver ID 4, found 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: Which aircraft have an ID of 5, but are not aircraft with IDs less than 5 that are associated with airports?

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


Question: Can you give me a list of driver IDs, including driver ID 4 from the driver table and any driver IDs less than 9 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 < 9


Question: Can you give me a list of driver IDs from the driver table that are less than or equal to 4, excluding any driver IDs that are also in the school_bus table and less than 10?

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


Question: Which driver IDs, excluding driver 6, are also school bus driver IDs, excluding driver 9?

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


Question: Can you give me a list of driver IDs that are greater than 9, excluding any driver IDs that are less than 3 and also appear 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 list the Aircraft IDs from the aircraft table where the description is not "Tandem rotor helicopter", or the maximum gross weight is "3,200 lb (1,451 kg)", or the aircraft is not "CH-47D Chinook", or the Aircraft_ID is 3 and the maximum disk loading is not "8.8 lb/ft² (43 kg/m²)", combined with all Aircraft IDs from the airport_aircraft table where the Aircraft_ID is less than or equal to 3, or the ID is less than 1, or the Airport_ID is less than 2?

SELECT Aircraft_ID FROM aircraft WHERE Description <> "Tandem rotor helicopter" OR Max_Gross_Weight = "3,200 lb (1,451 kg)" OR Aircraft != "CH-47D Chinook" OR "Aircraft_ID" = 3 AND Max_disk_Loading <> "8.8 lb/ft² (43 kg/m²)" UNION ALL SELECT Aircraft_ID FROM airport_aircraft WHERE "Aircraft_ID" <= 3 OR "ID" < 1 OR "Airport_ID" < 2


Question: Can you give me a list of aircraft IDs that appear in the aircraft table, excluding aircraft ID 2, but only if they are not also present in the airport_aircraft table with an aircraft ID of 1 or greater?

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


Question: What is the average district and comptroller for elections where the lieutenant governor was not Jonathan Reiter or the year was 2006 or earlier?

SELECT AVG(T1.District), T2.Comptroller FROM election as T1 JOIN party as T2 ON T1.Party = T2.Party WHERE Lieutenant_Governor <> "Jonathan Reiter" OR "Year" <= 2006.0


Question: For each airport, how many aircraft are associated with it?

SELECT T1.Airport_ID, COUNT(T2.Aircraft_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 item IDs, including those for items with titles that aren't "comb", and also those for reviews where the rating is greater than 5, or the reviewer's ID is at least 4 and the user ID isn't 2?

SELECT i_id FROM item WHERE title <> "comb" UNION ALL SELECT i_id FROM review WHERE "rating" > 5 OR "a_id" >= 4 AND "u_id" != 2


Question: Can you give me the Driver ID from the driver table, specifically if the Driver ID is 3, but only if that Driver ID is not also in the school_bus table with a Driver ID greater than 7?

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: Could you list the profits in billions for companies that either have sales of 68.7 billion and aren't company ID 10, or are not in the Oil and Gas industry, or don't have a market value of 202.2 billion, or are headquartered in Germany with profits less than 15.7 billion, and also list the profits in billions for companies with sales greater than 62.4 billion?

SELECT Profits_in_Billion FROM company WHERE "Sales_in_Billion" = 68.7 AND "Company_ID" <> 10.0 OR Industry != "Oil and gas" OR "Market_Value_in_Billion" != 202.2 OR Headquarters = "Germany" AND "Profits_in_Billion" < 15.7 UNION ALL SELECT Profits_in_Billion FROM company WHERE "Sales_in_Billion" > 62.4


Question: Can you tell me, for two separate sets of districts, the number of cities, the largest district ID, the city where they're headquartered, and the number of district names? The first set includes districts where the district ID is 2 or greater, or the headquartered city isn't Faisalabad City and the city population is at least 172073, or the district name is Attock District, or the city area is 10. The second set includes districts where the city area isn't 25, or the district name isn't Chiniot District and the headquartered city is Gujrat City and the city population is less than 113524.

SELECT COUNT(City_Population), MAX(District_ID), Headquartered_City, COUNT(District_name) FROM district WHERE "District_ID" >= 2 OR Headquartered_City != "Faisalabad City" AND "City_Population" >= 172073.0 OR District_name = "Attock District" OR "City_Area" = 10.0 UNION ALL SELECT COUNT(City_Population), MAX(District_ID), Headquartered_City, COUNT(District_name) FROM district WHERE "City_Area" <> 25.0 OR District_name != "Chiniot District" AND Headquartered_City = "Gujrat City" AND "City_Population" < 113524.0


Question: Could you list the document IDs and draft numbers from the circulation history, including those where the employee ID is not 8, the draft number is not 20, the copy number is 5 or greater, and the document ID is greater than 10, as well as those where the copy number is exactly 5 or the document ID is 20 or greater?

SELECT document_id, draft_number FROM Circulation_History WHERE "employee_id" <> 8 AND "draft_number" <> 20 AND "copy_number" >= 5 AND "document_id" > 10 UNION ALL SELECT document_id, draft_number FROM Circulation_History WHERE "copy_number" = 5 OR "document_id" >= 20


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

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


Question: Can you give me a list of driver IDs, excluding driver ID 12 from the driver table and driver ID 9 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 <> 12 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 9


Question: Can you give me a list of student IDs, including those from students who have pets and whose ID is greater than 1001, as well as those from students whose major is 600?

SELECT StuID FROM Has_Pet WHERE "StuID" > 1001 UNION ALL SELECT StuID FROM Student WHERE "Major" = 600


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

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


Question: Can you give me a list of driver IDs, including those from the driver table that are 3 or higher, and those from the school bus table that are 4 or lower?

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 list the document descriptions and template IDs for all documents, including those with descriptions that are not "b", and also those with descriptions that are not "y" or names that aren't "How to read a book" or template IDs greater than 14?

SELECT Document_Description, Template_ID FROM Documents WHERE Document_Description <> "b" UNION SELECT Document_Description, Template_ID FROM Documents WHERE Document_Description != "y" OR Document_Name <> "How to read a book" OR "Template_ID" > 14


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

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


Question: What is the average book ID for books with at least 4 issues, or those that aren't titled "Dead Corps" and have a book ID of 3 or higher and aren't written by Howard Chaykin, combined with the average book ID for publications with a book ID of 3 or less, or those published in August 2008 that don't cost 2,000,000?

SELECT AVG(Book_ID) FROM book WHERE "Issues" >= 4.0 OR Title <> "Dead Corps" AND "Book_ID" >= 3 AND Writer <> "Howard Chaykin" UNION ALL SELECT AVG(Book_ID) FROM publication WHERE "Book_ID" <= 3 OR Publication_Date = "August 2008" AND "Price" <> 2000000.0


Question: Which aircraft IDs are not equal to 2 and are also greater than 3 when considering aircraft IDs from both the aircraft and airport_aircraft tables?

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


Question: Can you give me a list of driver IDs that are less than 8 from the driver table, combined with a list of driver IDs that are less than or equal to 3 from the school bus table, removing any duplicates?

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, excluding driver ID 7 from the driver table and driver ID 3 from the school_bus table, making sure there are no duplicates in the final list?

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: How many customers have a phone number other than 1-875-045-0806, and how many lessons are taught by someone other than staff ID 8, or are not cancelled, or are at 5 o'clock?

SELECT COUNT(customer_id) FROM Customers WHERE phone_number <> "1-875-045-0806" UNION SELECT COUNT(customer_id) FROM Lessons WHERE "staff_id" <> 8 OR lesson_status_code != "Cancelled" OR lesson_time = "5"


Question: What is the total of the 'Name' values for shops in "Tehtaan kenttä" or shops not in "Turku" that are also not named "IFK Mariehamn" and have at least 10000 products, or shops where the manager is not "Pekka Lyyski", combined with the total of the 'Name' values for shops not in "Lahti"?

SELECT SUM(Name) FROM shop WHERE District = "Tehtaan kenttä" OR Location != "Turku" AND Name != "IFK Mariehamn" AND "Number_products" >= 10000 OR Manager_name != "Pekka Lyyski" UNION ALL SELECT SUM(Name) FROM shop WHERE Location <> "Lahti"


Question: Can you tell me the age, average major, and count of sexes for students, combining two sets of results: first, those who either don't have the last name "Prater", or are not female and have an advisor number of 1121 or higher, or don't have a major of 600 and are 18 or younger, or have a student ID of 1005; and second, those who are female and have a student ID greater than 1032, or have the first name "Eric" and are 20 or older, or have an advisor number of 7792 or higher and a city code of "LON"?

SELECT Age, AVG(Major), COUNT(Sex) FROM Student WHERE LName != "Prater" OR Sex <> "F" AND "Advisor" >= 1121 OR "Major" <> 600 AND "Age" <= 18 OR "StuID" = 1005 UNION SELECT Age, AVG(Major), COUNT(Sex) FROM Student WHERE Sex = "F" AND "StuID" > 1032 OR Fname = "Eric" AND "Age" >= 20 OR "Advisor" >= 7792 AND city_code = "LON"


Question: What aircraft IDs are both greater 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: Can you list all the aircraft IDs, excluding aircraft ID 1, from the aircraft table, and combine that with a list of all aircraft IDs, excluding aircraft ID 2, from the airport_aircraft table?

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


Question: What role codes are assigned to employees who are not in the "PR" role, and are also role codes that are either "ED" or are not described as "Manager"?

SELECT role_code FROM Employees WHERE role_code <> "PR" INTERSECT SELECT role_code FROM Roles WHERE role_code = "ED" OR role_description <> "Manager"


Question: Which driver IDs, excluding driver ID 4, are also driver IDs specifically associated with school bus 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: Which driver IDs are not equal to 2 and are also not equal to 7 in the school bus driver list?

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 the location, school ID, school name, and type for all schools that are either not private and located in New York City with a school ID greater than 4, or have a school name other than Punahou School, along with the location, school ID, school name, and type for Columbia University, excluding those located in Jakarta, Indonesia?

Honolulu, Hawaii
1
Noelani Elementary School
Public

Jakarta, Indonesia
2
St. Francis Assisi
Private Catholic

Jakarta, Indonesia
3
State Elementary School Menteng 01
Public

Los Angeles, California
5
Occidental College
Private

New York City
6
Columbia University
Private

Cambridge, Massachusetts
7
Harvard Law School
Private

New York City
6
Columbia University
Private

SELECT Location, School_ID, School, Type FROM school WHERE Type != "Private" AND Location = "New York City" AND "School_ID" > 4 OR School <> "Punahou School" UNION ALL SELECT Location, School_ID, School, Type FROM school WHERE School = "Columbia University" AND Location != "Jakarta, Indonesia"


Question: Which driver IDs that are less than 12 are also driver IDs of school buses where the driver ID is 9?

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


Question: Can you give me a list of driver IDs that are not 12 from the driver table, but only include those driver IDs that are also not 10 from the school bus table?

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


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

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


Question: Can you list the salary, name, and employee ID for all employees who are not named William Moore and whose employee ID is not 287321212, along with the salary, name, and employee ID for all employees whose salary is less than or equal to 23980?

SELECT salary, name, eid FROM employee WHERE name != "William Moore" AND "eid" != 287321212 UNION SELECT salary, name, eid FROM employee WHERE "salary" <= 23980


Question: Can you list all the driver IDs from the driver table that are less than or equal to 12, combined with all the driver IDs from the school_bus table that are not equal to 10?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID <= 12 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, combining those from the driver table that are not 12 with those from the school_bus table that are less than 7, 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 < 7


Question: Can you give me a list of driver IDs less than or equal to 9, excluding any 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 <= 9 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 4


Question: What is the highest enrollment and the invested amount for schools where either the year is 2005 or earlier, or the number of invested records is less than 5840, the IHSAA class is AAA, the IHSAA football class is not A, the count of total budget percent budgeted is less than 2.0, and enrollment is 620 or less, or the location is not Culver?

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 COUNT(Invested) < 5840 AND IHSAA_Class = "AAA" AND IHSAA_Football_Class <> "A" AND COUNT(total_budget_percent_budgeted) < 2.0 AND Enrollment <= 620 OR Location <> "Culver"


Question: Can you list the Aircraft IDs that are less than 5 when grouped in the aircraft table, but are not equal to 5 when grouped in the airport_aircraft table?

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


Question: Could you show me the payment method code, customer ID, and payment amount for all customer payments that both don't have a payment amount of 6970.98 and don't have a payment datetime of February 27, 2018 at 8:08:53 PM, and also don't have a payment datetime of February 24, 2018 at 10:07:05 AM, or have a payment amount of at least 4773.16, or have a customer ID greater than 6, or don't use Direct Debit as the payment method?

SELECT payment_method_code, customer_id, amount_payment FROM Customer_Payments WHERE "amount_payment" <> 6970.98 AND datetime_payment != "2018-02-27 20:08:53" INTERSECT SELECT payment_method_code, customer_id, amount_payment FROM Customer_Payments WHERE datetime_payment != "2018-02-24 10:07:05" OR "amount_payment" >= 4773.16 OR "customer_id" > 6 OR payment_method_code <> "Direct Debit"


Question: Can you show me the Gold count, total Bronze count, Club ID, Big Silver count, Points, Rank, and the lowest Small Silver count from the match results, excluding any results where the Gold count is 7 and the Big Silver count is greater than 12, and including only those results where the Rank is not 2, or the Bronze count is greater than 6, or the Big Silver count is at least 12 and the Club ID is no more than 5, or the Gold count is no more than 7?

SELECT Gold, SUM(Bronze), Club_ID, Big_Silver, Points, Rank, MIN(Small_Silver) FROM match_result WHERE "Rank" <> 2 OR "Bronze" > 6 OR "Big_Silver" >= 12 AND "Club_ID" <= 5 OR "Gold" <= 7 EXCEPT SELECT Gold, SUM(Bronze), Club_ID, Big_Silver, Points, Rank, MIN(Small_Silver) FROM match_result WHERE "Gold" = 7 AND "Big_Silver" > 12


Question: Can you list the IATA code, city, country, ICAO code, name, and ID for all airports, excluding those with IATA code "AMS" and ICAO code "ENBR", but then remove any airports from that list that either aren't named "National Airport" and are located in Baltimore, or have an ICAO code different from "EKBI", or have an ID less than or equal to 1 and an IATA code different from "BRU"?

BLL
Billund
Denmark
EKBI
Billund Airport
7

SELECT IATA, City, Country, ICAO, name, id FROM airport WHERE IATA != "AMS" AND ICAO != "ENBR" EXCEPT SELECT IATA, City, Country, ICAO, name, id FROM airport WHERE name != "National Airport" AND City = "Baltimore" OR ICAO <> "EKBI" OR "id" <= 1 AND IATA <> "BRU"


Question: Can you give me a list of driver IDs, including drivers with the ID 3 and school bus drivers with IDs greater than 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 that are less than or equal to 2, excluding any driver IDs that are not equal to 3 from the school bus list?

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


Question: What aircraft IDs are both less than or equal to 5 when grouped in the aircraft table and also less than or equal to 1 when grouped in the airport_aircraft table?

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


Question: Can you give me a list of driver IDs that are both less than or equal to 7 and 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 <= 7 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, including those from the driver table excluding driver ID 12, 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 <> 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, including those from the driver table where the ID is not 1, and those from the school bus table where the ID is less than 7?

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


Question: What is the sum of flight IDs for flights with flight number "M2-F1 #70" and company ID less than or equal to 13, combined with the sum of IDs from operate_company where the name is "Cathay Pacific Catering Services (HK) Limited", the ID is 7, or the Group Equity Shareholding is less than 100?

SELECT SUM(id) FROM flight WHERE Vehicle_Flight_number = "M2-F1 #70" AND "company_id" <= 13 UNION ALL SELECT SUM(id) FROM operate_company WHERE name = "Cathay Pacific Catering Services (HK) Limited" OR "id" = 7 OR "Group_Equity_Shareholding" < 100.0


Question: Can you give me a list of driver IDs, combining those from the driver table where the ID is not 5, with those from the school bus table where the ID is 4 or less, removing any duplicates?

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: 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?

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 less than 8 that appear in the driver table, excluding any driver IDs less than 9 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 < 9


Question: What is the sum of draft numbers and the smallest document ID for documents with ID 13 and draft number at least 16, combined with the sum of draft numbers and the smallest document ID for draft copies with document ID less than or equal to 1, draft number at least 17, or copy number greater than 10?

SELECT SUM(draft_number), MIN(document_id) FROM Document_Drafts WHERE "document_id" = 13 AND "draft_number" >= 16 UNION ALL SELECT SUM(draft_number), MIN(document_id) FROM Draft_Copies WHERE "document_id" <= 1 OR "draft_number" >= 17 OR "copy_number" > 10


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


Question: Can you list the driver IDs that are less than 2 from the driver table, and also list the driver IDs that are less than 4 from the school bus table, combining the two lists into one?

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


Question: Which driver IDs, excluding driver ID 3, are also driver IDs greater than or equal to 10 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: Could you give me the IDs of people from the 'people' table who have an ID greater than 5 and a height of at least 187 centimeters, but exclude the IDs of poker players from the 'poker_player' table who either have a money rank of 166 or higher, a poker player ID of 2 or higher, a people ID of 5, a best finish of 3, and a final table made not equal to 10, or have earnings less than 189233?

SELECT People_ID FROM people WHERE "People_ID" > 5 AND "Height" >= 187.0 EXCEPT SELECT People_ID FROM poker_player WHERE "Money_Rank" >= 166.0 AND "Poker_Player_ID" >= 2 AND "People_ID" = 5 AND "Best_Finish" = 3.0 AND "Final_Table_Made" != 10.0 OR "Earnings" < 189233.0


Question: Which driver IDs are both greater than 1 and also less than 7?

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 give me a list of driver IDs from the driver table where the driver ID is 9 or greater, combined with a list of driver IDs from the school bus table where the driver ID is 4?

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


Question: Could you give me the album IDs for albums that aren't titled "The Best Of 1980-1990", excluding the IDs of media types that are either "AAC audio file" or have an ID of 2?

SELECT id FROM albums WHERE title <> "The Best Of 1980-1990" EXCEPT SELECT id FROM media_types WHERE name = "AAC audio file" OR "id" = 2


Question: What is the alphabetically first city from the airport table that satisfies both of these conditions: either its IATA code is BCN and its ICAO code is not LEBL, or its country is not Denmark; and also, either its city is Baltimore, its IATA code is not BWI, its country is not Spain, its name is El Prat Airport, or its id is 1?

SELECT MIN(City) FROM airport WHERE IATA = "BCN" AND ICAO != "LEBL" OR Country != "Denmark" INTERSECT SELECT MIN(City) FROM airport WHERE City = "Baltimore" OR IATA <> "BWI" OR Country <> "Spain" OR name = "El Prat Airport" OR "id" = 1


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

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


Question: Can you list all property type descriptions that are not "Apartment" and not "Apartment, Flat, Condo, etc.", excluding those that are not "Shop, Retail Outlet." or have a property type code of "House"?

SELECT property_type_description FROM Ref_Property_Types WHERE property_type_code != "Apartment" AND property_type_description <> "Apartment, Flat, Condo, etc." EXCEPT SELECT property_type_description FROM Ref_Property_Types WHERE property_type_description != "Shop, Retail Outlet." OR property_type_code = "House"


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

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


Question: Can you list the aircraft IDs that are less than 4 from the aircraft table, combined with the 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 < 4 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 all driver IDs from the driver table that are not 4, combined with all driver IDs from the school bus table that are equal to 10?

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


Question: Can you give me a list of driver IDs, including those from the driver table excluding driver ID 11, and those from the school bus table excluding driver ID 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 the driver IDs from the driver table that are less than 3, and combine that with a list of all driver IDs from the school_bus table that are less than or equal to 7, 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 <= 7


Question: Can you give me a list of driver IDs, including driver ID 1 from the driver table and driver ID 9 from the school_bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 1 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 that are less than 12, but not including those driver IDs that are 10 or less and are also 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 give me a list of PetIDs and StuIDs from the Has_Pet table, including those where the StuID is less than or equal to 1002, and also including all PetIDs and StuIDs where the StuID is greater than 1002 or the PetID is not 2003?

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


Question: Can you give me a list of aircraft IDs that are less than 2, but also not equal to 3, based on information from the aircraft and airport_aircraft tables?

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


Question: Can you list the aircraft IDs that are greater than 1, and also list the aircraft IDs from the airport aircraft table that are less than 2?

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


Question: What is the number of albums not created by artist 51, and what is the number of genres named "Science Fiction" or with an ID less than 23?

SELECT COUNT(id) FROM albums WHERE "artist_id" != 51 UNION SELECT COUNT(id) FROM genres WHERE name = "Science Fiction" OR "id" < 23


Question: Which driver IDs are both greater than 7 and appear in the driver table, and also greater than or equal to 7 and appear 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 driver IDs, including those from the driver table where the ID is not 1, and also including those from the school_bus table where the ID is 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 that are both less than 12 and appear in the driver table, and also less than or equal to 9 and appear in the school_bus table?

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


Question: Can you list all the states from the area code table, excluding Virginia, and also list all the states from the votes table where the phone number is less than or equal to 6209222712, or where the creation date is not March 9th, 2018 at 7:03:39 PM and the vote ID is 1?

SELECT state FROM AREA_CODE_STATE WHERE state != "VA" UNION SELECT state FROM VOTES WHERE "phone_number" <= 6209222712 OR created != "2018-03-09 19:03:39" AND "vote_id" = 1


Question: Can you list the origin, airline ID, price, distance, and destination for all flights that either arrived in Washington D.C. on "04/12/2005 07:05" with an airline ID greater than 1 or have a flight number that isn't 34 and didn't depart on "04/12/2005 09:00" or have a price greater than 220.98, along with all flights that either originate in Chicago or didn't depart on "04/12/2005 11:50"?

SELECT origin, aid, price, distance, destination FROM flight WHERE arrival_date = "04/12/2005 07:05" AND destination = "Washington D.C." AND "aid" > 1 OR "flno" != 34 AND departure_date <> "04/12/2005 09:00" OR "price" > 220.98 UNION ALL SELECT origin, aid, price, distance, destination FROM flight WHERE origin = "Chicago" OR departure_date != "04/12/2005 11:50"


Question: Can you give me the employee IDs of employees who either earn more than $20 or have an ID less than 90873519, but exclude those employees with IDs greater than or equal to 242518965 who are not named Michael Miller and earn at least $105743?

SELECT eid FROM employee WHERE "salary" > 20 OR "eid" < 90873519 EXCEPT SELECT eid FROM employee WHERE "eid" >= 242518965 AND name != "Michael Miller" AND "salary" >= 105743


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

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


Question: Can you give me a list of driver IDs that are less than 6 and also not equal to 9, considering only the distinct 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 != 9


Question: What is the average city population and corresponding district ID for districts where the city area is 25, or the store ID is 4 or less, or the headquarters city is not "Chiniot City" and the district name is not "Gujrat District", or the city population is 1,526,168 or less?

SELECT AVG(T1.City_Population), T2.District_ID FROM district as T1 JOIN store_district as T2 ON T1.District_ID = T2.District_ID WHERE "City_Area" = 25.0 OR "Store_ID" <= 4 OR Headquartered_City <> "Chiniot City" AND District_name <> "Gujrat District" OR "City_Population" <= 1526168.0


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


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

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


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


Question: Can you give me a list of driver IDs, including those from the driver table that are greater than 1 and those from the school_bus table that are less than 4?

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


Question: Can you list the aircraft IDs that are greater than or equal to 4 from the aircraft table, and also list the aircraft IDs that are greater than 3 from the airport_aircraft table, combining both lists into one?

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 driver IDs from the driver table where each ID is less than or equal to 4, combined with a list of driver IDs from the school_bus table where each ID is not equal to 9?

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


Question: Can you give me the highest branch ID, the opening year, and the average membership amount for branches in Oxford, excluding those on Brampton Road or with a membership amount of 11, where the branch ID is less than or equal to 1 and the name isn't Alexandre, combined with the same information for branches in London that opened in 2014, have a branch ID of 1, a membership amount that is not 11, and aren't named Stanley?

SELECT MAX(Branch_ID), Open_year, AVG(membership_amount) FROM branch WHERE Address_road != "Brampton Road" OR membership_amount != "11" AND "Branch_ID" <= 1 AND City = "Oxford" AND Name <> "Alexandre" UNION ALL SELECT MAX(Branch_ID), Open_year, AVG(membership_amount) FROM branch WHERE Name != "Stanley" AND Open_year = "2014" AND membership_amount != "11" AND City = "London" AND "Branch_ID" = 1


Question: Can you give me a list of driver IDs that are both greater than or equal to 1 and not equal to 10, 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 >= 1 INTERSECT 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 where the ID is 4 or greater, 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 >= 4 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 1, 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 != 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 less than 10, 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 < 10 EXCEPT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID > 4


Question: Which driver IDs, excluding 10, are also driver IDs that are greater than or equal to 9 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 >= 9


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

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 list the aircraft IDs from the aircraft table that are less than or equal to 5, and combine that with a list of aircraft IDs from the airport_aircraft table that are greater than 5?

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


Question: Which driver IDs less than 5 are also driver IDs of school buses, specifically driver ID 4?

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


Question: Which driver IDs are both not equal to 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: What is the highest store ID for stores with more than 1678 product categories, and also the highest store ID from the store district table where the store ID is 4 or less?

SELECT MAX(Store_ID) FROM store WHERE "Number_of_product_category" > 1678.0 UNION SELECT MAX(Store_ID) FROM store_district WHERE "Store_ID" <= 4