Question: What is the earliest branch name from branches opened in 2013, or not on Cecilia Avenue with a membership amount of 91, or not named Zytogorski and not branch ID 6, excluding the earliest member name from members who are level 6 or higher, or from Simpsonville, South Carolina and not member ID 4?

SELECT MIN(Name) FROM branch WHERE Open_year = "2013" OR Address_road <> "Cecilia Avenue" AND membership_amount = "91" OR Name != "Zytogorski" AND "Branch_ID" <> 6 EXCEPT SELECT MIN(Name) FROM member WHERE "Level" >= 6 OR Hometown = "Simpsonville, South Carolina" AND "Member_ID" != 4


Question: Can you give me a list of driver IDs, including driver ID 10 from the driver table and any driver IDs greater than or equal to 3 from the school_bus table?

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


Question: Can you show me the payment amount and outstanding amount for each mobile phone number, but only for those where either the birth date isn't August 29, 1996 at 12:03 AM, the payment time isn't February 6, 2018 at 1:35 PM, or the mobile phone number isn't 1-387-258-1016x96963, or the outstanding amount is exactly $2255?

SELECT T1.amount_payment, T2.amount_outstanding FROM Customer_Payments as T1 JOIN Customers as T2 ON T1.customer_id == T2.customer_id GROUP BY cell_mobile_phone_number HAVING date_of_birth <> "1996-08-29 00:03:08" AND datetime_payment <> "2018-02-06 13:35:58" AND cell_mobile_phone_number <> "1-387-258-1016x96963" OR amount_outstanding = 2255.0


Question: Can you list the aircraft IDs that appear more than once in the aircraft table, where the ID is greater than 1, and combine that with a list of aircraft IDs that appear more than once in the airport_aircraft table, where the ID is at least 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: Which driver has an ID of 2 in the driver table, but not an ID of 3 in the school_bus table?

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


Question: Which driver IDs, excluding driver ID 6, are also driver IDs that are greater than or equal to 4 in the school bus list?

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


Question: Can you provide a combined summary of property features from the Properties table, including minimum oth_feature_3, average hse_feature_3, date_on_market, average apt_feature_1, minimum property_address, maximum shp_feature_1, count of vendor_requested_price, maximum buyer_offered_price, sum of other_property_details, sum of fld_feature_3, apt_feature_3, count of apt_feature_2, agreed_selling_price, minimum shp_feature_2, average property_id, date_sold, maximum hse_feature_2, sum of oth_feature_2, fld_feature_1, property_name, fld_feature_2, and maximum shp_feature_3, first for properties where vendor_requested_price is 305 and property_name is not 'parc east' and shp_feature_1 is not 'None', or property_type_code is not 'House' and room_count is less than 5, or property_id is 13, or shp_feature_3 is not 'None', or date_on_market is '2016-05-24 09:57:45', or fld_feature_1 is 'None' and agreed_selling_price is greater than or equal to 3344706.5755 and other_property_details is 'None', or apt_feature_1 is not 'quo' and oth_feature_3 is not 'None', and then again for properties where fld_feature_3 is not 'None', or shp_feature_1 is not 'None', or vendor_requested_price is less than or equal to 661536468.4429, or apt_feature_1 is not 'fuga', or hse_feature_1 is not 'None', or fld_feature_2 is not 'None', or buyer_offered_price is greater than 13991131.434, or room_count is not 3, or agreed_selling_price is 2574.0, or date_on_market is '1991-06-21 23:52:10' and hse_feature_2 is not 'None' and property_address is not '107 Roob Courts Erdmanburgh, IA 42926-0873', or other_property_details is 'None', or hse_feature_3 is 'None' and property_type_code is not 'Apartment' and date_sold is not '1981-06-26 21:28:28'?

2088 Bashirian Fork Suite 337
Faustinoport, MT 16771-9320

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

SELECT MIN(oth_feature_3), AVG(hse_feature_3), date_on_market, AVG(apt_feature_1), MIN(property_address), MAX(shp_feature_1), COUNT(vendor_requested_price), MAX(buyer_offered_price), SUM(other_property_details), SUM(fld_feature_3), apt_feature_3, COUNT(apt_feature_2), agreed_selling_price, MIN(shp_feature_2), AVG(property_id), date_sold, MAX(hse_feature_2), SUM(oth_feature_2), fld_feature_1, property_name, fld_feature_2, MAX(shp_feature_3) FROM Properties WHERE "vendor_requested_price" = 305.0 AND property_name != "parc east" AND shp_feature_1 != "None" OR property_type_code != "House" AND "room_count" < 5 OR "property_id" = 13 OR shp_feature_3 != "None" OR date_on_market = "2016-05-24 09:57:45" OR fld_feature_1 = "None" AND "agreed_selling_price" >= 3344706.5755 AND other_property_details = "None" OR apt_feature_1 <> "quo" AND oth_feature_3 <> "None" UNION ALL SELECT MIN(oth_feature_3), AVG(hse_feature_3), date_on_market, AVG(apt_feature_1), MIN(property_address), MAX(shp_feature_1), COUNT(vendor_requested_price), MAX(buyer_offered_price), SUM(other_property_details), SUM(fld_feature_3), apt_feature_3, COUNT(apt_feature_2), agreed_selling_price, MIN(shp_feature_2), AVG(property_id), date_sold, MAX(hse_feature_2), SUM(oth_feature_2), fld_feature_1, property_name, fld_feature_2, MAX(shp_feature_3) FROM Properties WHERE fld_feature_3 <> "None" OR shp_feature_1 != "None" OR "vendor_requested_price" <= 661536468.4429 OR apt_feature_1 != "fuga" OR hse_feature_1 != "None" OR fld_feature_2 <> "None" OR "buyer_offered_price" > 13991131.434 OR "room_count" <> 3 OR "agreed_selling_price" = 2574.0 OR date_on_market = "1991-06-21 23:52:10" AND hse_feature_2 != "None" AND property_address <> "107 Roob Courts Erdmanburgh, IA 42926-0873" OR other_property_details = "None" OR hse_feature_3 = "None" AND property_type_code != "Apartment" AND date_sold != "1981-06-26 21:28:28"


Question: Which driver IDs appear in both the driver list where the ID is 7, and the school bus list where the ID is 7 or higher?

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: Which driver IDs are equal to 11 in the driver table, excluding those driver IDs that are 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 city, building number, and country for all addresses where the building number is not "00704 Zoe Alley", and also list the city, building number, and country for all addresses in the USA?

Elviebury
376 Kallie Tunnel Apt. 784
USA

Lockmanfurt
56461 Baumbach Well Suite 634
USA

Lake Rafaela
29085 Dejah Pine Suite 059
USA

South Eugene
37698 Hahn Curve Apt. 572
USA

New Bernieceburgh
7089 Mueller Forks
USA

Ericamouth
43235 Jazmin Mountain Suite 251
USA

Damianfort
4834 Schaefer Light Suite 947
USA

West Edmondview
9260 Streich Mountain
USA

Elviebury
376 Kallie Tunnel Apt. 784
USA

Lockmanfurt
56461 Baumbach Well Suite 634
USA

Lake Rafaela
29085 Dejah Pine Suite 059
USA

South Eugene
37698 Hahn Curve Apt. 572
USA

New Bernieceburgh
7089 Mueller Forks
USA

Ericamouth
43235 Jazmin Mountain Suite 251
USA

Damianfort
4834 Schaefer Light Suite 947
USA

West Edmondview
9260 Streich Mountain
USA

SELECT city, line_1_number_building, country FROM Addresses WHERE line_1_number_building != "00704 Zoe Alley" UNION ALL SELECT city, line_1_number_building, country FROM Addresses WHERE country = "USA"


Question: Can you give me a list of driver IDs, including those from the driver table that are greater than or equal to 4, and those from the school bus table that are 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 list the aircraft IDs that are both greater than or equal to 2 and not equal to 3, considering only unique aircraft IDs 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: Could you list the allergies that appear exactly once in the allergy type table?

SELECT COUNT(AllergyType), Allergy FROM Allergy_Type GROUP BY Allergy HAVING COUNT(AllergyType) = 1 EXCEPT SELECT COUNT(AllergyType), Allergy FROM Allergy_Type GROUP BY Allergy HAVING COUNT(AllergyType) <> 1


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

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


Question: Can you give me a list of player IDs from players who don't live in Winnipeg or aren't ranked first, or whose player ID is 5, combined with a list of player IDs from the player-coach table where the starting year is 2010 or later, or the coach ID is less than 3 and the player ID is not 2?

SELECT Player_ID FROM player WHERE Residence != "Winnipeg" AND Rank <> "1st" OR "Player_ID" = 5 UNION ALL SELECT Player_ID FROM player_coach WHERE "Starting_year" >= 2010 OR "Coach_ID" < 3 AND "Player_ID" <> 2


Question: Can you give me a list of student IDs, combining those who hold a position other than "Teaching Coordinator" in the club membership table with those students whose major is 600, or whose age is not 18, or whose advisor is 8772 or lower and whose student ID is greater than 1035?

SELECT StuID FROM Member_of_club WHERE Position != "Teaching Coordinator" UNION SELECT StuID FROM Student WHERE "Major" = 600 OR "Age" != 18 OR "Advisor" <= 8772 AND "StuID" > 1035


Question: Can you give me the total source user ID for each trust value, considering first only the entries where the target user ID is 5 or the source user ID is less than 1 and the trust is not 2, and then adding to that the total source user ID for each trust value considering only the entries where the source user ID is greater than or equal to 2 or the trust is greater than or equal to 1 and the target user ID is less than 3?

SELECT trust, SUM(source_u_id) FROM trust WHERE "target_u_id" = 5 OR "source_u_id" < 1 AND "trust" != 2 UNION SELECT trust, SUM(source_u_id) FROM trust WHERE "source_u_id" >= 2 OR "trust" >= 1 AND "target_u_id" < 3


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

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


Question: Can you list the aircraft IDs that are less than or equal to 2, excluding any aircraft IDs greater than 3 that are also found 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: Can you give me a list of driver IDs that are both in the driver table and the school bus table, but only including IDs that are 10 or less?

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: Can you list all the nationalities from the people table, including those who are either from the United States, not named Tim Naegeli, or younger than 31, combined with the nationalities of people who are either not named Reggie Lewis or didn't graduate from California?

SELECT Nationality FROM people WHERE Nationality = "United States" OR Name != "Tim Naegeli" OR "Age" < 31 UNION SELECT Nationality FROM people WHERE Name != "Reggie Lewis" OR Graduation_College != "California"


Question: Can you give me a list of aircraft IDs, including those with ID 2 from the aircraft table, and those with IDs less than or equal to 2 from the airport_aircraft table?

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


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


Question: What is the average maker value for car makers excluding Honda, except for the average maker value from the model list where the model ID is less than 9, the maker is not 19, or the model is Pontiac?

SELECT AVG(Maker) FROM car_makers WHERE Maker != "honda" EXCEPT SELECT AVG(Maker) FROM model_list WHERE "ModelId" < 9 OR "Maker" != 19 OR Model = "pontiac"


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

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: Could you give me the creation date, department ID, and ranking for departments that are not named "Defense", have a budget of at least 59.7 billion, and have no more than 36,000 employees, but only if they also have a ranking greater than 2, a creation date other than 1965, or a name other than "State"?

SELECT Creation, Department_ID, Ranking FROM department WHERE Name != "Defense" AND "Budget_in_Billions" >= 59.7 AND "Num_Employees" <= 36000.0 INTERSECT SELECT Creation, Department_ID, Ranking FROM department WHERE "Ranking" > 2 OR Creation != "1965" OR Name != "State"


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

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID > 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 less than or equal to 12, excluding those driver IDs that appear in the school bus list, except for driver ID 7?

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


Question: Can you give me the IDs of all albums that either don't have the title "Vault: Def Leppard's Greatest Hits" or have an ID of 84 or greater, but exclude the IDs of any genres named "Alternative"?

SELECT id FROM albums WHERE title <> "Vault: Def Leppard's Greatest Hits" OR "id" >= 84 EXCEPT SELECT id FROM genres WHERE name = "Alternative"


Question: What is the highest gender and rank of coaches, excluding those with Coach ID 4 or those named Smith Brown who don't have Club ID 1 and have a rank of 1, except for the highest gender and rank of players who are not self-employed, or have a rank of 4th with more than 5490 votes, or are not named Jim Maloway, or don't have Player ID 4, or are sponsored by Churchill, don't live in Oakbank, and are not female?

SELECT MAX(Gender), Rank FROM coach WHERE "Coach_ID" != 4 OR Coach_name = "Smith Brown" AND "Club_ID" != 1 AND "Rank" = 1 EXCEPT SELECT MAX(Gender), Rank FROM player WHERE Occupation <> "Self Employed / Consultant" OR Rank = "4th" AND "Votes" > 5490 OR Player_name <> "Jim Maloway" OR "Player_ID" <> 4 OR Sponsor_name = "Churchill" AND Residence != "Oakbank" AND Gender <> "F"


Question: Can you give me a list of aircraft IDs, excluding aircraft ID 5 from the aircraft table, combined with a list of aircraft IDs, excluding aircraft ID 1 from the airport_aircraft table?

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


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

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


Question: Which coach IDs are associated with a starting year of 2011 and also associated with either a player ID greater than 2 or a coach ID not equal to 3 when the starting year is 2011?

SELECT Coach_ID FROM player_coach WHERE "Starting_year" = 2011 INTERSECT SELECT Coach_ID FROM player_coach WHERE "Player_ID" > 2 OR "Coach_ID" <> 3 AND "Starting_year" = 2011


Question: What is the average school ID for schools that are not St. Francis Assisi and not college level, or are not located in Los Angeles, California, or have a school ID other than 6 and are not private, combined with the average school ID from the school bus table where the school ID is 3?

SELECT AVG(School_ID) FROM school WHERE School != "St. Francis Assisi" AND Grade != "College" OR Location <> "Los Angeles, California" OR "School_ID" != 6 AND Type != "Private" UNION ALL SELECT AVG(School_ID) FROM school_bus WHERE "School_ID" = 3


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

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


Question: Which store IDs and their total district ID values only include district ID 4, but exclude any store IDs and their total district ID values that either don't have store ID 4 or include district ID 11?

SELECT Store_ID, SUM(District_ID) FROM store_district WHERE "District_ID" = 4 EXCEPT SELECT Store_ID, SUM(District_ID) FROM store_district WHERE "Store_ID" <> 4 OR "District_ID" = 11


Question: Can you list all payment amounts from customer payments where either the payment method is not Direct Debit or the payment datetime is not February 19, 2018 at 9:06:29 AM, and also list all payment amounts where either the payment amount is not 6970.98 or the customer ID is not 11 and the payment datetime is not February 15, 2018 at 4:38:49 PM?

SELECT amount_payment FROM Customer_Payments WHERE payment_method_code <> "Direct Debit" OR datetime_payment <> "2018-02-19 09:06:29" UNION ALL SELECT amount_payment FROM Customer_Payments WHERE "amount_payment" <> 6970.98 OR "customer_id" <> 11 AND datetime_payment != "2018-02-15 16:38:49"


Question: What airports are associated with each aircraft?

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


Question: Could you list the document IDs for drafts with a negative draft number, as well as the document IDs for mailed documents that were not mailed on November 3rd, 1971 at 12:32:14, have an ID of 13 or less, and were mailed to address ID 4?

SELECT document_id FROM Document_Drafts WHERE "draft_number" < 0 UNION ALL SELECT document_id FROM Documents_Mailed WHERE mailing_date <> "1971-11-03 12:32:14" AND "document_id" <= 13 AND "mailed_to_address_id" = 4


Question: Can you give me a list of player IDs from the player table where either the ID is less than 6 and the votes aren't 4914 and the rank isn't "3rd", or the sponsor name is "Winnipeg South Centre" and the residence isn't "Brandon", combined with a list of player IDs from the player_coach table where the ID is less than or equal to 10?

SELECT Player_ID FROM player WHERE "Player_ID" < 6 AND "Votes" <> 4914 AND Rank != "3rd" OR Sponsor_name = "Winnipeg South Centre" AND Residence <> "Brandon" UNION SELECT Player_ID FROM player_coach WHERE "Player_ID" <= 10


Question: Can you list the aircraft IDs that are less than 1 from the aircraft table, and also list the aircraft IDs that equal 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 show me the room name, room ID, and number of beds for rooms where the base price isn't 75 and the room name is "Thrift and accolade", or the room ID isn't "CAS", or the maximum occupancy is more than 4 and the number of beds isn't 1 and the decor isn't traditional, or the bed type is "Double", combined with the room name, room ID, and number of beds for rooms where the maximum occupancy is less than 4 or the bed type isn't "Queen"?

SELECT roomName, RoomId, beds FROM Rooms WHERE "basePrice" <> 75 AND roomName = "Thrift and accolade" OR RoomId <> "CAS" OR "maxOccupancy" > 4 AND "beds" <> 1 AND decor <> "traditional" OR bedType = "Double" UNION SELECT roomName, RoomId, beds FROM Rooms WHERE "maxOccupancy" < 4 OR bedType <> "Queen"


Question: Which driver IDs, excluding driver ID 6, are not also driver IDs of school buses with driver IDs up to 10?

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


Question: Can you find the smallest value in 'Other_Details' and the corresponding 'Document_ID' from the 'Documents' table, considering only entries where 'Document_Description' is not "y", or 'Other_Details' is "None", and 'Document_ID' is not 33930, and 'Template_ID' is not 7, or 'Document_Name' is not "Robbin CV", and then combine that with the smallest value in 'Other_Details' and the corresponding 'Document_ID' from the 'Paragraphs' table where 'Paragraph_ID' is not 765713812 and 'Document_ID' is greater than 80?

SELECT MIN(Other_Details), Document_ID FROM Documents WHERE Document_Description != "y" OR Other_Details = "None" AND "Document_ID" <> 33930 AND "Template_ID" != 7 OR Document_Name <> "Robbin CV" UNION SELECT MIN(Other_Details), Document_ID FROM Paragraphs WHERE "Paragraph_ID" != 765713812 AND "Document_ID" > 80


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 equal to 9 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 = 9


Question: Can you give me a list of driver IDs that are less than 9 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 < 9 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 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 4?

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


Question: Can you give me the shipping agent codes that are either "SH" or have a name other than "Ship", but exclude any codes where the description is "g" and the code is "US"?

SELECT shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_code = "SH" OR shipping_agent_name != "Ship" EXCEPT SELECT shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_description = "g" AND shipping_agent_code = "US"


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

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


Question: Which driver IDs are both less than or equal to 12 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 <= 12 INTERSECT 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: Could you list the names of aircraft that have a distance of 6900 or less, or an aid less than 11, along with the names of employees who are not Lisa Walker and don't have a salary of 43723?

SELECT name FROM aircraft WHERE "distance" <= 6900 OR "aid" < 11 UNION SELECT name FROM employee WHERE name != "Lisa Walker" AND "salary" != 43723


Question: What is the difference between the total head ID of all heads, excluding Franklin Langham and those older than 43 or with a head ID of 10, and the total head ID of all management members with a head ID greater than 4 and a department ID not equal to 11?

SELECT SUM(head_ID) FROM head WHERE name <> "Franklin Langham" AND "age" <= 43.0 OR "head_ID" <> 10 EXCEPT SELECT SUM(head_ID) FROM management WHERE "head_ID" > 4 AND "department_ID" != 11


Question: Can you give me a list of driver IDs that are greater than 3 and also not equal to 4, 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 > 3 INTERSECT SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 4


Question: Could you list all the document type codes, including duplicates, where either the code isn't "Paper" or the description isn't "f", and also include all document type codes where the description isn't "u"?

SELECT document_type_code FROM Ref_Document_Types WHERE document_type_code != "Paper" OR document_type_description != "f" UNION ALL SELECT document_type_code FROM Ref_Document_Types WHERE document_type_description <> "u"


Question: Which driver IDs are equal to 1 in the driver table, but not equal to 9 in the school_bus table?

SELECT Driver_ID FROM driver GROUP BY Driver_ID HAVING Driver_ID = 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, excluding driver ID 12 from the driver table and driver ID 10 from the school bus table, making sure to only list each driver ID 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 != 10


Question: What are the driver IDs greater than 5 from the driver table, combined with the driver IDs greater than or equal to 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: Which driver IDs are in the driver table but not in the school bus table, excluding driver ID 10 from the driver table and driver ID 9 from the school bus table?

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


Question: What are the driver IDs greater than 4 who are not in the school bus records, excluding driver ID 4?

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


Question: What are the level, the minimum name, and the sum of card numbers for members where the level is less than 6, or they are from Jacksonville, Florida and their card number is not RE95, or their name is not David Jones, excluding those members whose member ID is 7 and are not from LaGrange, Georgia or their card number is not OLB56?

SELECT Level, MIN(Name), SUM(Card_Number) FROM member WHERE "Level" < 6 OR Hometown = "Jacksonville, Florida" AND Card_Number <> "RE95" OR Name != "David Jones" EXCEPT SELECT Level, MIN(Name), SUM(Card_Number) FROM member WHERE "Member_ID" = 7 AND Hometown != "LaGrange, Georgia" OR Card_Number <> "OLB56"


Question: What are the store IDs of stores ranked 10 and with an area size less than 179.84, combined with the store IDs from the store_district table, excluding store ID 1?

SELECT Store_ID FROM store WHERE "Ranking" = 10 AND "Area_size" < 179.84 UNION SELECT Store_ID FROM store_district WHERE "Store_ID" <> 1


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

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


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

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


Question: What are the district IDs for stores with an ID greater than 3, also considering only those district IDs for stores with an ID greater than 1?

SELECT District_ID FROM store_district WHERE "Store_ID" > 3 INTERSECT SELECT District_ID FROM store_district WHERE "Store_ID" > 1


Question: What are the shipping agent codes that appear in both the Documents table (excluding those with a receipt date of "1986-12-14 14:18:59", a document type code of "CD", or a shipping agent code of "FE" and other details of "x") and the Ref_Shipping_Agents table (excluding those with a description of "w" or a name of "Ship")?

SELECT shipping_agent_code FROM Documents WHERE receipt_date <> "1986-12-14 14:18:59" OR document_type_code != "CD" OR shipping_agent_code <> "FE" AND other_details != "x" INTERSECT SELECT shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_description <> "w" AND shipping_agent_name != "Ship"


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

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


Question: Which driver IDs are present in both the driver and school bus tables, excluding driver ID 7, and with all driver IDs being greater than or equal to 1?

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


Question: What are the driver IDs greater than 5 from the driver table, combined with the driver IDs greater than or equal to 7 from the school bus table?

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


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

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


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

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


Question: What are the IDs of drivers who have an ID of 8 or greater, and also appear on a school bus, but are not driver ID 7?

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


Question: What is the sum of employee IDs and the bonus for each employee, grouped by name, excluding employees who are 28 years old, and only including those whose year awarded was 2016, or are younger than 30, or don't live in Bristol?

SELECT SUM(T1.Employee_ID), T2.Bonus FROM employee as T1 JOIN evaluation as T2 ON T1.Employee_ID = T2.Employee_ID WHERE "Age" <> 28 GROUP BY Name HAVING Year_awarded = "2016" OR Age < 30 OR City <> "Bristol"


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

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


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

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


Question: What is the maximum age and head ID for heads from California who are 68 years old and work in a department with an ID greater than 2, or for heads named Nick Faldo who are temporarily acting?

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


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

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


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

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


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

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


Question: What are the book IDs, writers, and issues for books where the book ID is 1 or the writer is not Christopher Hinz and the title isn't Sheva's War, and also for books where the book ID is not 6 or the title isn't The Dome: Ground Zero or the writer is not Howard Chaykin and the issues aren't 12?

SELECT Book_ID, Writer, Issues FROM book WHERE "Book_ID" = 1 OR Writer <> "Christopher Hinz" AND Title != "Sheva's War" INTERSECT SELECT Book_ID, Writer, Issues FROM book WHERE "Book_ID" != 6 OR Title <> "The Dome: Ground Zero" OR Writer <> "Howard Chaykin" AND "Issues" <> 12.0


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

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


Question: What are the driver IDs that are less than 9, but not driver IDs less than 7, from the driver and school bus tables?

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


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

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


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

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


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

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


Question: What are the driver IDs that are less than or equal to 10, excluding those driver IDs that are less than 3, considering only driver IDs from the driver and school bus tables?

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


Question: What is the sum of People IDs for employees not in company 13 with People ID less than or equal to 1, combined with the sum of People IDs for people under 37 years old?

SELECT SUM(People_ID) FROM employment WHERE "Company_ID" <> 13 AND "People_ID" <= 1 UNION SELECT SUM(People_ID) FROM people WHERE "Age" < 37


Question: Which driver IDs and school IDs are associated with drivers, considering the following conditions: the school ID is greater than 7 and the driver is full-time, or the driver is affiliated with the Republican party, or the driver's age is not 40, or the driver has worked less than 6 years and lives in Hartford?

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


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

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


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

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


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

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


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

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


Question: What are the aircraft IDs that appear in both the aircraft table (with an ID greater than or equal to 1) and the airport_aircraft table (with an ID equal to 2)?

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


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

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


Question: What are the document type codes from the Documents table, excluding those with a receipt date of "1999-04-17 14:19:32" and other details not equal to "u", or a document type code not equal to "Hard Drive" and a receipt number of "114", or a shipping agent code not equal to "UP", or a document ID less than 24, but not including any document type codes where the document type description in the Ref_Document_Types table is "b"?

SELECT document_type_code FROM Documents WHERE receipt_date != "1999-04-17 14:19:32" AND other_details != "u" OR document_type_code != "Hard Drive" AND receipt_number = "114" OR shipping_agent_code != "UP" OR "document_id" < 24 EXCEPT SELECT document_type_code FROM Ref_Document_Types WHERE document_type_description = "b"


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

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


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

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


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

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


Question: What are the document IDs from the drafts that are not draft number 4 and don't have draft details "r", or the document ID is 12, combined with the document IDs from the documents that don't have a receipt date of "1973-11-05 21:48:53" or have other details "u"?

SELECT document_id FROM Document_Drafts WHERE "draft_number" <> 4 AND draft_details <> "r" OR "document_id" = 12 UNION ALL SELECT document_id FROM Documents WHERE receipt_date != "1973-11-05 21:48:53" OR other_details = "u"


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


Question: What is the sum of feature type codes, excluding those related to "BurglarAlarm" and "Air Conditioning" or where the feature ID is not 4, combined with the sum of feature type codes from the feature types table, excluding those named "Amenity, eg Pool." or where the code is "Amenity"?

SELECT SUM(feature_type_code) FROM Other_Available_Features WHERE feature_name <> "BurglarAlarm" AND feature_description <> "Air Conditioning." OR "feature_id" != 4 UNION ALL SELECT SUM(feature_type_code) FROM Ref_Feature_Types WHERE feature_type_name != "Amenity, eg Pool." OR feature_type_code = "Amenity"


Question: Which staff IDs are associated with lessons where the customer ID is not 10, or the lesson ID is less than or equal to 6 and the vehicle ID is not 2 and the lesson time is not "9", or the staff ID is not 11 and the lesson status code is not "Completed" and the lesson date is not "2018-03-07 22:03:49", or staff members whose nickname is not "ymiller" and middle name is not "Sherwood", or first name is "Jaleel", or staff address ID is 3 and date of birth is "1998-04-27 12:55:05", or date joined staff is "2017-12-22 03:06:32" and date left staff is "2018-03-08 05:16:29", or staff ID is not 11, or last name is not "Weissnat"?

SELECT staff_id FROM Lessons WHERE "customer_id" <> 10 OR "lesson_id" <= 6 AND "vehicle_id" != 2 AND lesson_time <> "9" OR "staff_id" <> 11 AND lesson_status_code != "Completed" AND lesson_date <> "2018-03-07 22:03:49" UNION SELECT staff_id FROM Staff WHERE nickname <> "ymiller" AND middle_name <> "Sherwood" OR first_name = "Jaleel" OR "staff_address_id" = 3 AND date_of_birth = "1998-04-27 12:55:05" OR date_joined_staff = "2017-12-22 03:06:32" AND date_left_staff = "2018-03-08 05:16:29" OR "staff_id" != 11 OR last_name <> "Weissnat"


Question: What are the aircraft IDs that are either 1 or 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: What are the driver IDs less than 3 that are not driver IDs other than 4, considering only the driver and school bus information?

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


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

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


Question: What are the driver IDs that are less than 2, excluding those driver IDs from the school bus table that are less than 10?

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


Question: What are the driver IDs that are equal to 5, but not driver IDs greater than 10?

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


Question: What are the aircraft IDs that are either 5 or greater than or equal to 3?

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


Question: What are the driver IDs, excluding driver ID 12, that are present in both the driver and school bus tables, excluding driver ID 4?

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


Question: Which driver IDs are less than 9, excluding driver ID 10?

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


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

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


Question: What are the aircraft IDs that are greater than or equal to 3 and are not equal to 5, considering only aircraft IDs present in both the aircraft and airport_aircraft tables?

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


Question: What allergies other than food allergies are also grass pollen allergies?

SELECT Allergy FROM Allergy_Type WHERE AllergyType <> "food" INTERSECT SELECT Allergy FROM Has_Allergy WHERE Allergy = "Grass Pollen"


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

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


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

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


Question: What are the aircraft IDs of aircraft that are not turboshaft utility helicopters, combined with the aircraft IDs from airport_aircraft where the aircraft ID is less than or equal to 1, or the airport ID is 1, or the ID is 2?

SELECT Aircraft_ID FROM aircraft WHERE Description != "Turboshaft utility helicopter" UNION ALL SELECT Aircraft_ID FROM airport_aircraft WHERE "Aircraft_ID" <= 1 OR "Airport_ID" = 1 OR "ID" = 2


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

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


Question: Which driver IDs are greater than 3, and which driver ID is equal to 3, considering both drivers and school buses?

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


Question: What are the DPI, dimensions, and maximum page size for products where the product ID is less than 5, or the color pages per minute is greater than 3.0, or the maximum page size is not "216mm x 356mm", or the interface is not "USB 2.0", or the product is "Plustek MobileOffice D28 Corporate"? Also, what are the DPI, dimensions, and maximum page size for products where the maximum page size is "A4" but the product is not "Canon imageFORMULA P-150"?

SELECT dpi, dimensions, max_page_size FROM product WHERE "product_id" < 5 OR "pages_per_minute_color" > 3.0 OR max_page_size != "216mm x 356mm" OR interface != "USB 2.0" OR product = "Plustek MobileOffice D28 Corporate" UNION SELECT dpi, dimensions, max_page_size FROM product WHERE max_page_size = "A4" AND product != "Canon imageFORMULA P-150"


Question: What are the aircraft IDs that are less than 1, and also the aircraft IDs that are 3 or greater?

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


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

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


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

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


Question: Which driver IDs are either less than or equal to 4 from the driver table, or not equal to 3 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 != 3


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

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


Question: What are the aircraft IDs that are not equal to 3 and are present in the aircraft table but not in the airport_aircraft table, where the airport_aircraft aircraft IDs are greater than or equal to 1?

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


Question: Which driver IDs are not equal to 3, but are not also driver ID 9 from the school bus table?

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


Question: What are the aircraft IDs that appear in both the aircraft table (with ID values of 2 or greater) and the airport_aircraft table (with ID values of 1 or greater)?

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


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

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


Question: What are the document type codes for documents with receipt number "117", or a receipt date not equal to "1983-09-26 09:32:56", or a document ID less than 12, or a document status code not equal to "done", combined with the document type codes from the document types table where the document type code is not "Hard Drive" or the description is not "f"?

SELECT document_type_code FROM Documents WHERE receipt_number = "117" OR receipt_date <> "1983-09-26 09:32:56" OR "document_id" < 12 OR document_status_code <> "done" UNION SELECT document_type_code FROM Ref_Document_Types WHERE document_type_code != "Hard Drive" OR document_type_description <> "f"


Question: What are the aircraft IDs that are not 1 and also appear in the airport_aircraft table with an ID of 5?

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


Question: What is the average coach ID for coaches who are not Joe Fabbri, have a rank of 5, and a club ID less than 1, excluding the average coach ID from player-coach relationships where the player ID isn't 10 and the starting year is after 2012?

SELECT AVG(Coach_ID) FROM coach WHERE Coach_name != "Joe Fabbri" AND "Rank" = 5 AND "Club_ID" < 1 EXCEPT SELECT AVG(Coach_ID) FROM player_coach WHERE "Player_ID" <> 10 AND "Starting_year" > 2012


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

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


Question: What are the driver IDs that are either 8 or less, or 10 or more?

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


Question: What are the driver IDs that are both equal to 3 in the driver table and less than 4 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 < 4


Question: What driver IDs are both equal to 10 and greater than 7, considering driver and school bus information?

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


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

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


Question: What are the aircraft IDs that are not equal to 3, excluding those with IDs less than 2, considering only the aircraft table and the airport_aircraft table?

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


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

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


Question: What are the driver IDs that are either less than or equal to 5, or less than 9, considering driver IDs from both the driver and school bus tables?

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


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

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


Question: Which driver IDs are either 11 or greater than 7?

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


Question: What are the aircraft IDs that are less than 1, and also the aircraft IDs that are 5 or greater?

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


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

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


Question: What are the driver IDs that are less than 12, and also the driver IDs from the school bus table that are greater than 10?

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


Question: What registration years are present in the membership register, excluding those from 2016 or branch 1, and also present in the membership register where the branch is not 4 or the member ID is less than 1, or the year is 2016?

SELECT Register_Year FROM membership_register_branch WHERE Register_Year != "2016" OR Branch_ID != "1" INTERSECT SELECT Register_Year FROM membership_register_branch WHERE Branch_ID != "4" AND "Member_ID" < 1 OR Register_Year = "2016"


Question: Which driver IDs are equal to 3 but not greater than or equal to 9, considering driver IDs from the driver and school bus tables?

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


Question: Which continent IDs are not Asia, but are not America?

SELECT ContId FROM continents WHERE Continent <> "asia" EXCEPT SELECT ContId FROM continents WHERE Continent = "america"


Question: What are the driver IDs that are greater than or equal to 3, excluding those driver IDs that are not equal to 10?

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


Question: Which driver IDs are equal to 2 but not greater than 10, considering driver IDs from the 'driver' table and excluding those from the 'school_bus' table?

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


Question: Which aircraft have an ID of 1 and are listed in both the aircraft and airport_aircraft tables?

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


Question: Which driver IDs are not 4 from the driver table, combined with driver ID 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: Which driver IDs are in the driver table but not in the school bus table, excluding driver ID 7 from the driver table and driver IDs 4 and above from the school bus table?

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


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

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


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

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


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

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


Question: What are the aircraft IDs that are either greater than or equal to 1 in the aircraft table or not equal to 5 in the airport_aircraft table?

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


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

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


Question: How many aircraft are there for each aid value greater than 12, and how many are there for each aid value greater than or equal to 11, excluding Boeing 747-400?

SELECT COUNT(name), aid FROM aircraft WHERE "aid" > 12 UNION SELECT COUNT(name), aid FROM aircraft WHERE "aid" >= 11 AND name != "Boeing 747-400"


Question: What are the driver IDs that are both greater than or equal to 7 and also less than or equal to 10, considering only drivers and school buses?

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


Question: Which branch IDs satisfy either of these conditions: the membership amount is 11, or the address road is not "Valleys Place", the opening year is 2012, the name isn't "Zytogorski", and the branch ID isn't 4, or the city is not "London"; or the branch ID is 3 and the member ID is less than 1, or the year is 2018?

SELECT Branch_ID FROM branch WHERE membership_amount = "11" OR Address_road <> "Valleys Place" AND Open_year = "2012" AND Name != "Zytogorski" AND "Branch_ID" != 4 OR City <> "London" UNION ALL SELECT Branch_ID FROM purchase WHERE Branch_ID = "3" AND "Member_ID" < 1 OR Year = "2018"


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

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


Question: What is the average payment date, the maximum customer ID, and the minimum payment amount for payments made by direct debit, and also for payments with an amount greater than or equal to 5475.26?

SELECT AVG(datetime_payment), MAX(customer_id), MIN(amount_payment) FROM Customer_Payments WHERE payment_method_code = "Direct Debit" UNION SELECT AVG(datetime_payment), MAX(customer_id), MIN(amount_payment) FROM Customer_Payments WHERE "amount_payment" >= 5475.26


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

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


Question: What are the template type codes, effective to dates, and effective from dates for templates that have an effective from date of February 4, 1996, excluding those with non-empty template details or a template ID of 22 and an effective to date of October 22, 2000?

SELECT Template_Type_Code, Date_Effective_To, Date_Effective_From FROM Templates WHERE Date_Effective_From = "1996-02-04 11:27:24" EXCEPT SELECT Template_Type_Code, Date_Effective_To, Date_Effective_From FROM Templates WHERE Template_Details != "" OR "Template_ID" = 22 AND Date_Effective_To = "2000-10-22 11:57:12"


Question: What are the aircraft IDs that are not equal to 4, but are not present in the airport_aircraft table with IDs greater than or equal to 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: What are the driver IDs that are less than or equal to 12, excluding those driver IDs that are greater than or equal to 9 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 >= 9


Question: Which driver IDs are either 9 or greater than 4?

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


Question: What are the aircraft IDs that are less than or equal to 1, but not equal to 1 in the airport_aircraft table?

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


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

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


Question: Which driver IDs are less than or equal to 2, excluding those that are not equal to 9?

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


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

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


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

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


Question: Which customer IDs and payment method codes are not associated with Direct Debit, considering either a customer ID other than 2 or a payment amount of at least 787.12?

SELECT customer_id, payment_method_code FROM Customer_Payments WHERE "customer_id" != 2 OR "amount_payment" >= 787.12 OR payment_method_code != "Direct Debit" EXCEPT SELECT customer_id, payment_method_code FROM Customer_Payments WHERE payment_method_code <> "Direct Debit"


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


Question: What are the minimum customer IDs, cell phone numbers, customer dates, customer address IDs, sums of first names, phone numbers, and sums of outstanding amounts for customers where the outstanding amount is greater than 3751, combined with customers where the first name is Dianna, or the customer ID is greater than 14 and the last name is not Terry, or the outstanding amount is not 2255, or the customer address ID is not 13, or the cell phone number is +45(6)4872981083, or the customer date is not 2016-02-17 08:26:23 and the email address is not wehner.harold@example.com and the phone number is not 1-618-535-9750?

SELECT MIN(customer_id), cell_mobile_phone_number, date_became_customer, customer_address_id, SUM(first_name), phone_number, SUM(amount_outstanding) FROM Customers WHERE "amount_outstanding" > 3751.0 UNION ALL SELECT MIN(customer_id), cell_mobile_phone_number, date_became_customer, customer_address_id, SUM(first_name), phone_number, SUM(amount_outstanding) FROM Customers WHERE first_name = "Dianna" OR "customer_id" > 14 AND last_name <> "Terry" OR "amount_outstanding" <> 2255.0 OR "customer_address_id" <> 13 OR cell_mobile_phone_number = "+45(6)4872981083" OR date_became_customer <> "2016-02-17 08:26:23" AND email_address <> "wehner.harold@example.com" AND phone_number <> "1-618-535-9750"


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

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


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

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


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

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


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

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


Question: Which driver IDs are not equal to 2, but are not also driver IDs from school buses with IDs greater than or equal to 10?

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


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

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


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

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


Question: Which driver IDs are either less than or equal to 11, or are specifically driver ID 7, considering both drivers and school buses?

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


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

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


Question: What are the driver IDs less than 9 that are not present in the school bus table, excluding driver ID 9?

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


Question: What are the driver IDs that are less than 12, excluding driver ID 10, considering driver information from the 'driver' and 'school_bus' tables?

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

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


Question: Which driver IDs are not equal to 2, and which driver ID is equal to 3, considering both drivers and school buses?

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


Question: What are the driver IDs that are less than or equal to 1, excluding those driver IDs that are not equal to 4?

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


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

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


Question: What are the Lieutenant Governors from the party table, excluding those who meet any of these conditions: the party ID is not 7 and the US Senate is not Hillary Rodham Clinton, or the Lieutenant Governor is not Jonathan Reiter, or the Comptroller is Alan Hevesi and the Governor is not Carl McCall, or the year is before or equal to 2002, or the Attorney General is Andrew Cuomo; but also excluding those whose year is not 2002, or whose party is not Liberal and the Comptroller is not Alan Hevesi and the Governor is Eliot Spitzer and the party ID is greater than 4, or the Lieutenant Governor is Jonathan Reiter, or the Attorney General is not Eliot Spitzer?

SELECT Lieutenant_Governor FROM party WHERE "Party_ID" <> 7 AND US_Senate != "Hillary Rodham Clinton" OR Lieutenant_Governor <> "Jonathan Reiter" OR Comptroller = "Alan Hevesi" AND Governor <> "Carl McCall" OR "Year" <= 2002.0 OR Attorney_General = "Andrew Cuomo" EXCEPT SELECT Lieutenant_Governor FROM party WHERE "Year" != 2002.0 OR Party <> "Liberal" AND Comptroller != "Alan Hevesi" AND Governor = "Eliot Spitzer" AND "Party_ID" > 4 OR Lieutenant_Governor = "Jonathan Reiter" OR Attorney_General <> "Eliot Spitzer"


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

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


Question: What are the aircraft IDs from the aircraft table where the ID is less than 13, combined with the aircraft IDs from the flight table for flights that arrived on April 12, 2005 at 5:03 AM, or had a distance of 2551 or less, or went to Honolulu, or had an aircraft ID of 7 or greater, or departed on a different date than April 12, 2005 at 8:45 AM and had flight number 68?

SELECT aid FROM aircraft WHERE "aid" < 13 UNION ALL SELECT aid FROM flight WHERE arrival_date = "04/12/2005 05:03" OR "distance" <= 2551 OR destination = "Honolulu" OR "aid" >= 7 OR departure_date <> "04/12/2005 08:45" AND "flno" = 68


Question: What is the lowest paragraph ID where the other details are "None", excluding the lowest paragraph IDs where the other details are not "None" or the paragraph text is not "Korea"?

SELECT MIN(Paragraph_ID) FROM Paragraphs WHERE Other_Details = "None" EXCEPT SELECT MIN(Paragraph_ID) FROM Paragraphs WHERE Other_Details <> "None" OR Paragraph_Text != "Korea"


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

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


Question: Which driver IDs are less than 9, and which driver IDs are greater than 9, considering both the driver and school bus information?

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


Question: What are the car models where the MakeId is less than 366 or the model is not "datsun", and also the car models from the model list where the model is not "buick" or the ModelId is not 23?

SELECT Model FROM car_names WHERE "MakeId" < 366 OR Model != "datsun" UNION ALL SELECT Model FROM model_list WHERE Model <> "buick" OR "ModelId" != 23


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

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


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

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


Question: What are the contestant numbers for Jessie Eichman, and also any contestant number that isn't 3 or Jessie Alloway?

SELECT contestant_number FROM CONTESTANTS WHERE contestant_name = "Jessie Eichman" UNION SELECT contestant_number FROM CONTESTANTS WHERE "contestant_number" != 3 OR contestant_name = "Jessie Alloway"


Question: What are the driver IDs greater than 6, combined with the driver IDs from school buses that are not equal to 4?

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


Question: Which driver IDs are greater than 5 but not equal to 7, considering only those IDs that appear in the driver table but not in the school bus table?

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


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

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


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

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


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

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


Question: What are the aircraft IDs greater than 2, and also the aircraft IDs greater than 3, considering both the aircraft and airport_aircraft tables?

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


Question: What are the titles and counts of items where the item ID is 0 or the title is "orange", but not those where the item ID is less than 6 or the title is not "orange"?

SELECT title, COUNT(i_id) FROM item WHERE "i_id" = 0 OR title = "orange" EXCEPT SELECT title, COUNT(i_id) FROM item WHERE "i_id" < 6 OR title != "orange"


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

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


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

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


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

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


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

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


Question: Which shop IDs are associated with employee 1 or not full-time, but are not shop IDs of shops that are not named KuPS, located in Tehtaan kenttä, and do not have Mika Laurikainen as manager?

SELECT Shop_ID FROM hiring WHERE "Employee_ID" = 1 OR Is_full_time != "T" EXCEPT SELECT Shop_ID FROM shop WHERE Name <> "KuPS" AND District = "Tehtaan kenttä" AND Manager_name <> "Mika Laurikainen"


Question: What are the IDs of documents that were mailed, excluding document ID 4, but not including any documents that are draft copies with copy number 10 and document ID 2?

SELECT document_id FROM Documents_Mailed WHERE "document_id" != 4 EXCEPT SELECT document_id FROM Draft_Copies WHERE "copy_number" = 10 AND "document_id" = 2


Question: What are the IDs of drivers, excluding driver 4, who are also assigned to school buses with driver IDs of 9 or higher?

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


Question: What are the document IDs that satisfy either of these conditions: the document ID is less than or equal to 4, the mailing date is not February 21, 1973 at 10:17:01, or the address ID is greater than or equal to 9, and also have a copy number of 4?

SELECT document_id FROM Documents_Mailed WHERE "document_id" <= 4 OR mailing_date != "1973-02-21 10:17:01" OR "mailed_to_address_id" >= 9 INTERSECT SELECT document_id FROM Draft_Copies WHERE "copy_number" = 4


Question: What are the driver IDs that are 6 or greater, but not driver IDs less than 4, considering only driver IDs from the driver and school bus tables?

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


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

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


Question: What are the driver IDs that are both less than 12 and greater than 4, considering only those IDs present in both the driver and school bus tables?

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


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

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


Question: What are the regions and club names of clubs that are not in the USA and not club ID 3 and did not start in 1998, along with the regions and club names of clubs that are not Halmstads BK and have a club ID greater than 4?

SELECT Region, Club_name FROM club WHERE Region <> "USA" AND "Club_ID" != 3 AND "Start_year" <> 1998 UNION ALL SELECT Region, Club_name FROM club WHERE Club_name != "Halmstads BK" AND "Club_ID" > 4


Question: What is the highest Club ID from the coach table where the Coach ID is less than 2 and the gender is not female, combined with the highest Club ID from the match result table where Big Silver is 9 and Rank is 5, or Gold is less than or equal to 13 and Small Silver is 10, or Club ID is greater than 2, or Points is greater than or equal to 139?

SELECT MAX(Club_ID) FROM coach WHERE "Coach_ID" < 2 AND Gender != "F" UNION ALL SELECT MAX(Club_ID) FROM match_result WHERE "Big_Silver" = 9 AND "Rank" = 5 OR "Gold" <= 13 AND "Small_Silver" = 10 OR "Club_ID" > 2 OR "Points" >= 139


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

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


Question: What are the maximum fld_feature_1, sum of shp_feature_3, oth_feature_1, minimum oth_feature_2, fld_feature_2, count of property_name, shp_feature_1, hse_feature_2, minimum vendor_requested_price, maximum hse_feature_3, property_type_code, count of fld_feature_3, date_on_market, agreed_selling_price, other_property_details, oth_feature_3, buyer_offered_price, average date_sold, apt_feature_3, apt_feature_1, and maximum apt_feature_2 for properties where hse_feature_1 is not "None" or the address is "49578 Ayden Mountains New Russellhaven, UT 46626" and oth_feature_3 is not "None" or the property ID is not 9 or apt_feature_2 is not "suscipit" or the property name is not "wall street" or apt_feature_1 is "quos", and also for properties where the date on market is "1976-06-10 20:25:38" or oth_feature_3 is not "None" or hse_feature_2 is not "None" or oth_feature_2 is "None" and fld_feature_1 is not "None" and the vendor requested price is not 2198735.095 or fld_feature_2 is not "None" or shp_feature_1 is not "None" and the room count is 8 or shp_feature_2 is not "None" and oth_feature_1 is not "None" and the property ID is less than or equal to 15 and the address is not "49578 Ayden Mountains New Russellhaven, UT 46626"?

SELECT MAX(fld_feature_1), SUM(shp_feature_3), oth_feature_1, MIN(oth_feature_2), fld_feature_2, COUNT(property_name), shp_feature_1, hse_feature_2, MIN(vendor_requested_price), MAX(hse_feature_3), property_type_code, COUNT(fld_feature_3), date_on_market, agreed_selling_price, other_property_details, oth_feature_3, buyer_offered_price, AVG(date_sold), apt_feature_3, apt_feature_1, MAX(apt_feature_2) FROM Properties WHERE hse_feature_1 <> "None" OR property_address = "49578 Ayden Mountains New Russellhaven, UT 46626" AND oth_feature_3 <> "None" OR "property_id" <> 9 OR apt_feature_2 != "suscipit" OR property_name <> "wall street" OR apt_feature_1 = "quos" UNION SELECT MAX(fld_feature_1), SUM(shp_feature_3), oth_feature_1, MIN(oth_feature_2), fld_feature_2, COUNT(property_name), shp_feature_1, hse_feature_2, MIN(vendor_requested_price), MAX(hse_feature_3), property_type_code, COUNT(fld_feature_3), date_on_market, agreed_selling_price, other_property_details, oth_feature_3, buyer_offered_price, AVG(date_sold), apt_feature_3, apt_feature_1, MAX(apt_feature_2) FROM Properties WHERE date_on_market = "1976-06-10 20:25:38" OR oth_feature_3 != "None" OR hse_feature_2 <> "None" OR oth_feature_2 = "None" AND fld_feature_1 != "None" AND "vendor_requested_price" != 2198735.095 OR fld_feature_2 != "None" OR shp_feature_1 != "None" AND "room_count" = 8 OR shp_feature_2 <> "None" AND oth_feature_1 <> "None" AND "property_id" <= 15 AND property_address <> "49578 Ayden Mountains New Russellhaven, UT 46626"


Question: What are the driver IDs that are not 7 and are not found in the school bus table with driver IDs greater than 9?

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


Question: What is the highest player ID for players who are not named Matt Schaubroeck and are ranked 4th, and also what is the highest player ID from the player_coach table where the player ID is 4 or greater?

SELECT MAX(Player_ID) FROM player WHERE Player_name <> "Matt Schaubroeck" AND Rank = "4th" UNION ALL SELECT MAX(Player_ID) FROM player_coach WHERE "Player_ID" >= 4


Question: What are the principal activities, incorporation location, group equity shareholding, and type of companies that are either cargo companies incorporated in Hong Kong, excluding joint ventures, or companies with an ID less than or equal to 12, or a group equity shareholding of 100 or more, or the name "CLS Catering Services Limited"?

Cargo airline
Hong Kong
60.0
Joint Venture

Cargo airline
Hong Kong
100.0
Subsidiary

Catering services
Hong Kong
100.0
Subsidiary

Travel agency
Hong Kong
100.0
Subsidiary

Travel agency
Hong Kong
100.0
Subsidiary

Ground handling
Hong Kong
100.0
Subsidiary

Catering services
Canada
30.0
Joint Venture

SELECT Principal_activities, Incorporated_in, Group_Equity_Shareholding, Type FROM operate_company WHERE Type <> "Joint Venture" AND Incorporated_in = "Hong Kong" AND Principal_activities = "Cargo" UNION ALL SELECT Principal_activities, Incorporated_in, Group_Equity_Shareholding, Type FROM operate_company WHERE "id" <= 12 OR "Group_Equity_Shareholding" >= 100.0 OR name = "CLS Catering Services Limited"


Question: What are the branch IDs of branches that were not open in 2012, are not in London, or are not named Cochrane and have a membership amount other than 11, combined with the branch IDs from purchases where the member ID is not 3 or the year is 2018?

SELECT Branch_ID FROM branch WHERE Open_year != "2012" OR City != "London" OR Name != "Cochrane" AND membership_amount <> "11" UNION SELECT Branch_ID FROM purchase WHERE "Member_ID" <> 3 OR Year = "2018"


Question: What are the driver IDs that are present in both the driver and school bus tables, and are less than 9?

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


Question: What continents are not America and also not Australia, excluding the continent with ID 5?

SELECT Continent FROM continents WHERE Continent <> "america" INTERSECT SELECT Continent FROM continents WHERE Continent <> "australia" AND "ContId" != 5


Question: What is the average writer value and title for books where the issues are 4.0 and the title is "Michael Moorcock's Multiverse" or the writer is "Christopher Hinz" and the book ID is greater than or equal to 6, and also for books where the issues are less than 6.0 and the title is "The Black Lamb"?

SELECT AVG(Writer), Title FROM book WHERE "Issues" = 4.0 AND Title = "Michael Moorcock's Multiverse" OR Writer = "Christopher Hinz" AND "Book_ID" >= 6 UNION SELECT AVG(Writer), Title FROM book WHERE "Issues" < 6.0 AND Title = "The Black Lamb"


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

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


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

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


Question: What is the maximum user ID from reviews where the rank is not 1, the rating is less than 7, or the item ID is less than 4 and the user ID is greater than 2, excluding the maximum user ID from user accounts where the name is not Helen?

SELECT MAX(u_id) FROM review WHERE "rank" <> 1 OR "rating" < 7 OR "i_id" < 4 AND "u_id" > 2 EXCEPT SELECT MAX(u_id) FROM useracct WHERE name != "Helen"


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

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


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

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


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

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


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

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


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

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


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

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


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

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


Question: For companies, what are the maximum market value, average assets, maximum sales, the count of company IDs, the count of headquarters, the count of names, and the minimum profits, grouped by industry? Consider companies where the market value is not 180 or the profits are not 21.5, or the industry is Automotive, or the assets are less than 340.5, the company ID is not 4, and the sales are 102, but exclude industries where the minimum profits are 15.9. Also, include companies where profits are at least 10.3 and the market value is no more than 218, and the industry is not Oil and gas, excluding industries where the average assets are not 1867.55, or the maximum market value is greater than 213.7, and the count of company IDs is at least 1 and the count of names is less than 6, or the count of headquarters is not 1, or the minimum profits are no more than 11.1.

SELECT Industry, MAX(Market_Value_in_Billion), AVG(Assets_in_Billion), MAX(Sales_in_Billion), COUNT(Company_ID), COUNT(Headquarters), COUNT(Name), MIN(Profits_in_Billion) FROM company WHERE "Market_Value_in_Billion" <> 180.0 AND "Profits_in_Billion" <> 21.5 OR Industry = "Automotive" OR "Assets_in_Billion" < 340.5 AND "Company_ID" <> 4.0 AND "Sales_in_Billion" = 102.0 GROUP BY Industry HAVING MIN(Profits_in_Billion) <> 15.9 UNION SELECT Industry, MAX(Market_Value_in_Billion), AVG(Assets_in_Billion), MAX(Sales_in_Billion), COUNT(Company_ID), COUNT(Headquarters), COUNT(Name), MIN(Profits_in_Billion) FROM company WHERE "Profits_in_Billion" >= 10.3 AND "Market_Value_in_Billion" <= 218.0 AND Industry <> "Oil and gas" GROUP BY Industry HAVING AVG(Assets_in_Billion) <> 1867.5500000000002 OR MAX(Market_Value_in_Billion) > 213.7 AND COUNT(Company_ID) >= 1 AND COUNT(Name) < 6 OR COUNT(Headquarters) <> 1 OR MIN(Profits_in_Billion) <= 11.1


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

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


Question: Which driver IDs are less than or equal to 4 but are not driver IDs of any school buses with IDs less than 9?

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


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

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


Question: What are the aircraft IDs, excluding aircraft ID 2, from the aircraft table, combined with aircraft IDs greater than or equal to 1 from the airport_aircraft table?

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


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

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


Question: Give me the other details, the count of template IDs, the maximum document ID, and the document name for documents where the template ID is 25 or the document ID is greater than 801801, the document name isn't "Learning French", and the other details are "None", combined with the results for documents where the document name isn't "Palm reading" or the template ID is 14 or greater.

SELECT Other_Details, COUNT(Template_ID), MAX(Document_ID), Document_Name FROM Documents WHERE "Template_ID" = 25 OR "Document_ID" > 801801 AND Document_Name <> "Learning French" AND Other_Details = "None" UNION SELECT Other_Details, COUNT(Template_ID), MAX(Document_ID), Document_Name FROM Documents WHERE Document_Name != "Palm reading" OR "Template_ID" >= 14


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

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


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

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


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

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