Question: Which driver IDs are less than 2 in the driver list, but not driver ID 7 if it's in the school bus list?

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


Question: What are the driver IDs that are specifically 4 from the driver list, or less than 7 from the school bus list?

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 both the general driver list (excluding driver ID 5) and the school bus driver list (including only driver IDs 3 or higher)?

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


Question: What driver IDs are 11 or less from the driver list, but not less than 10 in the school bus list?

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


Question: What driver IDs are there besides 7, and also include 9 from the school bus records?

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


Question: What are the Driver IDs that are greater than 11 for drivers, or less than 10 for 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 < 10


Question: What aircraft IDs less than 3 from the aircraft table are not in the airport_aircraft table, excluding aircraft ID 2 from the airport_aircraft table?

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


Question: What are the driver IDs that are greater than 3 in the driver table, and also driver ID 10 from the school bus table?

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


Question: What driver IDs are 5 or greater, but are not among the school bus driver IDs that are less than 3?

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: What are the Driver IDs that are at least 5 from the driver table, and at least 9 from the school bus table, combined into a single list without duplicates?

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


Question: Tell me driver ID 12 if it's a driver, and driver ID 9 is not a school bus driver.

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: What are the names of companies with a market value of 202.2 billion dollars, as well as the names of all people except for person number 2?

SELECT Name FROM company WHERE "Market_Value_in_Billion" = 202.2 UNION ALL SELECT Name FROM people WHERE "People_ID" != 2


Question: What driver IDs are both not 2 and also less than or equal to 10, considering both driver and school bus records?

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


Question: Which driver IDs are less than 6 in the driver table but are not 10 or greater in the school bus table?

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


Question: What Aircraft IDs are number 3 in the aircraft table and number 2 or less in the airport_aircraft table?

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


Question: Please show me all driver IDs from the driver table except for driver ID 2, and also include driver ID 9 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 = 9


Question: Which driver IDs are 5 or lower in the driver table, or below 10 in the school bus table?

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


Question: What are the room names, bed types, maximum occupancies, and the lowest room IDs for rooms that are either not named 'CAS' or have a base price greater than 175?

MIN(RoomId) roomName bedType maxOccupancy

SELECT MIN(RoomId), roomName, bedType, maxOccupancy FROM Rooms WHERE RoomId != "CAS" UNION SELECT MIN(RoomId), roomName, bedType, maxOccupancy FROM Rooms WHERE "basePrice" > 175


Question: What Aircraft IDs are there, excluding ID 3 from the aircraft records, and also including IDs up to 1 from the airport aircraft records?

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


Question: What are the birth dates, person IDs, names, and nationalities of people who are not person number 5, or are born on August 8, 1986 and named Roman Bragin, or are not Russian, or are taller than 194?

August 16, 1982
2
Teodor Salparov
Bulgaria

January 22, 1987
4
Sergey Grankin
Russia

February 8, 1981
7
Semen Poltavskiy
Russia

August 8, 1986
5
Yevgeni Sivozhelez
Russia

February 8, 1981
7
Semen Poltavskiy
Russia

SELECT Birth_Date, People_ID, Name, Nationality FROM people WHERE "People_ID" <> 5 OR Birth_Date = "August 8, 1986" AND Name = "Roman Bragin" OR Nationality != "Russia" UNION ALL SELECT Birth_Date, People_ID, Name, Nationality FROM people WHERE "Height" > 194.0


Question: What driver IDs are both not equal to 5 and less than 10?

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


Question: What customer IDs meet specific conditions related to customer information, excluding those that also meet specific conditions related to lesson information?

SELECT customer_id FROM Customers WHERE cell_mobile_phone_number != "(780)719-4206x033" AND first_name != "Amya" OR customer_status_code <> "Good Customer" AND "amount_outstanding" <= 9500.0 OR phone_number != "753.921.0871" OR "customer_id" <> 3 OR email_address = "asha.kilback@example.org" AND last_name <> "Leuschke" EXCEPT SELECT customer_id FROM Lessons WHERE "vehicle_id" >= 1 AND "price" > 352.0 OR lesson_date = "2018-03-05 18:05:31" OR "staff_id" > 8 OR "lesson_id" = 7 AND "customer_id" < 9


Question: What are the Driver IDs that are greater than 12 or less than or equal to 3?

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


Question: What Driver IDs are either less than or equal to 1 in the driver table, or not equal to 3 in the school_bus table?

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


Question: Could you list the IDs of albums that are 'Tchaikovsky: The Nutcracker' and have an ID under 184, together with the IDs of employees who either have postal code 'T3B 1Y7', or are not from Lethbridge and weren't hired on '2002-05-01', or don't have the phone number '+1 (403) 262-3443' and live at '1111 6 Ave SW', or whose ID is not 1, or whose first name is not 'Margaret' and are not from Canada, or whose birth date is not '1973-07-01'?

SELECT id FROM albums WHERE "id" < 184 AND title = "Tchaikovsky: The Nutcracker" UNION ALL SELECT id FROM employees WHERE postal_code = "T3B 1Y7" OR city != "Lethbridge" AND hire_date <> "2002-05-01 00:00:00" OR phone != "+1 (403) 262-3443" AND address = "1111 6 Ave SW" OR "id" <> 1 OR first_name <> "Margaret" AND country <> "Canada" OR birth_date <> "1973-07-01 00:00:00"


Question: Which driver IDs of 7 or more are in the driver table but not in the school bus table (excluding driver ID 4)?

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


Question: What driver IDs are either 8 or less than 9, considering drivers and school bus drivers?

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


Question: What Aircraft IDs are at most 1 from aircraft, or at least 2 from airport aircraft?

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 money ranks and player IDs of poker players who earned more than $142,800 and are either not player number 5, or have a People ID less than 6, a Final Table Made count not equal to 19, Earnings up to $476,090, and a Money Rank not equal to 68?

SELECT Money_Rank, Poker_Player_ID FROM poker_player WHERE "Poker_Player_ID" <> 5 OR "People_ID" < 6 AND "Final_Table_Made" != 19.0 AND "Earnings" <= 476090.0 AND "Money_Rank" != 68.0 EXCEPT SELECT Money_Rank, Poker_Player_ID FROM poker_player WHERE "Earnings" <= 142800.0


Question: What aircraft IDs are 3 or greater 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 >= 3 EXCEPT SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID < 2


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

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


Question: For students, what are the city codes, average last names, majors, and advisor numbers for those who are either 22 or younger, or not from ROC, or named Tracy with a StuID of 1020 or greater and Advisor of 1148 or greater, along with those who are from DAL, have a StuID of 1016 or less, Advisor of 8772 or greater, and are not named Sarah?

SELECT city_code, AVG(LName), Major, Advisor FROM Student WHERE "Age" <= 22 AND "Major" >= 540 OR city_code != "ROC" OR "StuID" >= 1020 AND "Advisor" >= 1148 AND Fname = "Tracy" UNION ALL SELECT city_code, AVG(LName), Major, Advisor FROM Student WHERE city_code = "DAL" AND "StuID" <= 1016 AND "Advisor" >= 8772 AND Fname != "Sarah"


Question: What are the average coach name, gender, coach ID, and number of ranks for coaches who either have a rank greater than 2, are not male, are not named Joe Fabbri, are from club 1, or are coach 4, or are from a club with ID greater than 1?

SELECT AVG(Coach_name), Gender, Coach_ID, COUNT(Rank) FROM coach WHERE "Rank" > 2 OR Gender <> "M" OR Coach_name <> "Joe Fabbri" OR "Club_ID" = 1 OR "Coach_ID" = 4 UNION ALL SELECT AVG(Coach_name), Gender, Coach_ID, COUNT(Rank) FROM coach WHERE "Club_ID" > 1


Question: Please provide a list of Book IDs. Include those from the book table where the Book ID is greater than 5, or the writer is Garth Ennis and the number of issues is not 12. Also include Book IDs from the publication table where the Publication ID is less than 2, or the Book ID is 7 or less, the Publication Date is not August 2008, the Publisher is Wiley, and the Price is 4,100,000 or more.

SELECT Book_ID FROM book WHERE "Book_ID" > 5 OR Writer = "Garth Ennis" AND "Issues" != 12.0 UNION ALL SELECT Book_ID FROM publication WHERE "Publication_ID" < 2 OR "Book_ID" <= 7 AND Publication_Date <> "August 2008" AND Publisher = "Wiley" AND "Price" >= 4100000.0


Question: What aircraft IDs are less than 4 in the aircraft table but not ID 5 in the airport aircraft table?

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


Question: What is the count of employees who are either from Bristol, or at least 23 and named Matt Stevens and not employee ID 6, but only if this count is different from the count of hirings that started in 2009, or are employee ID greater than 6 and full-time, or shop ID 8?

SELECT COUNT(Employee_ID) FROM employee WHERE City = "Bristol" OR "Age" >= 23 AND "Employee_ID" <> 6 AND Name = "Matt Stevens" EXCEPT SELECT COUNT(Employee_ID) FROM hiring WHERE Start_from = "2009" OR "Employee_ID" > 6 AND Is_full_time = "T" OR "Shop_ID" = 8


Question: What document IDs are associated with draft copies that are either not document ID 12, or draft number 8, or not copy number 5, and also have a draft number that is not 1 and a copy number of 15 or more?

SELECT document_id FROM Draft_Copies WHERE "document_id" <> 12 OR "draft_number" = 8 OR "copy_number" <> 5 INTERSECT SELECT document_id FROM Draft_Copies WHERE "draft_number" != 1 AND "copy_number" >= 15


Question: What are the customer IDs for customers who are not 'Bad Customer' or have a phone number other than '374-483-2758x85087', or for lessons with staff ID 3 or higher, lesson ID less than 11, customer ID 11, price under 231.0, and vehicle ID 2?

SELECT customer_id FROM Customers WHERE phone_number != "374-483-2758x85087" OR customer_status_code <> "Bad Customer" UNION SELECT customer_id FROM Lessons WHERE "staff_id" >= 3 AND "lesson_id" < 11 AND "customer_id" = 11 AND "price" < 231.0 AND "vehicle_id" = 2


Question: Which driver IDs are 3 or less in the driver table, but are not also driver IDs less than 4 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 < 4


Question: What Aircraft IDs are 5 or greater in the aircraft table, along with Aircraft IDs that are 3 or less in the airport_aircraft table?

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


Question: What album IDs are there, excluding those from albums titled 'Beyond Good And Evil' or with ID 9, and also excluding any IDs that are genre IDs for 'World'?

SELECT id FROM albums WHERE title != "Beyond Good And Evil" OR "id" != 9 EXCEPT SELECT id FROM genres WHERE name = "World"


Question: Which driver IDs are drivers, excluding driver 11, but are not also school bus drivers with IDs greater than 9?

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: Which driver IDs are at least 7 in the driver list but not greater than 10 in the school bus list?

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


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

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


Question: Could you list all the Club IDs that are either less than 1, or from clubs not started in the year 2000, not in Russia, and not named Djurgårdens IF, together with Club IDs from coaches that are either greater than 5, or associated with a Club ID greater than 1, or not female?

SELECT Club_ID FROM club WHERE "Club_ID" < 1 OR "Start_year" <> 2000 AND Region <> "Russia" AND Club_name != "Djurgårdens IF" UNION ALL SELECT Club_ID FROM coach WHERE "Coach_ID" > 5 OR "Club_ID" > 1 OR Gender != "F"


Question: What are the register years and branch IDs for memberships that are either for any member or for branch 5, except in 2016, or for any branch other than 1 or for member 2, except in 2016?

SELECT Register_Year, Branch_ID FROM membership_register_branch WHERE "Member_ID" >= 1 OR Branch_ID = "5" AND Register_Year != "2016" UNION SELECT Register_Year, Branch_ID FROM membership_register_branch WHERE Branch_ID <> "1" OR "Member_ID" = 2 AND Register_Year != "2016"


Question: What are all the Driver IDs, excluding driver ID 11 from the drivers and driver ID 3 from the school bus drivers?

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


Question: What aircraft IDs are either 1 from the aircraft list or 3 or greater from the airport aircraft list?

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 lesson times, staff IDs, and lesson statuses for lessons that are either not lesson ID 7, or not lesson ID 8, or use vehicle ID 2, or are not completed, or cost 199 or less and are at 9 o'clock?

SELECT lesson_time, staff_id, lesson_status_code FROM Lessons WHERE "lesson_id" != 7 OR "vehicle_id" = 2 OR "price" <= 199.0 AND lesson_time = "9" UNION ALL SELECT lesson_time, staff_id, lesson_status_code FROM Lessons WHERE lesson_status_code != "Completed" OR "lesson_id" <> 8


Question: What is the count of target users with trust level 2, if it is different from the count of target users with target user ID of 5 or more and trust level greater than 4?

SELECT COUNT(target_u_id) FROM trust WHERE "trust" = 2 EXCEPT SELECT COUNT(target_u_id) FROM trust WHERE "target_u_id" >= 5 AND "trust" > 4


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


Question: What property type codes are both associated with properties having certain specific features, prices, locations, or sizes, and are also categorized as property types that are not houses or are described as apartments, flats, or condos?

SELECT property_type_code FROM Properties WHERE fld_feature_1 != "None" OR apt_feature_3 <> "None" OR oth_feature_2 = "None" AND hse_feature_3 <> "None" AND "vendor_requested_price" <= 150045.7568 AND "agreed_selling_price" = 4201.8 AND shp_feature_2 <> "None" OR property_name != "murray hill" AND oth_feature_3 <> "None" OR date_on_market != "1990-05-25 23:01:51" OR property_address <> "743 Ephraim Greens Anniemouth, HI 47084-3853" OR "room_count" > 7 OR property_type_code <> "Apartment" OR fld_feature_3 <> "None" INTERSECT SELECT property_type_code FROM Ref_Property_Types WHERE property_type_code <> "House" OR property_type_description = "Apartment, Flat, Condo, etc."


Question: Which driver IDs are 12 or less from the drivers, but not greater than 4 from the school bus drivers?

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


Question: What Driver IDs are in both the driver and school bus records and are between 4 and 8?

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 Aircraft IDs are both greater than 1 in the aircraft table and not equal to 1 in the airport aircraft table?

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


Question: Which driver IDs are greater than 6, but are not driver IDs that are 4 or less in the school bus list?

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


Question: Which driver IDs are both 3 or greater and associated with drivers, and also 9 or less and associated with school buses?

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


Question: Could you list all document status codes for documents that are either not document ID 23 and have receipt number '83', or are 'Paper' documents with other details not 'h'? Also, include document status codes from the reference list that are not 'working' and are not described as 'mailed late'.

SELECT document_status_code FROM Documents WHERE "document_id" <> 23 AND receipt_number = "83" OR other_details <> "h" AND document_type_code = "Paper" UNION ALL SELECT document_status_code FROM Ref_Document_Status WHERE document_status_description <> "mailed late" AND document_status_code <> "working"


Question: What aircraft IDs, that are 4 or less, are in the aircraft table but not in the airport aircraft table, if we ignore aircraft ID 5 in the airport aircraft table?

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


Question: What is the number of contestants not equal to 8, if this number is different from the number of votes for contestants 3 or higher with vote ID 1 or less on March 9, 2018 around 7pm?

SELECT COUNT(contestant_number) FROM CONTESTANTS WHERE "contestant_number" != 8 EXCEPT SELECT COUNT(contestant_number) FROM VOTES WHERE "contestant_number" >= 3 AND "vote_id" <= 1 AND created = "2018-03-09 19:03:40"


Question: What are the driver IDs that are greater than 6 or less than 9?

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, other than 3, are in the driver list but not driver ID 4 if driver ID 4 is in the school bus list?

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


Question: What is the aircraft ID if it is 3 and 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 Aircraft IDs are either less than 4 in the aircraft table or at least 1 in the airport_aircraft table?

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


Question: What is the common average Name for companies with specific financial characteristics and for people named Tim Naegeli?

SELECT AVG(Name) FROM company WHERE "Assets_in_Billion" <> 213.0 AND "Company_ID" <> 11.0 AND "Sales_in_Billion" > 147.3 OR Industry <> "Oil and gas" OR "Profits_in_Billion" = 41.1 OR Headquarters <> "USA" OR "Market_Value_in_Billion" = 237.4 INTERSECT SELECT AVG(Name) FROM people WHERE Name = "Tim Naegeli"


Question: For each category of Other Details, what is the lowest Document ID, considering categories from Documents where the lowest Document ID is at least 0, and also categories from Paragraphs where the lowest Document ID is less than 3?

SELECT MIN(Document_ID), Other_Details FROM Documents GROUP BY Other_Details HAVING MIN(Document_ID) >= 0 UNION SELECT MIN(Document_ID), Other_Details FROM Paragraphs GROUP BY Other_Details HAVING MIN(Document_ID) < 3


Question: For each car maker, what is the total ID and weight of their cars, considering only car makers with engine displacement greater than 156 and acceleration of 11.5, and only including cars that are either from 'American Motor Company', have less than 4 cylinders and are not 75 horsepower, are from 1982 or earlier, have an acceleration of 16.5 or less and a weight not equal to 2472, or are not from country '8' and are not made by Toyota?

SELECT SUM(T1.Id), T2.Weight FROM car_makers as T1 JOIN cars_data as T2 ON T1.Id = T2.Id WHERE FullName = "American Motor Company" OR "Cylinders" < 4 AND Horsepower <> "75" OR "Year" <= 1982 OR "Accelerate" <= 16.5 AND "Weight" <> 2472 OR Country <> "8" AND Maker <> "toyota" GROUP BY FullName HAVING Edispl > 156.0 AND Accelerate = 11.5


Question: Which People IDs are both for people who are Russian and not born on August 8, 1986, or not named Semen Poltavskiy, or 196.0 tall, and also for poker players who have a People ID of 5 or greater, or earnings not equal to 476090.0?

SELECT People_ID FROM people WHERE Nationality = "Russia" AND Birth_Date <> "August 8, 1986" OR Name != "Semen Poltavskiy" OR "Height" = 196.0 INTERSECT SELECT People_ID FROM poker_player WHERE "People_ID" >= 5 OR "Earnings" <> 476090.0


Question: Which Driver IDs are 8 or higher in the driver records, or not 4 in the school bus records?

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


Question: What driver IDs are 10 or less, or driver ID 7 from the school bus list?

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


Question: What is the total sum of member IDs, considering both members who are either named Johnny Williams or not from Columbia, South Carolina, and membership records that are either not from 2017 or not from branch 1?

SELECT SUM(Member_ID) FROM member WHERE Name = "Johnny Williams" OR Hometown != "Columbia, South Carolina" UNION ALL SELECT SUM(Member_ID) FROM membership_register_branch WHERE Register_Year != "2017" OR Branch_ID <> "1"


Question: What Driver IDs are 11 or greater from the driver list, or 9 or less from the school bus list?

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 driver IDs of drivers who are not driver 6, excluding those who are driver 9 in the school bus records?

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


Question: What are the IDs of clubs that are either club number 2 and include members with student IDs of 1010 or higher, or clubs with IDs greater than 1 that don't have any Vice-Presidents?

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


Question: What are the Aircraft IDs that are at least 1 from the aircraft records, or greater than 1 from the airport aircraft records?

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


Question: What driver IDs are in both the list of drivers (excluding driver ID 1) and the list of school bus drivers (only including IDs up to 10)?

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: Which driver IDs, up to 4, are drivers but not school bus drivers?

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 role descriptions are both for roles other than 'MG' and for 'PR' roles that are not 'Photo'?

SELECT role_description FROM Roles WHERE role_code <> "MG" INTERSECT SELECT role_description FROM Roles WHERE role_description != "Photo" AND role_code = "PR"


Question: Can you get me the continent IDs for continents that are not Africa or have an ID less than 3, and also for continents that are not Europe or have an ID not equal to 5?

SELECT ContId FROM continents WHERE Continent <> "africa" OR "ContId" < 3 UNION ALL SELECT ContId FROM continents WHERE Continent <> "europe" OR "ContId" <> 5


Question: What are the city areas for districts that either have a city population different from 328512 or a city area different from 10, or have a District ID less than 2, or are named 'Faisalabad District' with a city area not equal to 22, or have a city population not equal to 134936 and are headquartered in 'Bahawalnagar City'?

SELECT City_Area FROM district WHERE "City_Population" <> 328512.0 OR "City_Area" <> 10.0 UNION SELECT City_Area FROM district WHERE "District_ID" < 2 OR District_name = "Faisalabad District" AND "City_Area" <> 22.0 OR "City_Population" <> 134936.0 AND Headquartered_City = "Bahawalnagar City"


Question: For each mobile phone number, could you provide the count of payments that meet certain criteria, and where the mobile phone number itself also meets certain criteria?

SELECT COUNT(T1.amount_payment), T2.cell_mobile_phone_number FROM Customer_Payments as T1 JOIN Customers as T2 ON T1.customer_id = T2.customer_id WHERE payment_method_code <> "Direct Debit" AND datetime_payment = "2018-02-06 13:35:58" AND customer_status_code = "Good Customer" AND phone_number <> "(662)490-3108" OR "amount_payment" = 1708.18 AND date_became_customer = "2017-10-05 14:15:46" AND date_of_birth = "1998-09-18 04:45:01" OR "amount_outstanding" >= 9332.0 OR email_address = "kroberts@example.org" 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: Which Aircraft IDs, that are 3 or less, are listed 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 Aircraft IDs are either not 2 in the aircraft records, or greater than 3 in the airport aircraft records?

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 Driver IDs that are 4 or greater from the driver table, or less than 10 from the school bus table?

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


Question: What are the aircraft IDs that are specifically 3 from the aircraft table, and also the aircraft IDs that are 2 or greater from the airport_aircraft table?

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


Question: What driver IDs, numbered 9 or less, are listed as drivers but not as school bus drivers?

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 12 in the driver table, or less than 3 in the school bus table?

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


Question: What Aircraft ID is number 2 and is found in both the aircraft and airport_aircraft tables?

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


Question: What are the user IDs from reviews with item ID 1 or greater, or account ID greater than 5, and also user ID 7?

SELECT u_id FROM review WHERE "i_id" >= 1 OR "a_id" > 5 UNION SELECT u_id FROM useracct WHERE "u_id" = 7


Question: What are the driver IDs, combining drivers (except ID 7) and school bus drivers (except ID 10)?

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


Question: Could you find the School IDs that match either of these criteria: schools that are in IHSAA class AAA but not football class A, or have enrollment up to 605 and are not named Glenn, or have School ID 2, or are not in '75 Starke' County and Bremen; or endowments with a School ID of 3 or more, or an endowment ID greater than 4 and an amount other than 8.53, or a donor named Santiago?

SELECT School_id FROM School WHERE IHSAA_Class = "AAA" AND IHSAA_Football_Class <> "A" OR "Enrollment" <= 605 AND School_name <> "Glenn" OR School_id = "2" OR County <> "75 Starke" AND Location <> "Bremen" UNION ALL SELECT School_id FROM endowment WHERE "School_id" >= 3 OR "endowment_id" > 4 AND "amount" <> 8.53 OR donator_name = "Santiago"


Question: Are there any driver IDs that are number 10 and also greater than 4 on the school bus driver list?

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


Question: Which driver IDs, other than 4, are drivers but not school bus drivers with IDs greater 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 Aircraft ID is listed as greater than 4 in the aircraft table and also listed as 5 in the airport_aircraft table?

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


Question: What are the sum of People IDs, count of Final Table Made, Money Rank, average Poker Player ID, average Earnings, and Best Finish for poker players who either have a Money Rank of 68 or less and Earnings greater than 142800, or a Final Table Made count not equal to 10 and a Poker Player ID of 4 or less, or a People ID not equal to 2, but not if they also have a Money Rank less than 141 and a People ID not equal to 7?

SELECT SUM(People_ID), COUNT(Final_Table_Made), Money_Rank, AVG(Poker_Player_ID), AVG(Earnings), Best_Finish FROM poker_player WHERE "Money_Rank" <= 68.0 AND "Earnings" > 142800.0 OR "Final_Table_Made" != 10.0 AND "Poker_Player_ID" <= 4 OR "People_ID" <> 2 EXCEPT SELECT SUM(People_ID), COUNT(Final_Table_Made), Money_Rank, AVG(Poker_Player_ID), AVG(Earnings), Best_Finish FROM poker_player WHERE "Money_Rank" < 141.0 AND "People_ID" <> 7


Question: What is the total of car maker IDs and the horsepower for cars that have more than 4 cylinders, horsepower other than 105, or an acceleration of 18 seconds or more?

SELECT SUM(T1.Id), T2.Horsepower FROM car_makers as T1 JOIN cars_data as T2 ON T1.Id = T2.Id WHERE AVG(Cylinders) > 4 OR Horsepower <> "105" OR AVG(Accelerate) >= 18.0


Question: What aircraft IDs are either exactly 2 in the aircraft table, or greater than 1 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: What are the driver IDs of drivers who are not driver 2, excluding any driver IDs less than 3 that are also school bus drivers?

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 driver IDs are drivers, except for ID 3, but not school bus drivers with IDs 3 or more?

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


Question: What are the driver IDs of drivers who are not driver 10, but are not also drivers of school buses, excluding school bus driver 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 aircraft IDs are either less than 5 from the aircraft list or greater than 5 from the airport aircraft list?

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


Question: What aircraft IDs are in both the aircraft list (excluding ID 4) and the airport aircraft list (only IDs less than 2)?

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


Question: What are the aircraft IDs that are ID 4 in the aircraft table, or not ID 2 in the airport aircraft table?

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


Question: Can you give me the counts of feature IDs, the average property feature descriptions, and the property IDs for properties that satisfy either of these conditions: (1) the feature ID is less than 3, the property feature description is not 'corrupti', and the property ID is less than 13, or (2) the property ID is not 15, or the property feature description is not 'quo', or the feature ID is less than 3?

SELECT COUNT(feature_id), AVG(property_feature_description), property_id FROM Other_Property_Features WHERE "feature_id" < 3 AND property_feature_description != "corrupti" AND "property_id" < 13 UNION SELECT COUNT(feature_id), AVG(property_feature_description), property_id FROM Other_Property_Features WHERE "property_id" <> 15 OR property_feature_description != "quo" OR "feature_id" < 3


Question: What driver IDs between 3 and 11 are in both the driver and school bus lists?

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 driver IDs are less than 12 in the driver list, but not among the driver IDs that are 7 or less in the school bus list?

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


Question: What driver IDs are either 6, or at least 3 in the school bus list?

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


Question: What driver IDs are less than 12, except for driver ID 10 if it appears in the school bus records?

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


Question: What Driver IDs are at least 8 in the driver table, or at least 9 in the school_bus table?

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


Question: What are the driver IDs that are not 3, or are greater than 10 in the school bus list?

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


Question: Could you list all document IDs for documents that were mailed to address ID 2 or higher, or mailed on a date other than January 14, 1982 and have a document ID greater than 24? And also include document IDs for draft copies with draft number 1.

SELECT document_id FROM Documents_Mailed WHERE "mailed_to_address_id" >= 2 OR mailing_date != "1982-01-14 05:50:54" AND "document_id" > 24 UNION ALL SELECT document_id FROM Draft_Copies WHERE "draft_number" = 1


Question: What are the color pages per minute for the Xerox Travel Scanner 100 with a USB 2.0 interface and DPI greater than 600, or for products that are not A4 size, or not 280 x 95 x 40 in dimensions, or do not have 4 color pages per minute?

SELECT pages_per_minute_color FROM product WHERE product = "Xerox Travel Scanner 100" AND interface = "USB 2.0" AND "dpi" > 600.0 UNION ALL SELECT pages_per_minute_color FROM product WHERE max_page_size <> "A4" OR dimensions != "280 x 95 x 40" OR "pages_per_minute_color" != 4.0


Question: What company IDs belong to companies that are either not very asset-rich or have low profits but high sales, excluding those that have employment records with year 1, company ID less than 15, and people ID 7?

SELECT Company_ID FROM company WHERE "Assets_in_Billion" < 1563.9 OR "Profits_in_Billion" < 14.2 AND "Sales_in_Billion" >= 221.9 EXCEPT SELECT Company_ID FROM employment WHERE "Year_working" != 1 OR "Company_ID" >= 15 OR "People_ID" <> 7


Question: What company information, including market value, profits, industry, name, assets, and ID, is available for companies that have profits not equal to 15.9 billion, and also either have a market value greater than 201.9 billion or profits not equal to 31.7 billion?

SELECT Market_Value_in_Billion, Profits_in_Billion, Industry, Name, Assets_in_Billion, Company_ID FROM company WHERE "Profits_in_Billion" <> 15.9 INTERSECT SELECT Market_Value_in_Billion, Profits_in_Billion, Industry, Name, Assets_in_Billion, Company_ID FROM company WHERE "Market_Value_in_Billion" > 201.9 OR "Profits_in_Billion" != 31.7


Question: What are all the feature type names, including duplicates, that are either not 'Amenity, eg Pool.' or have a feature type code that is not 'Amenity'?

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


Question: What are the home cities of drivers who are named 'Angel Acre' or are not 52 years old, except for the home cities of drivers who are not named 'Timothy Ackert' and are younger than 52, or are not driver ID 6 and live in Hartford?

SELECT Home_city FROM driver WHERE Name = "Angel Acre" OR "Age" <> 52 EXCEPT SELECT Home_city FROM driver WHERE Name <> "Timothy Ackert" AND "Age" < 52 OR "Driver_ID" != 6 AND Home_city = "Hartford"


Question: What driver IDs are driver ID 10 but not also school bus driver IDs less than 7?

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


Question: List the Aircraft IDs that are in both the aircraft and airport_aircraft tables, and are greater than 3 in the aircraft table and not equal to 1 in the airport_aircraft table.

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


Question: What is the total enrollment and budget percentage budgeted for schools that are not 'Lions' or are 'New Prairie 1' schools with a budget percentage invested of 2.0% or less?

SELECT SUM(T1.Enrollment), T2.total_budget_percent_budgeted FROM School as T1 JOIN budget as T2 ON T1.School_id = T2.School_id WHERE Mascot <> "Lions" OR School_name = "New Prairie 1" AND "total_budget_percent_invested" <= 2.0


Question: Which driver IDs are 4 or less, and are not among the school bus driver IDs that are greater 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 IDs that are for flights that are either not piloted by Thompson, have a velocity over 240, and are at airport 2, or have a vehicle flight number other than 'M2-F1 #21', and also for operate companies with IDs greater than 6?

SELECT id FROM flight WHERE Pilot <> "Thompson" AND "Velocity" > 240.0 AND "airport_id" = 2 OR Vehicle_Flight_number <> "M2-F1 #21" INTERSECT SELECT id FROM operate_company WHERE "id" > 6


Question: What aircraft IDs are less than 2 in the aircraft table but not greater than 3 in the airport aircraft table?

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


Question: What driver IDs are both 7 and also less than or equal to 7?

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: What driver IDs are greater than 3 but are not driver IDs less than or equal to 9 in the school bus records?

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: Could you provide the shop feature 3, other property details, property address, shop feature 1, and other feature 1 for properties that satisfy either of two complex sets of conditions?

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

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

49578 Ayden Mountains
New Russellhaven, UT 46626

2765 Schulist Stream
Lindmouth, UT 03391-3817

6837 Darien Views Apt. 475
South Maraview, KS 77770

092 Paucek Highway Apt. 772
East Erika, IA 61358

24365 Ulices Run
Homenicktown, MD 88485-6198

107 Roob Courts
Erdmanburgh, IA 42926-0873

084 Lakin Vista Apt. 394
Fishertown, MA 16876

2088 Bashirian Fork Suite 337
Faustinoport, MT 16771-9320

743 Ephraim Greens
Anniemouth, HI 47084-3853

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

1474 Dibbert Fields Suite 055
South Renee, IN 58286-3097

986 Hagenes Drives
Draketon, UT 83411-3393

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

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

49578 Ayden Mountains
New Russellhaven, UT 46626

2765 Schulist Stream
Lindmouth, UT 03391-3817

6837 Darien Views Apt. 475
South Maraview, KS 77770

092 Paucek Highway Apt. 772
East Erika, IA 61358

24365 Ulices Run
Homenicktown, MD 88485-6198

107 Roob Courts
Erdmanburgh, IA 42926-0873

084 Lakin Vista Apt. 394
Fishertown, MA 16876

2088 Bashirian Fork Suite 337
Faustinoport, MT 16771-9320

743 Ephraim Greens
Anniemouth, HI 47084-3853

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

1474 Dibbert Fields Suite 055
South Renee, IN 58286-3097

986 Hagenes Drives
Draketon, UT 83411-3393

SELECT shp_feature_3, other_property_details, property_address, shp_feature_1, oth_feature_1 FROM Properties WHERE apt_feature_1 != "qui" AND shp_feature_1 <> "None" OR apt_feature_3 != "None" OR shp_feature_3 <> "None" OR oth_feature_2 != "None" OR property_name != "vogue" AND hse_feature_3 != "None" OR fld_feature_2 <> "None" AND "buyer_offered_price" != 0.0 AND "agreed_selling_price" != 170766.472 AND fld_feature_3 = "None" OR "room_count" < 7 AND hse_feature_2 != "None" OR date_on_market <> "1991-06-21 23:52:10" OR oth_feature_1 = "None" AND property_address = "084 Lakin Vista Apt. 394 Fishertown, MA 16876" OR fld_feature_1 != "None" OR shp_feature_2 <> "None" AND date_sold = "1995-01-31 11:18:42" OR "property_id" < 14 AND property_type_code <> "House" OR apt_feature_2 <> "sit" AND other_property_details <> "None" AND "vendor_requested_price" >= 305.0 OR oth_feature_3 != "None" OR hse_feature_1 <> "None" UNION ALL SELECT shp_feature_3, other_property_details, property_address, shp_feature_1, oth_feature_1 FROM Properties WHERE oth_feature_3 != "None" OR "vendor_requested_price" <> 305.0 AND apt_feature_3 != "None" AND "property_id" = 11 OR property_type_code = "Shop" OR apt_feature_1 != "nesciunt" AND other_property_details != "None" AND date_sold = "2003-02-27 18:17:11" AND shp_feature_3 != "None" OR hse_feature_2 <> "None" AND shp_feature_2 = "None" OR "buyer_offered_price" > 8.7122 AND apt_feature_2 <> "suscipit" AND hse_feature_3 <> "None" OR "agreed_selling_price" < 0.0 OR hse_feature_1 <> "None" OR property_address != "098 Tremaine Highway Suite 569 South Wilford, NJ 46587-3537" OR oth_feature_2 != "None" OR "room_count" > 9 AND date_on_market != "1994-02-14 02:27:13" OR oth_feature_1 <> "None" OR fld_feature_2 <> "None" AND fld_feature_1 != "None" OR fld_feature_3 != "None" AND property_name = "ten tower"


Question: What decorations are common to rooms that are either not for two beds, or are budget-friendly for singles, or are not the 'Harbinger but bequest' room with traditional decor and ID 'HBB', AND are also not queen bed type and not named 'Convoke and sanguine'?

SELECT decor FROM Rooms WHERE "beds" != 2 OR "basePrice" != 125 AND "maxOccupancy" < 2 OR roomName <> "Harbinger but bequest" AND decor <> "traditional" AND RoomId <> "HBB" INTERSECT SELECT decor FROM Rooms WHERE bedType != "Queen" AND roomName != "Convoke and sanguine"


Question: What are the document IDs for circulation history entries with employee IDs less than 1 and draft numbers less than 17, or for documents where other details are not 'h' and receipt numbers are not '55'?

SELECT document_id FROM Circulation_History WHERE "employee_id" < 1 AND "draft_number" < 17 UNION SELECT document_id FROM Documents WHERE other_details != "h" AND receipt_number != "55"


Question: What aircraft IDs are in the aircraft table, excluding ID 2, and are not among the aircraft IDs greater than 5 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 > 5


Question: What are the driver IDs that are at most 6 in the driver table and at most 7 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 <= 7


Question: What driver IDs are 8 or greater for drivers, but not 3 or less for school bus drivers?

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


Question: What are the driver IDs that are drivers, except for driver 9, but not school bus drivers, except for driver 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 driver IDs are less than 7, or driver ID 3 from the school bus records?

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


Question: What driver IDs are greater than 10 but are not also school bus driver IDs of 3 or more?

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: Could you list the customer ID, payment date and time, earliest payment method code, and payment amount for payments that are either for an amount less than 9886.62 and not made by 'Direct Debit', or where the payment date and time is not '2018-02-24 10:07:05', or the customer ID is not 14, or the payment method is 'Direct Debit' and the payment amount is not 9414.74?

SELECT customer_id, datetime_payment, MIN(payment_method_code), amount_payment FROM Customer_Payments WHERE "amount_payment" < 9886.62 AND payment_method_code != "Direct Debit" UNION ALL SELECT customer_id, datetime_payment, MIN(payment_method_code), amount_payment FROM Customer_Payments WHERE datetime_payment != "2018-02-24 10:07:05" OR "customer_id" <> 14 OR "amount_payment" <> 9414.74 AND payment_method_code = "Direct Debit"


Question: What document ID is number 2 and is recorded in both Circulation History (with either a draft number greater than 1 or a copy number less than 5) and Documents Mailed (with a mailed address ID greater than 4 and a mailing date not on May 24, 1993)?

SELECT document_id FROM Circulation_History WHERE "document_id" > 2 OR "draft_number" > 1 OR "copy_number" < 5 INTERSECT SELECT document_id FROM Documents_Mailed WHERE "document_id" = 2 AND "mailed_to_address_id" > 4 AND mailing_date != "1993-05-24 22:13:48"


Question: What are the Driver IDs that are greater than 11, or equal to 4 in the school_bus table?

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


Question: What document status descriptions are not 'done' and not 'mailed late'?

SELECT document_status_description FROM Ref_Document_Status WHERE document_status_code <> "done" EXCEPT SELECT document_status_description FROM Ref_Document_Status WHERE document_status_description = "mailed late"


Question: What driver IDs are on both the driver list, except for driver 8, and the school bus driver list, except for driver 9?

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


Question: What are the driver IDs that are less than 10, and not also driver IDs of 3 or more in the school bus records?

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 driver IDs are in both the list of drivers (excluding driver 6) and the list of school bus drivers (up to 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: What Driver IDs are either 5 or greater from the driver list, or not 3 from the school bus list?

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


Question: Which driver IDs are greater than 5, excluding those that are also school bus driver IDs less than 10?

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


Question: What are the aircraft IDs that are not 1 from the aircraft table, together with aircraft ID 5 from the airport_aircraft table?

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


Question: What aircraft IDs are both greater than 3 in the aircraft table and equal to 5 in the airport aircraft table?

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


Question: Which driver IDs, other than 1, are drivers but are not school bus drivers with IDs less than 3?

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


Question: What are the driver IDs that are greater than 10 in the driver table but are not also driver IDs of 3 or more in the school bus table?

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


Question: What are the group equity shareholding, incorporation country, and ID for cargo airlines that are not joint ventures and not from Hong Kong, as well as for companies from Taiwan or those involved in cargo business?

SELECT Group_Equity_Shareholding, Incorporated_in, id FROM operate_company WHERE Type <> "Joint Venture" AND Principal_activities = "Cargo airline" AND Incorporated_in != "Hong Kong" UNION SELECT Group_Equity_Shareholding, Incorporated_in, id FROM operate_company WHERE Incorporated_in = "Taiwan" OR Principal_activities = "Cargo"


Question: What aircraft IDs are 4 or more in the aircraft table, or exactly 3 in the airport_aircraft table?

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


Question: What driver IDs, other than 1, are drivers but not school bus drivers with IDs 9 or less?

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: Is driver ID 11 in the driver table but not among driver IDs 7 or greater 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: Which Book IDs are for books that are not 'Bloody Mary : Lady Liberty' and have an ID of 2 or less, but are not also associated with publications from Springer Nature in August 2008 costing 2 million or more?

SELECT Book_ID FROM book WHERE Title != "Bloody Mary : Lady Liberty" AND "Book_ID" <= 2 EXCEPT SELECT Book_ID FROM publication WHERE Publication_Date = "August 2008" AND Publisher = "Springer Nature" AND "Price" >= 2000000.0


Question: Which driver IDs are in the driver list, excluding 7, and are not among the school bus driver IDs that are greater than 10?

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


Question: Are there any drivers with ID 5 who are drivers but not school bus drivers, ignoring school bus driver ID 3?

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 less than 7 are drivers but not school bus driver 10?

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


Question: What aircraft IDs are 2 or greater in the aircraft table, or specifically 3 in the airport_aircraft table?

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


Question: What School IDs do we have for schools that are either not in '75 Starke' county, or are in New Carlisle with football class 'A' but not 'AAA' and a mascot other than 'Cavaliers', or have a School ID other than '4', or have less than 852 students enrolled, or are in the budget table with a budget invested percentage of '127.6'?

SELECT School_id FROM School WHERE County != "75 Starke" OR Mascot <> "Cavaliers" AND Location = "New Carlisle" AND IHSAA_Football_Class = "A" AND IHSAA_Class != "AAA" OR School_id != "4" OR "Enrollment" < 852 UNION SELECT School_id FROM budget WHERE Budget_invested_percent = "127.6"


Question: What are the aircraft IDs that are not 1 from the aircraft table, and also the aircraft IDs that are less than 1 from the airport aircraft table?

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


Question: What are the employee IDs, names, and average salaries of employees who have a salary greater than 99890, excluding Jennifer Thomas?

SELECT eid, name, AVG(salary) FROM employee WHERE "salary" > 99890 EXCEPT SELECT eid, name, AVG(salary) FROM employee WHERE name = "Jennifer Thomas"


Question: Are there any drivers with ID 8 who are not also school bus drivers, ignoring school bus driver 9?

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


Question: What Driver ID is 6 in the driver table but not among Driver IDs 1 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: What driver IDs are on both the driver and school bus lists, are 5 or less, and are not 10?

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


Question: What ranks are there based on certain conditions in match results or player information?

SELECT Rank FROM match_result WHERE "Points" <= 89 AND "Bronze" != 8 OR "Big_Silver" <> 11 OR "Small_Silver" = 10 OR "Club_ID" <= 2 AND "Rank" <> 4 UNION SELECT Rank FROM player WHERE Rank = "3rd" OR Gender <> "M" AND Sponsor_name != "Winnipeg South" AND Residence != "Oakbank" OR Occupation <> "Student" AND "Player_ID" >= 13 AND Player_name = "Niki Ashton" AND "Votes" <> 14097


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

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


Question: What are the driver IDs, removing driver ID 1 from the driver list and driver ID 7 from the school bus list?

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


Question: What are the Driver IDs that are 9 or less from the driver table, or are not 9 from the school bus table?

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


Question: Find the Aircraft ID that is 2 from the aircraft table, and also the Aircraft IDs that are not 5 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 <> 5


Question: What aircraft IDs, other than 4, are in the aircraft table but not among the aircraft IDs less than 2 in the airport_aircraft table?

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


Question: What Aircraft IDs are in both the aircraft and airport aircraft lists, are less than 5, and are not 1?

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


Question: What driver IDs are found in both the driver and school bus records and are 10 or less?

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 are 2 or higher in the driver table, but are not among the driver IDs that are 9 or higher in the school bus table?

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


Question: What driver IDs are greater than 5 from the drivers, excluding those driver IDs that are 9 or less from the school buses?

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


Question: What is the sum of shipping agent descriptions for agents described as 'q' and not coded 'SH', plus the sum of shipping agent descriptions for agents not coded 'UP'?

SELECT SUM(shipping_agent_description) FROM Ref_Shipping_Agents WHERE shipping_agent_description = "q" AND shipping_agent_code <> "SH" UNION ALL SELECT SUM(shipping_agent_description) FROM Ref_Shipping_Agents WHERE shipping_agent_code <> "UP"


Question: What are the Driver IDs that are greater than 9 for drivers or greater than 4 for school buses?

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


Question: Are there any drivers with ID 6 who are not also school bus drivers with IDs over 4?

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


Question: What are the driver IDs, excluding 2, and also including 9 from the school bus records?

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


Question: For which countries, based on airport information, is it true that: (a) when considering airports that are either not in Bergen, or not both 'LEBL' and 'National Airport', and grouping by country, the count of ICAO codes is 1 or the minimum airport ID is at most 6, AND (b) when considering airports that are not in Brussels, and grouping by country, the count of ICAO codes is at least 1?

SELECT COUNT(City), COUNT(ICAO), MIN(id), Country FROM airport WHERE City != "Bergen" OR ICAO != "LEBL" AND name != "National Airport" GROUP BY Country HAVING COUNT(ICAO) = 1 OR MIN(id) <= 6 INTERSECT SELECT COUNT(City), COUNT(ICAO), MIN(id), Country FROM airport WHERE City <> "Brussels" GROUP BY Country HAVING COUNT(ICAO) >= 1


Question: What are the driver IDs, other than 1, that are not also school bus driver IDs of 7 or greater?

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


Question: What are the details of rooms that are either under $175 and not modern, or not called "Thrift and accolade", or are modern, under $175, and don't have a king bed?

maxOccupancy beds roomName bedType basePrice RoomId

SELECT maxOccupancy, beds, roomName, bedType, basePrice, RoomId FROM Rooms WHERE "basePrice" < 175 AND decor <> "modern" OR roomName <> "Thrift and accolade" UNION ALL SELECT maxOccupancy, beds, roomName, bedType, basePrice, RoomId FROM Rooms WHERE bedType != "King" AND decor = "modern" AND "basePrice" < 175


Question: What are the names of all aircraft, excluding 'British Aerospace Jetstream 41', but also including any aircraft that are not 'Schwitzer 2-33' or have an aid of 6 or less or a distance other than 3383?

SELECT name FROM aircraft WHERE name != "British Aerospace Jetstream 41" UNION SELECT name FROM aircraft WHERE name != "Schwitzer 2-33" OR "aid" <= 6 OR "distance" != 3383


Question: What aircraft IDs are present in both the aircraft and airport aircraft lists, excluding ID 3 and being less than 5?

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


Question: Which driver IDs, other than 9, are in the driver list and are also driver ID 4 in the school bus list?

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


Question: What is the sum of ranks from match results that have either 66 or more points, or a rank greater than 3, at most 20 gold medals, at least 9 small silver medals, a club ID of 5 or more, and at least 10 bronze medals, minus the sum of ranks for players who are ranked '3rd'?

SELECT SUM(Rank) FROM match_result WHERE "Points" >= 66 OR "Rank" > 3 AND "Gold" <= 20 AND "Small_Silver" >= 9 AND "Club_ID" >= 5 AND "Bronze" >= 10 EXCEPT SELECT SUM(Rank) FROM player WHERE Rank = "3rd"


Question: Which Aircraft IDs are 3 or less and are also listed in the airport aircraft records?

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 are the Driver IDs, excluding ID 8 from the drivers, and including IDs greater than 10 from the school buses?

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


Question: What are the aircraft IDs that are less than 2 or 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: What are the unique Aircraft IDs that are not 5 in the aircraft table or greater than 2 in the airport_aircraft table?

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


Question: What driver IDs are both 2 or greater and also less than 9, considering driver and school bus information?

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


Question: What are the document IDs for drafts with ID 1, draft number 8 or less, and draft details not 'w', that are not also in the mailed documents that were either not sent to address 8, or mailed on March 20, 2007 with ID less than 12?

SELECT document_id FROM Document_Drafts WHERE "document_id" = 1 AND "draft_number" <= 8 AND draft_details <> "w" EXCEPT SELECT document_id FROM Documents_Mailed WHERE "mailed_to_address_id" <> 8 OR mailing_date = "2007-03-20 05:22:01" AND "document_id" < 12


Question: What driver IDs less than 12 are drivers but not school bus drivers, excluding driver ID 3 from the school bus driver list?

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


Question: What aircraft IDs are either 4 or greater from the aircraft table, or greater than 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: Which driver IDs, less than 12, are drivers but not school bus drivers when considering only school bus drivers with IDs less than 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 Aircraft IDs are in both the aircraft table (for IDs 5 or greater) and the airport_aircraft table (excluding ID 3)?

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


Question: What Aircraft IDs are there? Include Aircraft IDs from the aircraft table that are 1 or greater, and Aircraft IDs from the airport aircraft table that are not 5.

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


Question: What are the document IDs from circulation history entries that have either a draft number greater than 2, or an employee ID of 2 or less and a copy number greater than 4? Also, what are the document IDs from document drafts that have either a draft number less than 9, or are not document ID 1? Please list all of these document IDs.

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


Question: What aircraft IDs from the aircraft table are less than 2?

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


Question: What are the other details of documents that are not document ID 3, or not shipped by agent 'FE', or not in 'done' status? If none of those apply, then include documents only if they also have a receipt date other than 'July 27, 1996 03:30:40', a receipt number other than '124', and are of type 'CD'.  Exclude any results that are also 'b' in the employee information.

SELECT other_details FROM Documents WHERE "document_id" != 3 OR shipping_agent_code != "FE" OR document_status_code != "done" OR receipt_date <> "1996-07-27 03:30:40" AND receipt_number != "124" AND document_type_code = "CD" EXCEPT SELECT other_details FROM Employees WHERE other_details = "b"


Question: What are the driver IDs that are drivers, excluding driver 6, but not school bus drivers with IDs 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: What are the average role code, employee name, employee ID, and other details for employees who either have other details not equal to 'v', or whose name is not 'Erling' and employee ID is 1?

SELECT AVG(role_code), employee_name, employee_id, other_details FROM Employees WHERE other_details != "v" OR employee_name <> "Erling" INTERSECT SELECT AVG(role_code), employee_name, employee_id, other_details FROM Employees WHERE other_details != "v" OR "employee_id" = 1


Question: What driver IDs are 8 or greater and are drivers, but are not school bus drivers, ignoring school bus driver ID 9?

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


Question: What driver IDs are drivers with an ID less than 12, but are not also school bus drivers with an ID of 9 or less?

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


Question: What are the head IDs of heads born in California with a head ID of 3 or more, except for those who are in management department 2, not temporary acting, or have a management ID greater than 4?

SELECT head_ID FROM head WHERE "head_ID" >= 3 AND born_state = "California" EXCEPT SELECT head_ID FROM management WHERE "department_ID" = 2 OR temporary_acting != "Yes" OR "head_ID" > 4


Question: Which driver IDs under 3 are drivers but not school bus drivers, ignoring school bus driver ID 4?

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 aircraft IDs less than 5 are in the aircraft table but not aircraft ID 2 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 = 2


Question: What are the driver IDs, other than 1 from the driver list and other than 10 from the school bus list?

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


Question: Which driver IDs are in the driver table (excluding ID 8) but are not in the school bus table if their ID is greater 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 Aircraft IDs are below 5 in either the aircraft or airport aircraft table?

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


Question: What driver IDs are common to drivers with IDs greater than 2 and school bus drivers with IDs less than or equal to 3?

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


Question: What driver IDs are used for both drivers and school bus drivers, and are at least 3, but not 7?

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


Question: What are the total ICAO codes and cities of airports that are either ICAO code ENBR, not named 'El Prat Airport', not in Brussels, or have an ID other than 1 and IATA other than AEY, except for those that are either IATA code BWI or not in Akureri?

SELECT SUM(ICAO), City FROM airport WHERE ICAO = "ENBR" OR name <> "El Prat Airport" OR City <> "Brussels" OR "id" <> 1 AND IATA <> "AEY" EXCEPT SELECT SUM(ICAO), City FROM airport WHERE IATA = "BWI" OR City != "Akureyri"


Question: What aircraft IDs are greater than 3 in the aircraft table but not also found as aircraft IDs greater than 5 in the airport_aircraft table?

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


Question: List all Aircraft IDs that are either 3 or higher from the aircraft table, or other than 5 from the airport_aircraft table.

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


Question: What are the customer IDs of customers who are not customer 6 and don't have the mobile phone number '1-401-108-8016x078', or who have an outstanding amount over 5494.0, are not a 'Bad Customer', have an address ID greater than 13, and are named 'Rylan', or whose last name is not 'Kohler', unless they also have lessons that are not at time '5', or use vehicle 1, or are on '2018-03-12 00:41:59', or are not lesson ID 14?

SELECT customer_id FROM Customers WHERE "customer_id" <> 6 AND cell_mobile_phone_number != "1-401-108-8016x078" OR "amount_outstanding" > 5494.0 AND customer_status_code != "Bad Customer" AND "customer_address_id" > 13 AND first_name = "Rylan" OR last_name <> "Kohler" EXCEPT SELECT customer_id FROM Lessons WHERE lesson_time != "5" OR "vehicle_id" = 1 OR lesson_date = "2018-03-12 00:41:59" OR "lesson_id" <> 14


Question: What driver IDs are 2 in the driver table, and what driver IDs are not 10 in the school bus table?

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


Question: What Driver IDs are greater than 12 in the driver table, or are equal to 10 in the school_bus table?

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


Question: What driver IDs are 4 or less, excluding any driver IDs of 10 or more that are listed for school buses?

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


Question: What Driver IDs are 7 or higher in the driver table, or 10 or lower in the school bus table?

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


Question: What aircraft IDs are 5 or less in the aircraft table, but not less than 5 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 < 5


Question: What driver IDs are both less than or equal to 8 and not equal to 3?

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


Question: What aircraft IDs are greater than 3 in the aircraft table but not less than or equal to 1 in the airport aircraft table?

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


Question: What are the delegates, their represented counties, and committees for district 1, excluding Shane Pendergrass, and also for any election with an ID less than 1 or district less than 2?

Bates, Gail H. Gail H. Bates
09.1 9A
Appropriations

Miller, Warren E. Warren E. Miller
09.1 9A
Economic Matters

Pendergrass, Shane E. Shane Pendergrass
13
Health and Government Operations

SELECT Delegate, Counties_Represented, Committee FROM election WHERE "District" = 1 AND Delegate <> "Pendergrass, Shane E. Shane Pendergrass" UNION SELECT Delegate, Counties_Represented, Committee FROM election WHERE "Election_ID" < 1 OR "District" < 2


Question: What are driver ID 8 from the drivers and driver ID 3 from the school buses?

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


Question: What driver IDs are common to both drivers (excluding driver 7) and school bus drivers (up to driver 10)?

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 driver IDs are in both the driver list, excluding driver 8, and the school bus list, excluding driver 4?

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


Question: What are the Driver IDs that are less than 11 for drivers, or less than or equal to 4 for 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 <= 4


Question: What Aircraft IDs, larger than 1, are recorded in either the aircraft or airport_aircraft tables?

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


Question: What are the Driver IDs, except for Driver ID 5 and Driver ID 9, from both drivers and school buses?

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


Question: What are the Driver IDs that are greater than 9 from the driver list or greater than or equal to 7 from the school bus list?

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


Question: What driver IDs are both in the list of drivers, excluding driver 11, and the list of school bus drivers, including only IDs up 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 driver IDs are both in the drivers table with IDs up to 5 and in the school bus table with IDs up to 10?

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


Question: List all unique Aircraft IDs that are either at most 1 in the aircraft table, or not 1 in the airport aircraft table.

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


Question: What draft numbers are there for documents with IDs less than 13 and for document copies excluding document ID 10?

SELECT draft_number FROM Document_Drafts WHERE "document_id" < 13 UNION ALL SELECT draft_number FROM Draft_Copies WHERE "document_id" <> 10


Question: What driver IDs are greater than 1 in the driver table or less than 9 in the school bus table?

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


Question: What are the driver IDs of drivers who are not driver 8, but are not also school bus drivers with IDs up to 4?

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


Question: What driver IDs are 7 or less that are not school bus drivers (excluding ID 3)?

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


Question: What are the distinct Driver IDs that are greater than or equal to 6 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 >= 6 UNION SELECT Driver_ID FROM school_bus GROUP BY Driver_ID HAVING Driver_ID != 9


Question: What aircraft IDs are 5 or less in the aircraft table but not also 2 or less 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 <= 2


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

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


Question: For each trust value, what is the number of source users when the trust value is less than 2, and also when the target user ID is less than 2, the source user ID is at least 1, and the trust value is not 10?

SELECT trust, COUNT(source_u_id) FROM trust WHERE "trust" < 2 UNION ALL SELECT trust, COUNT(source_u_id) FROM trust WHERE "target_u_id" < 2 AND "source_u_id" >= 1 AND "trust" != 10


Question: What Driver IDs are 4 or greater in the driver table, or different from 4 in the school bus table?

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


Question: Can you give me the staff count and a nickname for two different groups of staff, where each group is defined by different conditions on staff details?

SELECT COUNT(last_name), nickname FROM Staff WHERE nickname != "ynader" OR last_name <> "Jast" AND "staff_id" >= 8 OR date_joined_staff <> "2017-12-22 03:06:32" UNION ALL SELECT COUNT(last_name), nickname FROM Staff WHERE nickname != "norma73" AND "staff_address_id" >= 6 AND date_of_birth != "2005-05-02 06:23:36" OR middle_name <> "Maiya" AND date_left_staff != "2018-03-06 23:17:41"


Question: What are the combined average ID and count of names for airports that are not Brussels airport, or not located in Barcelona, or are El Prat Airport, and for operating companies that are ID 11, or not from Hong Kong, or are ground handling companies with less than full equity share?

SELECT AVG(id), COUNT(name) FROM airport WHERE ICAO != "EBBR" OR City <> "Barcelona" OR name = "El Prat Airport" UNION SELECT AVG(id), COUNT(name) FROM operate_company WHERE "id" = 11 OR Incorporated_in <> "Hong Kong" OR Principal_activities = "Ground handling" AND "Group_Equity_Shareholding" < 100.0


Question: What driver IDs are less than 3 from the driver table, or not equal to 4 from the school_bus table?

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


Question: Among votes for contestant number 3 or higher from New Jersey, what is the total of phone numbers, along with the contestant number, earliest vote ID, and creation time, but only for those votes that were either created in New York at '2018-03-09 19:03:36' or have a phone number of 7148407040 or more?

SELECT SUM(phone_number), contestant_number, MIN(vote_id), created FROM VOTES WHERE created = "2018-03-09 19:03:36" AND state = "NY" OR "phone_number" >= 7148407040 EXCEPT SELECT SUM(phone_number), contestant_number, MIN(vote_id), created FROM VOTES WHERE "contestant_number" < 3 OR state != "NJ "


Question: What is the total sum of allergy type values specifically for tree pollen, excluding any allergy types labeled as "food"?

SELECT Allergy, SUM(AllergyType) FROM Allergy_Type WHERE Allergy <> "Milk" AND AllergyType != "food" EXCEPT SELECT Allergy, SUM(AllergyType) FROM Allergy_Type WHERE Allergy != "Tree Pollen"


Question: What Driver IDs are 11 or greater in the driver table, or 3 or greater in the school bus table?

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


Question: What are the Aircraft IDs? Include those from the aircraft table that are 5 or less, and those from the airport_aircraft table that are 5 or more.

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


Question: What driver IDs other than 7 are in the driver or school bus records?

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 not 1 in the driver table, or are 4 or greater in the school bus table?

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


Question: What are the document IDs for circulation history entries that are not draft 20, not by employee 2, have document ID 10 or greater, and are copy 15, or for overdue documents?

SELECT document_id FROM Circulation_History WHERE "draft_number" <> 20 AND "employee_id" != 2 AND "document_id" >= 10 AND "copy_number" = 15 UNION SELECT document_id FROM Documents WHERE document_status_code = "overdue"


Question: Which driver IDs less than 12 are not also driver IDs of 4 or more in the school bus records?

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


Question: What are the other property details, fld_feature_2, and fld_feature_1 for properties that satisfy a complex set of conditions related to their features?

SELECT other_property_details, fld_feature_2, fld_feature_1 FROM Properties WHERE apt_feature_1 = "et" OR property_name = "high line" OR date_sold != "1973-02-24 02:56:06" AND "buyer_offered_price" < 11375259.502 AND fld_feature_1 = "None" AND fld_feature_2 = "None" OR apt_feature_3 != "None" OR shp_feature_2 = "None" AND shp_feature_1 = "None" AND date_on_market <> "1994-02-14 02:27:13" AND property_address != "098 Tremaine Highway Suite 569 South Wilford, NJ 46587-3537" AND oth_feature_1 = "None" AND "room_count" > 7 AND fld_feature_3 <> "None" AND hse_feature_3 <> "None" OR oth_feature_2 = "None" AND "property_id" < 14 AND property_type_code <> "Other" OR hse_feature_1 = "None" AND other_property_details != "None" AND oth_feature_3 != "None" UNION SELECT other_property_details, fld_feature_2, fld_feature_1 FROM Properties WHERE hse_feature_2 <> "None" OR "agreed_selling_price" != 1.0012 AND hse_feature_1 <> "None" AND other_property_details != "None" AND oth_feature_1 <> "None" AND "property_id" < 3 OR apt_feature_1 != "nesciunt"


Question: What are the document IDs for documents that are not named 'Learning French', or that have details other than 'None' and a template ID less than 20?

SELECT Document_ID FROM Documents WHERE Document_Name != "Learning French" OR "Template_ID" < 20 IN (SELECT Document_ID FROM Documents WHERE Other_Details != "None")


Question: What are the Shop IDs and their full-time status for shops that are either part-time and shop ID 1, or not shop ID 1 and didn't start in 2009, or have part-time employees who are not employee 4?

SELECT Shop_ID, Is_full_time FROM hiring WHERE "Employee_ID" <> 4 AND Is_full_time = "F" OR "Shop_ID" <> 1 AND Start_from != "2009" UNION SELECT Shop_ID, Is_full_time FROM hiring WHERE Is_full_time != "T" AND "Shop_ID" = 1


Question: What driver IDs are in common between drivers with IDs of 4 or greater and school bus drivers with IDs of 10 or greater?

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


Question: Which driver IDs, other than 2, are drivers but not school bus drivers with IDs less than 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: Could you list the writer, book ID, total number of issues, and title for all books that are either not by Michael Moorcock or have 12 or more issues, except for books with less than 4 issues?

SELECT Writer, Book_ID, SUM(Issues), Title FROM book WHERE Writer != "Michael Moorcock" OR "Issues" >= 12.0 EXCEPT SELECT Writer, Book_ID, SUM(Issues), Title FROM book WHERE "Issues" < 4.0


Question: For each country that has either more than 2 IDs and at least 4 makers, or more than 4 IDs, what are the counts of makers, IDs, and full names?

COUNT(Maker) Country COUNT(Id) COUNT(FullName)

SELECT COUNT(Maker), Country, COUNT(Id), COUNT(FullName) FROM car_makers GROUP BY Country HAVING COUNT(Id) > 2 AND COUNT(Maker) >= 4 UNION ALL SELECT COUNT(Maker), Country, COUNT(Id), COUNT(FullName) FROM car_makers GROUP BY Country HAVING COUNT(Id) > 4


Question: What driver IDs are not 10 from the drivers or are greater than 3 from the school buses?

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


Question: What is driver ID for driver 8, if any?

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


Question: What are the sums of Club IDs for clubs in HHH and for members in Member_of_club who are either in club 2 and not Teaching Coordinators, or student 1007?

SELECT SUM(ClubID) FROM Club WHERE ClubLocation = "HHH" UNION ALL SELECT SUM(ClubID) FROM Member_of_club WHERE "ClubID" = 2 AND Position != "Teaching Coordinator" OR "StuID" = 1007


Question: What driver IDs are both less than 12 and greater than 3, considering driver and school bus information?

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


Question: What branch and member IDs are in the membership register for branch 6, members with ID 6 or higher, or the year 2016, but are not also in the purchase records, except for purchases made in 2018 from branch 5 or for members with member IDs greater than 2?

SELECT Branch_ID, Member_ID FROM membership_register_branch WHERE Branch_ID = "6" OR "Member_ID" >= 6 OR Register_Year = "2016" EXCEPT SELECT Branch_ID, Member_ID FROM purchase WHERE Year != "2018" OR Branch_ID != "5" AND "Member_ID" <= 2


Question: What driver IDs are not 5, or are 4 or less among school bus drivers?

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 driver IDs are greater than 9 in the driver table, and also driver ID 10 from the school bus table?

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


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

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


Question: What driver IDs are greater than 7 but are not among the school bus driver IDs, excluding driver ID 4 from the school bus drivers?

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 member IDs do we have for members who are either named Johnny Williams and don't have card number LT98, or are not from Red Jacket, West Virginia, or are not member ID 4 with a level below 4, or for purchases where the total pounds is not 988.09, or the year is not 2018, or the member ID is 4 or greater at branch 6?

SELECT Member_ID FROM member WHERE Card_Number != "LT98" AND Name = "Johnny Williams" OR Hometown != "Red Jacket, West Virginia" OR "Member_ID" != 4 AND "Level" < 4 UNION SELECT Member_ID FROM purchase WHERE "Total_pounds" <> 988.09 OR Year != "2018" OR "Member_ID" >= 4 AND Branch_ID = "6"


Question: What driver IDs are drivers other than driver 3 and also school bus drivers other than driver 4?

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


Question: Could you list the head ID, name, and born state for heads who are either named Sergio García and under 50, or whose head ID is not 5, or who are not from Delaware, or who are 43 or older, or whose head ID is not 1 and who are not from Alabama?

SELECT head_ID, name, born_state FROM head WHERE name = "Sergio García" AND "age" < 50.0 OR "head_ID" <> 5 OR born_state <> "Delaware" UNION ALL SELECT head_ID, name, born_state FROM head WHERE "age" >= 43.0 OR "head_ID" != 1 AND born_state != "Alabama"


Question: What customer IDs do we have for customers who meet a very specific set of criteria, or for lessons that meet another very specific set of criteria?

SELECT customer_id FROM Customers WHERE "customer_address_id" = 12 AND phone_number <> "(729)396-4354x3576" OR cell_mobile_phone_number <> "577-584-4864" AND "amount_outstanding" < 9500.0 OR customer_status_code != "Bad Customer" AND date_became_customer = "2017-04-16 05:12:21" AND email_address = "mayert.judy@example.com" AND date_of_birth <> "1993-07-09 11:11:36" AND "customer_id" <> 15 AND first_name <> "Dianna" AND last_name = "Kohler" UNION ALL SELECT customer_id FROM Lessons WHERE "customer_id" < 13 AND lesson_date = "2018-03-07 11:53:32" AND lesson_status_code <> "Cancelled" AND "lesson_id" >= 4 AND "staff_id" != 1 AND "vehicle_id" = 3


Question: What aircraft IDs, other than 5, are in the aircraft table but not in the airport_aircraft table, considering only aircraft IDs other than 1 in the airport_aircraft table?

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


Question: What driver IDs, other than 4, are drivers but are not driver 7 on school buses?

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


Question: What are the names of shop managers who satisfy both of these conditions: their shop is either not named 'FC KooTeePee', or it has 1600 or fewer products, is not in 'Veritas Stadion', is managed by 'Job Dragtsma', and has a Shop ID less than 3, or it's not in Jakobstad; and also, they are either named 'Antti Muurinen' or their shop is not in Valkeakoski?

SELECT Manager_name FROM shop WHERE Name != "FC KooTeePee" OR "Number_products" <= 1600 AND District != "Veritas Stadion" AND Manager_name = "Job Dragtsma" AND "Shop_ID" < 3 OR Location != "Jakobstad" INTERSECT SELECT Manager_name FROM shop WHERE Manager_name = "Antti Muurinen" OR Location != "Valkeakoski"


Question: Which driver IDs, that are less than 4, are drivers but not school bus drivers with IDs up to 3?

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