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

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 template type codes that are not "PPT" and have a description other than "CV", along with the template type codes of templates with IDs greater than or equal to 14 and a type code of "PPT"?

SELECT Template_Type_Code FROM Ref_Template_Types WHERE Template_Type_Code != "PPT" AND Template_Type_Description != "CV" UNION SELECT Template_Type_Code FROM Templates WHERE "Template_ID" >= 14 AND Template_Type_Code = "PPT"


Question: What are the name, branch ID, opening year, road address, and membership amount for branches named "Cochrane" that didn't open in 2009, and also for branches named "Alexandre" that are not on "Concord Road" or don't have a branch ID of 8 or a membership amount of 91?

SELECT Name, Branch_ID, Open_year, Address_road, membership_amount FROM branch WHERE Name = "Cochrane" AND Open_year <> "2009" UNION ALL SELECT Name, Branch_ID, Open_year, Address_road, membership_amount FROM branch WHERE Name = "Alexandre" AND Address_road != "Concord Road" AND "Branch_ID" != 8 OR membership_amount != "91"


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

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


Question: What are the car models that are not "chevrolet" or have a MakeId of 44, and also the "renault" models made by maker 5?

SELECT Model FROM car_names WHERE Model != "chevrolet" OR "MakeId" = 44 UNION ALL SELECT Model FROM model_list WHERE "Maker" = 5 AND Model = "renault"


Question: What are the driver IDs that are either less than or equal to 7, or not equal to 10, considering both the driver and 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 <> 10


Question: What are the driver IDs that are less than 12 from the driver table, combined with the driver IDs that are not equal to 4 from the school bus table?

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


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

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


Question: What Volkswagen models are not Plymouth Satellite Sebring and also have a MakeId other than 235, and what Peugeot models are available?

SELECT Model FROM car_names WHERE Make != "plymouth satellite sebring" AND Model = "volkswagen" OR "MakeId" <> 235 INTERSECT SELECT Model FROM model_list WHERE Model = "peugeot"


Question: What are the aircraft IDs that are not 4 and are not present in the airport_aircraft table with an ID other than 5?

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


Question: What are the IDs of airports that are not in Baltimore or have an ICAO code other than EKBI, and also have flights operated by companies with IDs greater than 9?

SELECT id FROM airport WHERE City <> "Baltimore" OR ICAO != "EKBI" INTERSECT SELECT id FROM flight WHERE "company_id" > 9


Question: What are the aircraft IDs that are greater than or equal to 1 in the aircraft table, combined with the aircraft IDs that are less than or equal to 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 are the driver IDs that are either less than or equal to 6, or are present in the school bus table but not equal to 7?

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


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

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


Question: Which driver IDs are present in both the driver and school bus tables, excluding driver ID 10 from the driver table and only including driver IDs less than or equal to 10 from the school bus table?

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


Question: Which driver IDs, excluding driver ID 1, are present in both the driver and school bus tables, with the school bus driver IDs being 7 or less?

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


Question: What are the driver IDs that are greater than 1 and also appear in the school bus table, excluding driver ID 4?

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


Question: What are the driver IDs, where one driver ID is 2 from the driver table and another driver ID is 10 from the school bus table?

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


Question: What are the employee ID, copy number, document ID, and draft number for records where the document ID is less than 20 or the employee ID is not 2, and also the employee ID is not 8?

SELECT employee_id, copy_number, document_id, draft_number FROM Circulation_History WHERE "document_id" < 20 OR "employee_id" != 2 INTERSECT SELECT employee_id, copy_number, document_id, draft_number FROM Circulation_History WHERE "employee_id" <> 8


Question: Which driver IDs are present in both the driver and school bus tables, excluding driver ID 5 from the driver table and including only driver IDs greater than or equal to 7 from the school bus table?

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


Question: What are the aircraft IDs that are both aircraft ID 1 and not aircraft ID 3, considering aircraft and airport aircraft information?

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


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

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


Question: What is the sum of role codes and employee IDs for employees where other details are not "b", or the employee name is "Koby", or the employee ID is 7? Also, what is the sum of role codes and employee IDs for employees where the employee name is not "Haley", the employee ID is 8, the role code is not "ED", and other details are not "u"?

SELECT SUM(role_code), employee_id FROM Employees WHERE other_details != "b" OR employee_name = "Koby" OR "employee_id" = 7 UNION SELECT SUM(role_code), employee_id FROM Employees WHERE employee_name <> "Haley" AND "employee_id" = 8 AND role_code <> "ED" AND other_details != "u"


Question: What is the lowest branch ID for purchases where the total pounds are over 321.13 and the branch ID is 6, or the member ID is not 4, or the year is 2018? Also, what is the lowest branch ID for purchases where the year is 2018, or the member ID is less than 1, or the branch ID is not 2, or the total pounds is not 430.29?

SELECT MIN(Branch_ID) FROM purchase WHERE "Total_pounds" > 321.13 AND Branch_ID = "6" OR "Member_ID" != 4 OR Year = "2018" UNION ALL SELECT MIN(Branch_ID) FROM purchase WHERE Year = "2018" OR "Member_ID" < 1 OR Branch_ID != "2" OR "Total_pounds" != 430.29


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

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


Question: What is the highest store ID for stores with ID 1 and a number of product categories not equal to 793, combined with the highest store ID for products not associated with store ID 3?

SELECT MAX(Store_ID) FROM store WHERE "Store_ID" = 1 AND "Number_of_product_category" <> 793.0 UNION SELECT MAX(Store_ID) FROM store_product WHERE "Store_ID" <> 3


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

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


Question: What are the album titles and IDs that are not "Let There Be Rock" and have an artist ID less than 127 and an ID less than or equal to 326, combined with the employee IDs and titles where the city isn't Calgary or the postal code isn't T2P 5M5 or the phone number isn't "+1 (403) 262-3443" or the country is Canada and the last name isn't Johnson and the state is AB or the hire date isn't "2002-08-14 00:00:00" or the first name is Nancy and the address isn't "683 10 Street SW" and the birth date isn't "1965-03-03 00:00:00" and the reports to isn't 2 or the fax isn't "+1 (403) 263-4289" and the ID is 6 or the title is "Sales Support Agent"?

Alcohol Fueled Brewtality Live! [Disc 1]

Alcohol Fueled Brewtality Live! [Disc 2]

The Best Of Buddy Guy - The Millenium Collection

Cássia Eller - Coleção Sem Limite [Disc 2]

Knocking at Your Back Door: The Best Of Deep Purple in the 80's

My Way: The Best Of Frank Sinatra [Disc 1]

Quanta Gente Veio ver--Bônus De Carnaval

A TempestadeTempestade Ou O Livro Dos Dias

Lulu Santos - RCA 100 Anos De Música - Álbum 01

Lulu Santos - RCA 100 Anos De Música - Álbum 02

Seek And Shall Find: More Of The Best (1963-1981)

From The Muddy Banks Of The Wishkah live

Radio Brasil (O Som da Jovem Vanguarda) - Seleccao de Henrique Amaro

SELECT id, title FROM albums WHERE title <> "Let There Be Rock" AND "artist_id" < 127 AND "id" <= 326 UNION SELECT id, title FROM employees WHERE city != "Calgary" OR postal_code != "T2P 5M5" AND phone <> "+1 (403) 262-3443" OR country = "Canada" AND last_name <> "Johnson" AND state = "AB" OR hire_date <> "2002-08-14 00:00:00" OR first_name = "Nancy" AND address <> "683 10 Street SW" AND birth_date <> "1965-03-03 00:00:00" AND "reports_to" != 2.0 OR fax != "+1 (403) 263-4289" AND "id" = 6 OR title = "Sales Support Agent"


Question: Which driver IDs are greater than 1, and also include driver ID 3?

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


Question: What are the driver IDs that are both less than 11 and also appear in the school bus table with driver IDs less than or equal to 4?

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


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

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


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

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


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

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


Question: What are the different role codes, excluding "PT" roles and employees named "Haley", combined with the role codes for "MG" roles or roles that are not "Editor"?

SELECT role_code FROM Employees WHERE role_code <> "PT" AND employee_name != "Haley" UNION SELECT role_code FROM Roles WHERE role_code = "MG" OR role_description != "Editor"


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

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


Question: What is the sum of the role codes for employees where other details are "u" or the role code is "ED" and the employee ID is greater than 5, combined with the sum of the role codes for roles with the description "Photo" but not "ED"?

SELECT SUM(role_code) FROM Employees WHERE other_details = "u" OR role_code = "ED" AND "employee_id" > 5 UNION ALL SELECT SUM(role_code) FROM Roles WHERE role_description = "Photo" AND role_code <> "ED"


Question: What are the aircraft IDs that appear in both the aircraft and airport_aircraft tables, where the aircraft ID is less than or equal to 5 in the aircraft table and greater than or equal to 1 in the airport_aircraft table?

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


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

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


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

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


Question: What are the property IDs that have a property feature description other than "cumque" and property ID 6, combined with the property IDs where the house feature 3 is not "None" or apartment feature 2 is not "iusto" or other feature 1 is not "None" or room count is not 5 or agreed selling price is 456840888.16 or the date sold is not "2012-08-19 07:36:57" and buyer offered price is greater than 2.0 or apartment feature 3 is not "None" or other feature 2 is "None" or house feature 2 is "None"?

SELECT property_id FROM Other_Property_Features WHERE "property_id" = 6 AND property_feature_description <> "cumque" UNION ALL SELECT property_id FROM Properties WHERE hse_feature_3 <> "None" OR apt_feature_2 != "iusto" OR oth_feature_1 != "None" OR "room_count" != 5 OR "agreed_selling_price" = 456840888.16 OR date_sold != "2012-08-19 07:36:57" AND "buyer_offered_price" > 2.0 AND apt_feature_3 <> "None" OR oth_feature_2 = "None" OR hse_feature_2 = "None"


Question: What are the names of contestants whose number is 2 or greater, excluding Kelly Clauss, and also the names of contestants whose number is less than 5, excluding Kurt Walser?

SELECT contestant_name FROM CONTESTANTS WHERE "contestant_number" >= 2 AND contestant_name <> "Kelly Clauss" UNION SELECT contestant_name FROM CONTESTANTS WHERE "contestant_number" < 5 AND contestant_name <> "Kurt Walser"


Question: What are the driver IDs that are greater than or equal to 6, excluding those driver IDs that are not equal to 7 and are associated with a school bus?

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


Question: What are the aircraft IDs that are either 3 or not 3?

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


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

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


Question: What are the driver IDs greater than 1, and also what are the driver IDs greater than 10?

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


Question: Which company IDs are from the banking industry and have an ID less than 15 or assets over 193.4 billion, or have worked for a year other than 2?

SELECT Company_ID FROM company WHERE Industry = "Banking" AND "Company_ID" < 15.0 OR "Assets_in_Billion" > 193.4 UNION SELECT Company_ID FROM employment WHERE "Year_working" != 2


Question: What are the pet IDs, ages, and average pet types for pets that are not dogs and weigh at least 9.3, or have a PetID of 2001 or greater, excluding those that are not cats or have a PetID of 2002 and are at least 1 year old?

SELECT PetID, pet_age, AVG(PetType) FROM Pets WHERE PetType <> "dog" AND "weight" >= 9.3 OR "PetID" >= 2001 EXCEPT SELECT PetID, pet_age, AVG(PetType) FROM Pets WHERE PetType <> "cat" OR "PetID" = 2002 AND "pet_age" >= 1


Question: What are the driver IDs, excluding driver ID 9, and also those driver IDs less than 9, that are associated with either drivers or 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 < 9


Question: Which continents are not the second continent or are Australia, and also are not the third continent or are not America?

SELECT Continent FROM continents WHERE "ContId" <> 2 OR Continent = "australia" INTERSECT SELECT Continent FROM continents WHERE "ContId" != 3 OR Continent != "america"


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

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: What are all the property type codes, excluding those described as "House, Bungalow, etc." and also excluding the code "House"?

SELECT property_type_code FROM Ref_Property_Types WHERE property_type_description != "House, Bungalow, etc." UNION ALL SELECT property_type_code FROM Ref_Property_Types WHERE property_type_code != "House"


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

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


Question: Which driver IDs are both less than or equal to 9 and also equal to 9?

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


Question: What are the branch IDs that were not open in 2015, and also the branch IDs where member IDs are less than or equal to 8 and the branch ID is not 6, or the registration year is not 2016?

SELECT Branch_ID FROM branch WHERE Open_year != "2015" UNION ALL SELECT Branch_ID FROM membership_register_branch WHERE "Member_ID" <= 8 AND Branch_ID <> "6" OR Register_Year != "2016"


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

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


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

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


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

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


Question: Show me the name, level, card number, member ID, and hometown for members who meet any of the following criteria: their member ID is not 9, or their card number isn't RCB32 and their level is 4 or less, or their hometown isn't Red Jacket, West Virginia, or their name is Johnny Williams. Also, include the name, level, card number, member ID, and hometown for members whose member ID is not 8 and their name is Myron Pryor, or their level is 6 or less.

SELECT Name, Level, Card_Number, Member_ID, Hometown FROM member WHERE "Member_ID" != 9 OR Card_Number <> "RCB32" AND "Level" <= 4 OR Hometown <> "Red Jacket, West Virginia" OR Name = "Johnny Williams" UNION ALL SELECT Name, Level, Card_Number, Member_ID, Hometown FROM member WHERE "Member_ID" <> 8 AND Name = "Myron Pryor" OR "Level" <= 6


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

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


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

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


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

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


Question: Can you list the major, student ID, advisor, age, last name, sex, city code, and first name for students who either aren't from Philadelphia or are male, or have a student ID greater than or equal to 1005 and a first name other than Shiela, or are age 22 or younger, don't have advisor 8722, and don't have the last name Lee? Also, include the same information for students where the advisor is 1148 or less and the last name isn't Kim, or are older than 17 and have a major of 600 and a first name other than Eric, or have a student ID less than 1027 and are male?

Major StuID Advisor Age LName Sex city_code Fname

SELECT Major, StuID, Advisor, Age, LName, Sex, city_code, Fname FROM Student WHERE city_code != "PHL" OR Sex = "M" OR "StuID" >= 1005 AND Fname <> "Shiela" OR "Age" <= 22 AND "Advisor" != 8722 AND LName <> "Lee" UNION ALL SELECT Major, StuID, Advisor, Age, LName, Sex, city_code, Fname FROM Student WHERE "Advisor" <= 1148 AND LName != "Kim" OR "Age" > 17 AND "Major" = 600 AND Fname != "Eric" OR "StuID" < 1027 AND Sex = "M"


Question: What are the driver IDs that are not 11 and also appear in the school bus table with IDs less than or equal to 10?

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


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

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


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

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


Question: What are the aircraft IDs, excluding aircraft ID 1, that are present in both the aircraft and airport_aircraft tables, with the airport_aircraft IDs being less than or equal to 3?

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


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

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


Question: What are the aircraft IDs that are in the aircraft table but not in the airport_aircraft table, excluding aircraft ID 4 from the aircraft table and aircraft ID 2 from the airport_aircraft table?

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


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

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


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

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


Question: What are the IATA, name, Country, ICAO, id, and City for Bergen Airport, and also for any airport where the ICAO is not EHAM, or the name is Akureyri Airport and the country is Netherlands, or the id is greater than 8, or the city is Baltimore and the IATA code is BGO?

AEY
Akureyri Airport
Iceland
BIAR
1
Akureyri

ANC
Ted Stevens Airport
United States
PANC
3
Anchorage

BCN
El Prat Airport
Spain
LEBL
5
Barcelona

BLL
Billund Airport
Denmark
EKBI
7
Billund

BOS
Logan International Airport
United States
KBOS
8
Boston

BRU
National Airport
Belgium
EBBR
9
Brussels

BWI
Baltimore-Washington Airport
United States
KBWI
4
Baltimore

SELECT IATA, name, Country, ICAO, id, City FROM airport WHERE name = "Bergen Airport" UNION SELECT IATA, name, Country, ICAO, id, City FROM airport WHERE ICAO != "EHAM" OR name = "Akureyri Airport" AND Country = "Netherlands" OR "id" > 8 OR City = "Baltimore" AND IATA = "BGO"


Question: What are the customer IDs and payment methods for customers with IDs less than or equal to 2 and payment amounts not equal to 5475.26, combined with those for customers with IDs less than 2, or a payment date other than "2018-02-05 18:44:46", or using "Direct Debit", or with a payment amount of 9414.74?

SELECT customer_id, payment_method_code FROM Customer_Payments WHERE "customer_id" <= 2 AND "amount_payment" != 5475.26 UNION ALL SELECT customer_id, payment_method_code FROM Customer_Payments WHERE "customer_id" < 2 AND datetime_payment != "2018-02-05 18:44:46" OR payment_method_code = "Direct Debit" OR "amount_payment" = 9414.74


Question: What are the property details, including type, market date, features, prices, and address, for properties that meet any of the following criteria:  shp_feature_3 is not "None" and the property type is "Apartment" and hse_feature_1 is "None", or the vendor requested price is greater than 192374065.8, or the date sold is not "2012-08-19 07:36:57" and the address is not "084 Lakin Vista Apt. 394 Fishertown, MA 16876" and apt_feature_2 is "est", or fld_feature_1 is not "None" and shp_feature_1 is "None" and oth_feature_1 is "None", or shp_feature_2 is not "None" and other_property_details is not "None", or fld_feature_3 is not "None", or hse_feature_2 is not "None", or the room count is less than 9, or apt_feature_1 is "sed", or the property name is not "the cole" and oth_feature_2 is not "None", or oth_feature_3 is not "None", or hse_feature_3 is "None", or fld_feature_2 is not "None", or the date on market is "2016-05-24 09:57:45"; or properties where shp_feature_2 is "None", or oth_feature_2 is not "None" and oth_feature_3 is "None", or the date sold is not "1997-01-07 19:52:45" and apt_feature_2 is "aut" and hse_feature_3 is "None" and shp_feature_3 is "None", or the vendor requested price is less than 13.4715, or the property name is not "wall street", or apt_feature_1 is not "et" and the room count is less than 1 and shp_feature_1 is not "None" and fld_feature_2 is not "None", or other_property_details is not "None" and the agreed selling price is not 170766.472 and the address is not "2088 Bashirian Fork Suite 337 Faustinoport, MT 16771-9320" and apt_feature_3 is not "None", or hse_feature_2 is not "None"?

24365 Ulices Run
Homenicktown, MD 88485-6198

107 Roob Courts
Erdmanburgh, IA 42926-0873

986 Hagenes Drives
Draketon, UT 83411-3393

084 Lakin Vista Apt. 394
Fishertown, MA 16876

2765 Schulist Stream
Lindmouth, UT 03391-3817

743 Ephraim Greens
Anniemouth, HI 47084-3853

49578 Ayden Mountains
New Russellhaven, UT 46626

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

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

2088 Bashirian Fork Suite 337
Faustinoport, MT 16771-9320

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

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

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

6837 Darien Views Apt. 475
South Maraview, KS 77770

092 Paucek Highway Apt. 772
East Erika, IA 61358

SELECT property_type_code, date_on_market, oth_feature_1, other_property_details, vendor_requested_price, date_sold, apt_feature_1, hse_feature_1, shp_feature_2, shp_feature_1, buyer_offered_price, property_address, apt_feature_2, property_name, fld_feature_3, apt_feature_3, hse_feature_2, oth_feature_2, room_count, oth_feature_3, shp_feature_3, fld_feature_2, fld_feature_1, property_id, agreed_selling_price, hse_feature_3 FROM Properties WHERE shp_feature_3 <> "None" AND property_type_code = "Apartment" AND hse_feature_1 = "None" OR "vendor_requested_price" > 192374065.8 OR date_sold <> "2012-08-19 07:36:57" AND property_address <> "084 Lakin Vista Apt. 394 Fishertown, MA 16876" AND apt_feature_2 = "est" OR fld_feature_1 != "None" AND shp_feature_1 = "None" AND oth_feature_1 = "None" OR shp_feature_2 != "None" AND other_property_details <> "None" OR fld_feature_3 != "None" OR hse_feature_2 <> "None" OR "room_count" < 9 OR apt_feature_1 = "sed" OR property_name != "the cole" AND oth_feature_2 <> "None" OR oth_feature_3 <> "None" OR hse_feature_3 = "None" OR fld_feature_2 <> "None" OR date_on_market = "2016-05-24 09:57:45" UNION SELECT property_type_code, date_on_market, oth_feature_1, other_property_details, vendor_requested_price, date_sold, apt_feature_1, hse_feature_1, shp_feature_2, shp_feature_1, buyer_offered_price, property_address, apt_feature_2, property_name, fld_feature_3, apt_feature_3, hse_feature_2, oth_feature_2, room_count, oth_feature_3, shp_feature_3, fld_feature_2, fld_feature_1, property_id, agreed_selling_price, hse_feature_3 FROM Properties WHERE shp_feature_2 = "None" OR oth_feature_2 <> "None" AND oth_feature_3 = "None" OR date_sold <> "1997-01-07 19:52:45" AND apt_feature_2 = "aut" AND hse_feature_3 = "None" AND shp_feature_3 = "None" OR "vendor_requested_price" < 13.4715 OR property_name != "wall street" OR apt_feature_1 <> "et" AND "room_count" < 1 AND shp_feature_1 <> "None" AND fld_feature_2 != "None" OR other_property_details <> "None" AND "agreed_selling_price" <> 170766.472 AND property_address != "2088 Bashirian Fork Suite 337 Faustinoport, MT 16771-9320" AND apt_feature_3 != "None" OR hse_feature_2 != "None"


Question: Which driver IDs are not equal to 9 and are not in the school bus table where the driver ID is less than 9?

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


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

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: Which driver IDs are less than or equal to 7, or which driver IDs are greater than 7, considering both drivers and school buses?

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 album IDs where the artist ID is greater than 91, but not in playlists with an ID less than 14 or a name that isn't "Music"?

SELECT id FROM albums WHERE "artist_id" > 91 EXCEPT SELECT id FROM playlists WHERE "id" < 14 OR name <> "Music"


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

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


Question: Which driver IDs are both less than or equal to 8 and also not equal to 10, considering driver IDs from the driver and school bus tables?

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


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

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


Question: What is the average number of final tables made, the sum of money rank, the poker player ID, and the sum of earnings for poker players who either made at least 42 final tables and have a poker player ID of 5, or have a money rank not equal to 58, or have earnings greater than or equal to 142800 and a people ID of 1 and a best finish less than 3, or have earnings greater than 142800 and a money rank greater than 166?

SELECT AVG(Final_Table_Made), SUM(Money_Rank), Poker_Player_ID, SUM(Earnings) FROM poker_player WHERE "Final_Table_Made" >= 42.0 AND "Poker_Player_ID" = 5 OR "Money_Rank" != 58.0 OR "Earnings" >= 142800.0 AND "People_ID" = 1 AND "Best_Finish" < 3.0 UNION SELECT AVG(Final_Table_Made), SUM(Money_Rank), Poker_Player_ID, SUM(Earnings) FROM poker_player WHERE "Earnings" > 142800.0 AND "Money_Rank" > 166.0


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

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


Question: What are the aircraft IDs that are greater than or equal to 1, and also the aircraft ID 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 IDs of drivers, excluding driver ID 1, and also the IDs of school buses, excluding ID 7?

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


Question: What are the customer IDs of customers who paid by a method other than "Direct Debit" on "2018-02-27 20:08:53", combined with the customer IDs of customers whose date of birth is not "1995-07-17 12:13:16" or whose phone number is not "+14(5)2351480248" and amount outstanding is not 8144.0 or whose cell mobile phone number is not "081-097-3684" or whose customer status code is not "Bad Customer"?

SELECT customer_id FROM Customer_Payments WHERE payment_method_code != "Direct Debit" AND datetime_payment = "2018-02-27 20:08:53" UNION SELECT customer_id FROM Customers WHERE date_of_birth <> "1995-07-17 12:13:16" OR phone_number != "+14(5)2351480248" AND "amount_outstanding" <> 8144.0 OR cell_mobile_phone_number <> "081-097-3684" OR customer_status_code != "Bad Customer"


Question: What are the aircraft IDs that are less than 2, excluding those aircraft IDs greater than 3?

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


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

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


Question: What are the aircraft IDs, excluding aircraft ID 1, that are in the aircraft table, combined with the aircraft IDs, excluding aircraft ID 3, that are 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 <> 3


Question: What are the football class and enrollment for schools that are not AAA and not in Bourbon, or have a different school ID and are not AAA, not named Culver Community, and not in Marshall County, excluding schools that are not AAA and not in Bourbon, or have a school ID of 1 and a different enrollment than 316?

SELECT IHSAA_Football_Class, Enrollment FROM School WHERE IHSAA_Football_Class <> "AAA" AND Location != "Bourbon" OR School_id <> "5" AND IHSAA_Class != "AAA" AND School_name <> "Culver Community" AND County <> "50 Marshall" EXCEPT SELECT IHSAA_Football_Class, Enrollment FROM School WHERE IHSAA_Class != "AAA" AND Location <> "Bourbon" OR School_id = "1" AND "Enrollment" != 316


Question: What are the aircraft IDs that are greater than or equal to 2, but not equal to 1 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 != 1


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

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


Question: What are the maximum feature descriptions, excluding those that are "Air Conditioning" or not of type "Security", combined with the maximum feature descriptions that are not "BurglarAlarm" and have a feature ID other than 3 or are of type "Amenity"?

SELECT MAX(feature_description) FROM Other_Available_Features WHERE feature_description <> "Air Conditioning." OR feature_type_code <> "Security" UNION ALL SELECT MAX(feature_description) FROM Other_Available_Features WHERE feature_name <> "BurglarAlarm" AND "feature_id" <> 3 OR feature_type_code = "Amenity"


Question: What are the names of contestants whose contestant number is both less than or equal to 11 and greater than or equal to 11?

SELECT contestant_name FROM CONTESTANTS WHERE "contestant_number" <= 11 INTERSECT SELECT contestant_name FROM CONTESTANTS WHERE "contestant_number" >= 11


Question: Which driver IDs are equal to 12 but not less than 7, considering driver IDs from the driver table and school bus table?

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


Question: Which driver IDs are present in both the driver and school bus tables, excluding driver ID 7, but only considering driver IDs less than 4?

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


Question: What are the aircraft IDs that are less than 3 in the aircraft table, combined with the aircraft ID 2 from the airport_aircraft table?

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


Question: Which document IDs were mailed to an address ID greater than 3, or mailed on January 1st, 2007 at 22:32:11, or are not document ID 12, but are not draft copies with draft number 20 and a document ID less than 1?

SELECT document_id FROM Documents_Mailed WHERE "mailed_to_address_id" > 3 OR mailing_date = "2007-01-01 22:32:11" OR "document_id" != 12 EXCEPT SELECT document_id FROM Draft_Copies WHERE "draft_number" = 20 AND "document_id" < 1


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

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


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

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


Question: What is the total of Big_Silver where Bronze is 6, or Small_Silver is greater than 10 and Gold is not 20 and Points is not 168 and Big_Silver is 14, or Club_ID is at least 6? Also, what is the total of Big_Silver where Gold is 7 and Bronze is less than 9 and Points is not 66 and Small_Silver is less than 16?

SELECT SUM(Big_Silver) FROM match_result WHERE "Bronze" = 6 OR "Small_Silver" > 10 AND "Gold" <> 20 AND "Points" <> 168 AND "Big_Silver" = 14 OR "Club_ID" >= 6 UNION ALL SELECT SUM(Big_Silver) FROM match_result WHERE "Gold" = 7 AND "Bronze" < 9 AND "Points" <> 66 AND "Small_Silver" < 16


Question: Which driver IDs are present in either the driver table (excluding ID 6) or the school bus table (excluding ID 10)?

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


Question: What are the aircraft IDs that are less than 2 and also appear in the airport aircraft table with IDs no greater than 3?

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


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

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


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

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


Question: What are the aircraft IDs that are both less than 4 and greater than 1, considering only aircraft IDs present in both the aircraft and airport aircraft tables?

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


Question: What are the driver IDs, where one ID is 6 from the driver table, and another ID is 9 from the school bus table?

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


Question: What are the Election IDs and Delegates from the election table where the first elected year was 2003 or the election ID was less than or equal to 8 and the district was greater than or equal to 2, combined with the Election IDs and Delegates where the election ID was 7 or the counties represented was not "12.1 12A" or the delegate was not "Bates, Gail H. Gail H. Bates" and the committee was not "Environmental Matters (Vice-Chair)" or the party was not 7 or the first elected year was less than or equal to 2003?

DeBoy, Steven J. Sr. Steven J. DeBoy, Sr.

Malone, James E. Jr. James E. Malone, Jr.

SELECT Election_ID, Delegate FROM election WHERE "First_Elected" = 2003.0 OR "Election_ID" <= 8 AND "District" >= 2 UNION SELECT Election_ID, Delegate FROM election WHERE "Election_ID" = 7 OR Counties_Represented != "12.1 12A" OR Delegate != "Bates, Gail H. Gail H. Bates" AND Committee != "Environmental Matters (Vice-Chair)" OR "Party" != 7 OR "First_Elected" <= 2003.0


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

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


Question: What is the sum of Club IDs for clubs located in HHH, excluding the sum of Club IDs for members with a StuID less than 1001 and a position of Teaching Coordinator?

SELECT SUM(ClubID) FROM Club WHERE ClubLocation = "HHH" EXCEPT SELECT SUM(ClubID) FROM Member_of_club WHERE "StuID" < 1001 AND Position = "Teaching Coordinator"


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

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


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

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


Question: What are the document type codes for documents that are not overdue and shipped by US, or have a document ID greater than or equal to 13, a receipt number not equal to 93, a receipt date of September 15, 1976, and other details not equal to 'n', excluding those document type codes where the document type description is 'b' and the code is not 'Paper'?

SELECT document_type_code FROM Documents WHERE document_status_code <> "overdue" AND shipping_agent_code = "US" OR "document_id" >= 13 AND receipt_number != "93" AND receipt_date = "1976-09-15 19:24:17" AND other_details <> "n" EXCEPT SELECT document_type_code FROM Ref_Document_Types WHERE document_type_description = "b" AND document_type_code != "Paper"


Question: Which employee IDs received a bonus less than 3200 or were not awarded in 2015, but not those who received a bonus of 3200 or more, were awarded in 2017, or have an ID other than 1?

SELECT Employee_ID FROM evaluation WHERE "Bonus" < 3200.0 OR Year_awarded != "2015" EXCEPT SELECT Employee_ID FROM evaluation WHERE "Bonus" >= 3200.0 OR Year_awarded = "2017" OR Employee_ID <> "1"


Question: What are the draft details, document IDs, and draft numbers for drafts where the draft number is not 0 or the document ID is not 2, combined with drafts where the draft number is less than 14 or the draft details are "m" and the document ID is 17 or greater?

SELECT draft_details, document_id, draft_number FROM Document_Drafts WHERE "draft_number" <> 0 OR "document_id" != 2 UNION SELECT draft_details, document_id, draft_number FROM Document_Drafts WHERE "draft_number" < 14 OR draft_details = "m" AND "document_id" >= 17


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

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


Question: Which driver IDs are greater than 7 and are also present in the school bus table with driver IDs greater than 3?

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


Question: What is the total of AllergyType, excluding "animal" or "Ragweed", combined with the total of AllergyType, excluding "Grass Pollen" and "animal"?

SELECT SUM(AllergyType) FROM Allergy_Type WHERE AllergyType <> "animal" OR Allergy != "Ragweed" UNION ALL SELECT SUM(AllergyType) FROM Allergy_Type WHERE Allergy <> "Grass Pollen" AND AllergyType <> "animal"


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

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


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

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


Question: What are the document IDs from the 'Documents' table where the receipt number is "69", other details are not "u", document type code is not "Paper", document status code is "done", document ID is greater than or equal to 7, or the receipt date is "1999-04-17 14:19:32"? Also, what are the document IDs from the 'Documents_Mailed' table where the document ID is less than 12 or the mailing date is "1973-02-21 10:17:01" and the mailed to address ID is not 2? Combine both sets of document IDs.

SELECT document_id FROM Documents WHERE receipt_number = "69" OR other_details != "u" OR document_type_code <> "Paper" OR document_status_code = "done" OR "document_id" >= 7 OR receipt_date = "1999-04-17 14:19:32" UNION ALL SELECT document_id FROM Documents_Mailed WHERE "document_id" < 12 OR mailing_date = "1973-02-21 10:17:01" AND "mailed_to_address_id" <> 2


Question: What are the driver IDs that are less than 7, considering both drivers and school buses, and combining the results?

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 IDs of drivers, excluding driver 5, and the IDs of school bus drivers, excluding driver 4?

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


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

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


Question: What are the target user IDs and trust values from the trust table where the source user ID is greater than 1 or the trust value is not 10 and the target user ID is at least 3, combined with the target user IDs and trust values where the target user ID is less than 3 or the source user ID is greater than 1 and the trust value is less than 1?

SELECT target_u_id, trust FROM trust WHERE "source_u_id" > 1 OR "trust" != 10 AND "target_u_id" >= 3 UNION SELECT target_u_id, trust FROM trust WHERE "target_u_id" < 3 OR "source_u_id" > 1 AND "trust" < 1


Question: What are the driver IDs greater than 7, considering both drivers and school buses, and combining the results?

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 aircraft IDs greater than 3 in the aircraft table, combined with the aircraft IDs that are at least 5 in the airport_aircraft table?

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


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

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


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

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


Question: What are the aircraft IDs greater than 2 that are not present in the airport aircraft table with aircraft IDs less than or equal to 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 driver IDs that are both less than or equal to 9 in the driver table and less than 9 in the school bus table?

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


Question: What are the school IDs for schools in the AAA class that are not in Marshall County or have a mascot other than Jimmies and are in the AAAA football class, combined with the school IDs from the budget table where the school ID is 2, or the invested amount is not 8335, or the total budget percentage budgeted is not 2.0, or the budgeted amount is less than or equal to 4979 and the year is before 2001, or the budget invested percentage is 42.9, or the total budget percentage invested is not 2.0?

SELECT School_id FROM School WHERE IHSAA_Class = "AAA" AND County <> "50 Marshall" OR Mascot <> "Jimmies" AND IHSAA_Football_Class = "AAAA" UNION SELECT School_id FROM budget WHERE "School_id" = 2 OR "Invested" <> 8335 AND "total_budget_percent_budgeted" != 2.0 OR "Budgeted" <= 4979 AND "Year" < 2001 OR Budget_invested_percent = "42.9" OR "total_budget_percent_invested" <> 2.0


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

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


Question: Which driver IDs are not equal to 1 but are not also driver ID 4?

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


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

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


Question: Which driver IDs are not equal to 11 but are not found in school buses with driver IDs greater than or equal to 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: What are the aircraft IDs that are either less than or equal to 4 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 <= 4 UNION SELECT Aircraft_ID FROM airport_aircraft GROUP BY Aircraft_ID HAVING Aircraft_ID > 1


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

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


Question: Which driver IDs are present in both the driver and school bus tables, excluding driver ID 9 from the driver table and including driver IDs greater than or equal to 7 from the school bus table?

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


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

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


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

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


Question: What are the driver IDs that are less than 9, excluding those driver IDs that are 7 or less, considering driver information from the 'driver' table and school bus information from the 'school_bus' table?

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


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

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


Question: What are the driver IDs that appear in both the driver table (with IDs no greater than 11) and the school bus table (with IDs less than 9)?

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


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

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


Question: What are the aircraft IDs, names, and distances for aircraft that are either named "Schwitzer 2-33" or have a distance less than 4103, and also for aircraft that are not named "Piper Archer III" or have an ID less than or equal to 10?

SELECT aid, name, distance FROM aircraft WHERE name = "Schwitzer 2-33" OR "distance" < 4103 INTERSECT SELECT aid, name, distance FROM aircraft WHERE name != "Piper Archer III" OR "aid" <= 10


Question: What are the head IDs, birth states, names, and ages of heads who either weren't born in California or have a head ID of 3 or greater, and also have a head ID of 5 or were not born in Connecticut?

SELECT head_ID, born_state, name, age FROM head WHERE born_state <> "California" OR "head_ID" >= 3 INTERSECT SELECT head_ID, born_state, name, age FROM head WHERE "head_ID" = 5 OR born_state != "Connecticut"


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

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


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

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


Question: What are the aircraft IDs that are not equal to 4, but are not present in the airport_aircraft table with an aircraft ID of 2?

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


Question: What are the driver IDs that are less than or equal to 7, excluding those driver IDs that are greater than or equal to 9?

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


Question: What are the driver IDs that are equal to 6, but not driver IDs greater than 10, considering the driver and school bus information?

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


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

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


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

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


Question: Which driver IDs are equal to 9, or are less than 7?

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


Question: What are the aircraft IDs, excluding aircraft ID 1, that are also present in the airport aircraft table, excluding aircraft ID 3?

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


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

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


Question: What are the aircraft IDs that are both less than or equal to 5 and also appear in the airport aircraft table with IDs less than or equal to 3?

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


Question: What are the aircraft IDs that are either aircraft ID 2 or any aircraft ID except 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 are the IDs of drivers, excluding driver ID 2, and the IDs of school bus drivers, excluding driver ID 4?

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: Give me the name, creation date, department ID, budget in billions, and number of employees for departments that were not created in 1903 and are not named "Commerce", or have a ranking of 4 or less, excluding those with 208,000 or more employees, or named "Energy", or with a budget not equal to 10.7, or created in 1953, or with a ranking of 9 or more and a department ID less than 15.

SELECT Name, Creation, Department_ID, Budget_in_Billions, Num_Employees FROM department WHERE Creation != "1903" AND Name != "Commerce" OR "Ranking" <= 4 EXCEPT SELECT Name, Creation, Department_ID, Budget_in_Billions, Num_Employees FROM department WHERE "Num_Employees" >= 208000.0 OR Name = "Energy" OR "Budget_in_Billions" <> 10.7 OR Creation = "1953" OR "Ranking" >= 9 AND "Department_ID" < 15


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

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


Question: Which driver IDs, excluding driver ID 1, are associated with drivers, and which driver IDs, excluding driver ID 3, are associated with school buses?

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


Question: What are the employee IDs of employees who received a bonus of 3200 but are not employee ID 2, excluding those with an employee ID greater than 6?

SELECT Employee_ID FROM evaluation WHERE Employee_ID != "2" AND "Bonus" = 3200.0 EXCEPT SELECT Employee_ID FROM hiring WHERE "Employee_ID" > 6


Question: Which driver IDs are present in both the 'driver' table (where the ID is less than 10) and the 'school_bus' table (where the ID is not 9)?

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


Question: What are the flight numbers of flights that are not going to Honolulu, have a flight number less than 13, an airline ID greater than 10, and a distance not equal to 1749, or departed on April 12, 2005 at 9:15 AM, excluding flight number 33?

SELECT flno FROM flight WHERE destination <> "Honolulu" AND "flno" < 13 AND "aid" > 10 AND "distance" != 1749 OR departure_date = "04/12/2005 09:15" EXCEPT SELECT flno FROM flight WHERE "flno" <> 33


Question: What are the driver IDs greater than 3 that are in the driver table but not in the school bus table, where the school bus driver IDs are greater than 10?

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


Question: Which driver IDs are less than or equal to 4, excluding those with IDs less than 10 in the school bus records?

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


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

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


Question: How many companies meet these criteria: profits over 11.1 billion, assets under 2265.8 billion and company ID less than 5, or market value less than or equal to 170.1 billion and sales not equal to 62.4 billion and name is Berkshire Hathaway, or headquarters is not Brazil? Also, how many people graduated from a college other than Virginia or are from the United Kingdom and are not 31 years old?

SELECT COUNT(Name) FROM company WHERE "Profits_in_Billion" > 11.1 OR "Assets_in_Billion" > 2265.8 AND "Company_ID" < 5.0 AND Industry <> "Oil and gas" OR "Market_Value_in_Billion" <= 170.1 AND "Sales_in_Billion" <> 62.4 AND Name = "Berkshire Hathaway" OR Headquarters != "Brazil" UNION ALL SELECT COUNT(Name) FROM people WHERE Graduation_College <> "Virginia" OR Nationality = "United Kindom" AND "Age" <> 31


Question: Give me the customer status code, amount outstanding, and date they became a customer for all customers who meet at least one of the following criteria: their first name isn't Leif, their date of becoming a customer isn't November 30, 2016 at 10:37:41, their cell phone number is 739-333-6966x187 and their amount outstanding is less than or equal to 9443.0, or their customer address ID is greater than or equal to 9 and their customer ID is greater than or equal to 3, or their date of birth is September 19, 1988 at 14:45:56, or their last name isn't Kohler, or their customer status code is "Good Customer" and their email address isn't everette.goyette@example.org and their phone number isn't (662)490-3108, but exclude those who have a customer address ID greater than 1 and a phone number of 1-618-535-9750, or a cell phone number that is not (780)719-4206x033, or a date of birth that is not May 23, 1996 at 01:21:54 and an amount outstanding greater than or equal to 5494.0.

SELECT customer_status_code, amount_outstanding, date_became_customer FROM Customers WHERE first_name <> "Leif" AND date_became_customer != "2016-11-30 10:37:41" AND cell_mobile_phone_number = "739-333-6966x187" AND "amount_outstanding" <= 9443.0 OR "customer_address_id" >= 9 AND "customer_id" >= 3 OR date_of_birth = "1988-09-19 14:45:56" OR last_name != "Kohler" OR customer_status_code = "Good Customer" AND email_address != "everette.goyette@example.org" AND phone_number <> "(662)490-3108" EXCEPT SELECT customer_status_code, amount_outstanding, date_became_customer FROM Customers WHERE "customer_address_id" > 1 AND phone_number = "1-618-535-9750" OR cell_mobile_phone_number <> "(780)719-4206x033" OR date_of_birth <> "1996-05-23 01:21:54" AND "amount_outstanding" >= 5494.0


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

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


Question: What are the location, grade, type, and school for schools in Jakarta, Indonesia that are not "Private Catholic" and not "Punahou School", combined with the information for schools that are "Noelani Elementary School" or are not 4th grade, or are not public, or have a School_ID other than 7, or are not located in Los Angeles, California?

Cambridge, Massachusetts
College
Private
Harvard Law School

Honolulu, Hawaii
5th-12th grade
Private
Punahou School

Honolulu, Hawaii
Kindergarten
Public
Noelani Elementary School

Jakarta, Indonesia
1st-3rd grade
Private Catholic
St. Francis Assisi

Jakarta, Indonesia
4th grade
Public
State Elementary School Menteng 01

Los Angeles, California
Freshman–Sophomore year
Private
Occidental College

New York City
Junior–Senior year
Private
Columbia University

SELECT Location, Grade, Type, School FROM school WHERE Location = "Jakarta, Indonesia" AND Type != "Private Catholic" AND School != "Punahou School" UNION SELECT Location, Grade, Type, School FROM school WHERE School = "Noelani Elementary School" OR Grade != "4th grade" AND Type != "Public" OR "School_ID" != 7 AND Location != "Los Angeles, California"


Question: For each country, excluding those from Denmark, and excluding airports named "Billund Airport" or with IATA code "AMS", but including those in Billund, or with an ID greater than or equal to 2, or not having ICAO code "EKBI", how many cities, ICAO codes, airport names, and IATA codes are there, and what is the maximum airport ID, provided that the country has more than one city, or not exactly one IATA code, or the maximum ID is less than 5? Then, exclude the results for countries where the ID is not 6, or the name is not "Baltimore-Washington Airport" and the city is Anchorage, and where the number of ICAO codes is less than 1, or the maximum ID is greater than 7 and the number of names is less than 1 and the number of cities is at most 3.

Country COUNT(City) COUNT(ICAO) COUNT(name) COUNT(IATA) MAX(id)

SELECT Country, COUNT(City), COUNT(ICAO), COUNT(name), COUNT(IATA), MAX(id) FROM airport WHERE Country != "Denmark" OR name != "Billund Airport" OR IATA <> "AMS" AND City = "Billund" OR "id" >= 2 OR ICAO != "EKBI" GROUP BY Country HAVING COUNT(City) > 1 OR COUNT(IATA) <> 1 OR MAX(id) < 5 EXCEPT SELECT Country, COUNT(City), COUNT(ICAO), COUNT(name), COUNT(IATA), MAX(id) FROM airport WHERE "id" != 6 OR name <> "Baltimore-Washington Airport" AND City = "Anchorage" GROUP BY Country HAVING COUNT(ICAO) < 1 OR MAX(id) > 7 AND COUNT(name) < 1 AND COUNT(City) <= 3


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

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


Question: What are the aircraft IDs that are less than 1, and also the aircraft IDs that are not equal to 3?

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


Question: What are the aircraft IDs that appear in the aircraft table with an ID greater than or equal to 1, but not in the airport_aircraft table with an ID of 3?

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


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

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


Question: What are the driver IDs that are either 4 or not 10, considering the driver and school bus information?

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 in the aircraft table but not in the airport_aircraft table, excluding aircraft ID 3 from the aircraft table and aircraft ID 1 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 <> 1


Question: What are the aircraft IDs that are not 2 and are in the aircraft table but not in the airport_aircraft table, excluding any aircraft ID that is 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 driver IDs greater than 1 from the driver table, combined with the driver IDs greater than or equal to 3 from the school bus table?

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


Question: What temporary acting statuses are present in the management table where the department ID is at least 15 or the head ID is less than 5 and the temporary acting status is not "Yes", and also in the management table where the head ID is not 4 or the department ID is less than 7?

SELECT temporary_acting FROM management WHERE "department_ID" >= 15 OR "head_ID" < 5 AND temporary_acting != "Yes" INTERSECT SELECT temporary_acting FROM management WHERE "head_ID" <> 4 OR "department_ID" < 7


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

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


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

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


Question: What is the average property type code for properties that are not "Other", and what is the average property type code for "House" properties?

SELECT AVG(property_type_code) FROM Properties WHERE property_type_code != "Other" INTERSECT SELECT AVG(property_type_code) FROM Ref_Property_Types WHERE property_type_code = "House"


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

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


Question: What are the aircraft IDs that are both less than or equal to 3 and also have an ID of 2?

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


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

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


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

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


Question: Which driver IDs are less than 4, and also include driver ID 3, considering driver information from both the driver and school bus tables?

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


Question: What are the driver IDs that appear in both the driver and school bus tables, where the driver ID is no more than 9 in the driver table and no more than 7 in the school bus table?

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


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

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


Question: For each year, what is the average branch ID and the member ID, considering records where the registration year is not 2016, or the member ID is at least 8, or the branch ID is not 1, and also considering records where the branch ID is not 1 and the member ID is greater than 5?

SELECT Register_Year, AVG(Branch_ID), Member_ID FROM membership_register_branch WHERE Register_Year <> "2016" OR "Member_ID" >= 8 OR Branch_ID <> "1" UNION ALL SELECT Register_Year, AVG(Branch_ID), Member_ID FROM membership_register_branch WHERE Branch_ID <> "1" AND "Member_ID" > 5


Question: What is the average bonus for each employee in 2011, excluding employee ID 2 or any bonus not equal to 3200, and also the average bonus for employees with a bonus less than or equal to 3200?

SELECT Employee_ID, AVG(Bonus) FROM evaluation WHERE Year_awarded = "2011" AND Employee_ID != "2" OR "Bonus" <> 3200.0 UNION ALL SELECT Employee_ID, AVG(Bonus) FROM evaluation WHERE "Bonus" <= 3200.0


Question: What are the other details from documents that aren't shipped by "UP" or from employees where the other details aren't "b" or the employee ID is 3 or greater?

SELECT other_details FROM Documents WHERE shipping_agent_code <> "UP" UNION SELECT other_details FROM Employees WHERE other_details != "b" OR "employee_id" >= 3


Question: Which member IDs are present in both the member table (excluding those named Johnny Williams and with ID 4) and the purchase table (excluding purchases from the year 2018)?

SELECT Member_ID FROM member WHERE Name != "Johnny Williams" AND "Member_ID" != 4 INTERSECT SELECT Member_ID FROM purchase WHERE Year <> "2018"


Question: What are the driver IDs greater than 6 from the driver table, combined with the driver IDs less than 9 from the school bus table?

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


Question: What are the driver IDs that are less than or equal to 9, combined with the driver IDs that are greater than or equal to 10?

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


Question: What are the driver IDs that are less than 11 from the driver table, combined with the driver IDs that are not 10 from the school bus table?

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


Question: Which driver IDs are either 6 or less, or greater than 7, considering driver and school bus information?

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


Question: What are the driver IDs that are either 5 or greater than or equal to 4?

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


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

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


Question: What are the driver IDs that are less than 8 from the driver table, combined with the driver IDs that are 3 or greater from the school bus table?

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


Question: Which member IDs are in the 'member' table but not in the 'membership_register_branch' table, considering members who don't have card number "RT91", are level 6, don't live in "Columbia, South Carolina", or aren't named "Trevard Lindley" and have a member ID other than 7, but excluding those registered at a branch other than "1"?

SELECT Member_ID FROM member WHERE Card_Number != "RT91" OR "Level" = 6 OR Hometown <> "Columbia, South Carolina" OR Name != "Trevard Lindley" AND "Member_ID" <> 7 EXCEPT SELECT Member_ID FROM membership_register_branch WHERE Branch_ID != "1"


Question: Which drivers have an ID of 9, considering both drivers and school buses?

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


Question: What are the IDs of drivers, excluding driver ID 6, and the IDs of school bus drivers, excluding driver ID 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 club IDs are not for the Tennis Club, or not equal to club ID 2, or have the description "Refurbish computers; teach kids and adults about computer basics." and are not located in AKW, or are associated with member ID 1007, or not equal to club ID 2, or not the CTO position?

SELECT ClubID FROM Club WHERE ClubName <> "Tennis Club" OR "ClubID" <> 2 OR ClubDesc = "Refurbish computers; teach kids and adults about computer basics." AND ClubLocation != "AKW" UNION SELECT ClubID FROM Member_of_club WHERE "StuID" = 1007 OR "ClubID" != 2 OR Position != "CTO"


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

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


Question: What are the aircraft IDs, excluding ID 3, that are either in the aircraft table or the airport_aircraft table?

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


Question: What are the IDs of drivers who are not driver ID 5 and also appear in the school bus table but are not school bus ID 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 are the user IDs of reviewers who have a rating of 1 or less, or a rank greater than 7, combined with the user IDs of users whose name is not Mark?

SELECT u_id FROM review WHERE "a_id" <= 1 OR "rank" > 7 UNION SELECT u_id FROM useracct WHERE name <> "Mark"


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

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


Question: What is the alphabetically first feature name that isn't "Air Conditioning" and also has the description "Burglar Alarm"?

SELECT MIN(feature_name) FROM Other_Available_Features WHERE feature_description <> "Air Conditioning." INTERSECT SELECT MIN(feature_name) FROM Other_Available_Features WHERE feature_description = "Burglar Alarm"


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

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


Question: What are the full names, IDs, makers, and countries of car makers, excluding those from country "6" and not named "Volvo" or with an ID other than 2, combined with the full names, IDs, makers, and countries of car makers that are not "ford"?

SELECT FullName, Id, Maker, Country FROM car_makers WHERE Country <> "6" AND FullName != "Volvo" OR "Id" != 2 UNION ALL SELECT FullName, Id, Maker, Country FROM car_makers WHERE Maker != "ford"


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

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


Question: What are the aircraft IDs greater than 4 in the aircraft table, combined with the aircraft IDs greater than 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: Which driver IDs are greater than or equal to 1 in the driver table, but not equal to 7 in the school bus table?

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


Question: What are the driver IDs that are equal to 2, but not driver IDs that are 9 or greater, considering the drivers and school buses?

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


Question: What are the driver IDs that are greater than or equal to 6, and also the driver IDs that are less than or equal to 7?

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: Which driver IDs are either less than or equal to 2, or not equal to 9, considering driver and school bus information?

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


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

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


Question: Which store IDs are not "Village Store" or have an area size less than 26.69 or are named "Neguac" and are not store ID 3, but are not store IDs found in the store_product table where the store ID is less than or equal to 1?

SELECT Store_ID FROM store WHERE Type <> "Village Store" OR "Area_size" < 26.69 OR Store_Name = "Neguac" AND "Store_ID" <> 3 EXCEPT SELECT Store_ID FROM store_product WHERE "Store_ID" <= 1


Question: What are the aircraft IDs that are either 1 or less than 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 of drafts with draft number 4 and not "l" as draft details, excluding those that were mailed to an address ID less than or equal to 0?

SELECT document_id FROM Document_Drafts WHERE "draft_number" = 4 AND draft_details <> "l" EXCEPT SELECT document_id FROM Documents_Mailed WHERE "mailed_to_address_id" <= 0


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

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


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

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


Question: Which driver IDs are less than 8, and also driver ID 10?

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 role code, other details, employee name, and employee ID for employees who are not named Jordyn or have an employee ID greater than 1 and other details equal to "f", along with the role code, other details, employee name, and employee ID for employees with an employee ID of 3 or greater?

SELECT role_code, other_details, employee_name, employee_id FROM Employees WHERE employee_name != "Jordyn" OR "employee_id" > 1 AND other_details = "f" UNION ALL SELECT role_code, other_details, employee_name, employee_id FROM Employees WHERE "employee_id" >= 3


Question: What are the driver IDs that are less than or equal to 9, but not found in the school bus table with driver IDs less than 10?

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


Question: What are the sums of customer address IDs and phone numbers for customers meeting the first set of criteria, excluding those meeting the second set of criteria? The first set includes customers with customer IDs greater than 1, or a customer status code not equal to "Bad Customer" and a last name of "Tromp", or an email address not equal to "afranecki@example.com" and a date of birth of "1993-03-08 08:48:42", or a phone number of "206-054-0689x05861" and a cell mobile phone number of "848-099-2095x785", or a first name not equal to "Carole" and a customer address ID of 8, or an amount outstanding greater than 9443.0. The second set includes customers with a customer address ID less than or equal to 9 and an email address of "kitty.hand@example.net", or an amount outstanding less than 7256.0 and a customer ID greater than or equal to 12, or a first name not equal to "Dianna", or a phone number not equal to "1-387-884-0656", or a customer status code of "Bad Customer", or a date of birth not equal to "1991-12-05 02:50:15" and a date became customer not equal to "2017-04-16 05:12:21", or a last name of "Spinka", or a cell mobile phone number of "+57(9)4602098297".

SELECT SUM(customer_address_id), phone_number FROM Customers WHERE "customer_id" > 1 OR customer_status_code != "Bad Customer" AND last_name = "Tromp" OR email_address != "afranecki@example.com" AND date_of_birth = "1993-03-08 08:48:42" OR phone_number = "206-054-0689x05861" AND cell_mobile_phone_number = "848-099-2095x785" OR first_name != "Carole" AND "customer_address_id" = 8 OR "amount_outstanding" > 9443.0 EXCEPT SELECT SUM(customer_address_id), phone_number FROM Customers WHERE "customer_address_id" <= 9 AND email_address = "kitty.hand@example.net" OR "amount_outstanding" < 7256.0 AND "customer_id" >= 12 OR first_name != "Dianna" OR phone_number <> "1-387-884-0656" OR customer_status_code = "Bad Customer" OR date_of_birth <> "1991-12-05 02:50:15" AND date_became_customer != "2017-04-16 05:12:21" OR last_name = "Spinka" OR cell_mobile_phone_number = "+57(9)4602098297"


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

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


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

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


Question: What are the document IDs, mailing dates, and addresses for mailed documents, excluding those mailed on May 24, 1993, and with an address ID greater than 7 or a document ID greater than 12? Also, include all documents with an address ID greater than 3.

SELECT document_id, mailing_date, mailed_to_address_id FROM Documents_Mailed WHERE mailing_date != "1993-05-24 22:13:48" AND "mailed_to_address_id" > 7 OR "document_id" > 12 UNION ALL SELECT document_id, mailing_date, mailed_to_address_id FROM Documents_Mailed WHERE "mailed_to_address_id" > 3


Question: What are the IDs of albums with an ID less than 104 or an artist ID less than 50 and the title "Beethoven: Symphony No. 6 'Pastoral' Etc.", combined with the IDs of genres that are not "Sci Fi & Fantasy" or have an ID greater than or equal to 7?

SELECT id FROM albums WHERE "id" < 104 OR "artist_id" < 50 AND title = "Beethoven: Symphony No. 6 'Pastoral' Etc." UNION ALL SELECT id FROM genres WHERE name <> "Sci Fi & Fantasy" OR "id" >= 7


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

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


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

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


Question: What are the IDs of drivers who are not named Tim Larson, or are not Democrats and are under 45 years old, or have a driver ID other than 1 and don't live in East Hartford? Also, what are the IDs of drivers from school buses where the school ID is not 5, or have worked for 6 or fewer years and are full-time, and the driver ID is 7?

SELECT Driver_ID FROM driver WHERE Name <> "Tim Larson" OR Party <> "Dem" AND "Age" < 45 OR "Driver_ID" <> 1 AND Home_city != "East Hartford" UNION ALL SELECT Driver_ID FROM school_bus WHERE "School_ID" != 5 OR "Years_Working" <= 6 AND If_full_time != "F" AND "Driver_ID" = 7


Question: What are the first names, ages, and sexes of students, excluding those with the last name "Jones", or where the advisor ID is 1148 and the sex is not "M", or where the age is not 18, or where the major code is not greater than 520, or where the first name is not "Paul". Also, include the first names, ages, and sexes of students, excluding those with the last name "Kumar", or where the student ID is greater than 1026, or where the advisor ID is greater than or equal to 2192, or where the first name is not "Michael" and the city code is "PHL", or where the sex is "M".

SELECT Fname, Age, Sex FROM Student WHERE LName != "Jones" OR "Advisor" = 1148 AND Sex != "M" OR "Age" <> 18 OR "Major" <= 520 OR Fname <> "Paul" UNION ALL SELECT Fname, Age, Sex FROM Student WHERE LName != "Kumar" OR "StuID" > 1026 OR "Advisor" >= 2192 OR Fname != "Michael" AND city_code = "PHL" OR Sex = "M"


Question: What are the driver IDs that are less than 3, and also the driver IDs that are greater than 10?

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 are the aircraft IDs that are both less than or equal to 4 in the aircraft table and greater than or equal to 1 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 >= 1


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

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


Question: What is the maximum number of issues and the publisher for books, excluding those published by Pearson, grouped by the number of issues, where the publisher is not Bertelsmann or the price is less than or equal to 2,000,000?

SELECT MAX(T1.Issues), T2.Publisher FROM book as T1 JOIN publication as T2 ON T1.Book_ID = T2.Book_ID WHERE Publisher <> "Pearson" GROUP BY Issues HAVING Publisher <> "Bertelsmann" OR Price <= 2000000.0


Question: What are the aircraft IDs that are less than 3 in the aircraft table, combined with the aircraft IDs greater than 3 in the airport_aircraft table?

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


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

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


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

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