Question: Find the name of the swimmer who has at least 2 records.

swimmer : id (number) , name (text) , nationality (text) , meter_100 (number) , meter_200 (text) , meter_300 (text) , meter_400 (text) , meter_500 (text) , meter_600 (text) , meter_700 (text) , time (text) | stadium : id (number) , name (text) , capacity (number) , city (text) , country (text) , opening_year (number) | event : id (number) , name (text) , stadium_id (number) , year (text) | record : id (number) , result (text) , swimmer_id (number) , event_id (number)

swimmer : name (text) , id (number) | record : id (number) , swimmer_id (number)


Question: Find the name and nationality of the swimmer who has won (i.e., has a result of "win") more than 1 time.

swimmer : id (number) , name (text) , nationality (text) , meter_100 (number) , meter_200 (text) , meter_300 (text) , meter_400 (text) , meter_500 (text) , meter_600 (text) , meter_700 (text) , time (text) | stadium : id (number) , name (text) , capacity (number) , city (text) , country (text) , opening_year (number) | event : id (number) , name (text) , stadium_id (number) , year (text) | record : id (number) , result (text) , swimmer_id (number) , event_id (number)

swimmer : name (text) , nationality (text) , id (number) | record : id (number) , swimmer_id (number) , result (text)


Question: Find the names of the swimmers who have no record.

swimmer : id (number) , name (text) , nationality (text) , meter_100 (number) , meter_200 (text) , meter_300 (text) , meter_400 (text) , meter_500 (text) , meter_600 (text) , meter_700 (text) , time (text) | stadium : id (number) , name (text) , capacity (number) , city (text) , country (text) , opening_year (number) | event : id (number) , name (text) , stadium_id (number) , year (text) | record : id (number) , result (text) , swimmer_id (number) , event_id (number)

swimmer : name (text) , id (number) | record : id (number) , swimmer_id (number)


Question: Find the names of the swimmers who have both "win" and "loss" results in the record.

swimmer : id (number) , name (text) , nationality (text) , meter_100 (number) , meter_200 (text) , meter_300 (text) , meter_400 (text) , meter_500 (text) , meter_600 (text) , meter_700 (text) , time (text) | stadium : id (number) , name (text) , capacity (number) , city (text) , country (text) , opening_year (number) | event : id (number) , name (text) , stadium_id (number) , year (text) | record : id (number) , result (text) , swimmer_id (number) , event_id (number)

swimmer : name (text) , id (number) | record : id (number) , swimmer_id (number) , result (text)


Question: Find the names of stadiums that some Australian swimmers have been to.

swimmer : id (number) , name (text) , nationality (text) , meter_100 (number) , meter_200 (text) , meter_300 (text) , meter_400 (text) , meter_500 (text) , meter_600 (text) , meter_700 (text) , time (text) | stadium : id (number) , name (text) , capacity (number) , city (text) , country (text) , opening_year (number) | event : id (number) , name (text) , stadium_id (number) , year (text) | record : id (number) , result (text) , swimmer_id (number) , event_id (number)

swimmer : name (text) , id (number) , nationality (text) | stadium : name (text) , id (number) | event : name (text) , id (number) , stadium_id (number) | record : id (number) , swimmer_id (number) , event_id (number)


Question: Find the names of stadiums that the most swimmers have been to.

swimmer : id (number) , name (text) , nationality (text) , meter_100 (number) , meter_200 (text) , meter_300 (text) , meter_400 (text) , meter_500 (text) , meter_600 (text) , meter_700 (text) , time (text) | stadium : id (number) , name (text) , capacity (number) , city (text) , country (text) , opening_year (number) | event : id (number) , name (text) , stadium_id (number) , year (text) | record : id (number) , result (text) , swimmer_id (number) , event_id (number)

stadium : name (text) , id (number) | event : name (text) , id (number) , stadium_id (number) | record : event_id (number) , id (number) , swimmer_id (number)


Question: Find all details for each swimmer.

swimmer : id (number) , name (text) , nationality (text) , meter_100 (number) , meter_200 (text) , meter_300 (text) , meter_400 (text) , meter_500 (text) , meter_600 (text) , meter_700 (text) , time (text) | stadium : id (number) , name (text) , capacity (number) , city (text) , country (text) , opening_year (number) | event : id (number) , name (text) , stadium_id (number) , year (text) | record : id (number) , result (text) , swimmer_id (number) , event_id (number)


Question: What is the average capacity of the stadiums that were opened in year 2005?

swimmer : id (number) , name (text) , nationality (text) , meter_100 (number) , meter_200 (text) , meter_300 (text) , meter_400 (text) , meter_500 (text) , meter_600 (text) , meter_700 (text) , time (text) | stadium : id (number) , name (text) , capacity (number) , city (text) , country (text) , opening_year (number) | event : id (number) , name (text) , stadium_id (number) , year (text) | record : id (number) , result (text) , swimmer_id (number) , event_id (number)

stadium : capacity (number) , opening_year (number) , id (number)


Question: How many railways are there?

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

railway : railway (text) , railway_id (number)


Question: List the builders of railways in ascending alphabetical order.

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

railway : builder (text) , railway (text) , railway_id (number)


Question: List the wheels and locations of the railways.

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

railway : wheels (text) , location (text) , railway (text) , railway_id (number)


Question: What is the maximum level of managers in countries that are not "Australia"?

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

manager : level (number) , country (text) , manager_id (number)


Question: What is the average age for all managers?

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

manager : age (number) , manager_id (number)


Question: What are the names of managers in ascending order of level?

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

manager : name (text) , level (number) , manager_id (number)


Question: What are the names and arrival times of trains?

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

train : name (text) , arrival (text) , from (text) , train_id (number)


Question: What is the name of the oldest manager?

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

manager : name (text) , age (number) , manager_id (number)


Question: Show the names of trains and locations of railways they are in.

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

train : name (text) , from (text) , railway_id (number) , train_id (number) | railway : location (text) , railway (text) , railway_id (number)


Question: Show the builder of railways associated with the trains named "Andaman Exp".

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

railway : builder (text) , railway (text) , railway_id (number) | train : from (text) , railway_id (number) , name (text) , train_id (number)


Question: Show id and location of railways that are associated with more than one train.

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

railway : railway_id (number) , location (text) , railway (text) | train : railway_id (number) , from (text) , train_id (number)


Question: Show the id and builder of the railway that are associated with the most trains.

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

railway : railway_id (number) , builder (text) , railway (text) | train : railway_id (number) , from (text) , train_id (number)


Question: Show different builders of railways, along with the corresponding number of railways using each builder.

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

railway : builder (text) , railway (text) , railway_id (number)


Question: Show the most common builder of railways.

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

railway : builder (text) , railway (text) , railway_id (number)


Question: Show different locations of railways along with the corresponding number of railways at each location.

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

railway : location (text) , railway (text) , railway_id (number)


Question: Show the locations that have more than one railways.

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

railway : location (text) , railway (text) , railway_id (number)


Question: List the object number of railways that do not have any trains.

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

railway : objectnumber (text) , railway (text) , railway_id (number) | train : from (text) , railway_id (number) , train_id (number)


Question: Show the countries that have both managers of age above 50 and managers of age below 46.

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

manager : country (text) , age (number) , manager_id (number)


Question: Show the distinct countries of managers.

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

manager : country (text) , manager_id (number)


Question: Show the working years of managers in descending order of their level.

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

manager : working_year_starts (text) , level (number) , manager_id (number)


Question: Show the countries that have managers of age above 50 or below 46.

railway : railway_id (number) , railway (text) , builder (text) , built (text) , wheels (text) , location (text) , objectnumber (text) | train : train_id (number) , train_num (text) , name (text) , from (text) , arrival (text) , railway_id (number) | manager : manager_id (number) , name (text) , country (text) , working_year_starts (text) , age (number) , level (number) | railway_manage : railway_id (number) , manager_id (number) , from_year (text)

manager : country (text) , age (number) , manager_id (number)


Question: How many addresses are there in country USA?

addresses : address_id (number) , line_1_number_building (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | customers : customer_id (number) , payment_method_code (text) , customer_number (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | contacts : contact_id (number) , customer_id (number) , gender (text) , first_name (text) , last_name (text) , contact_phone (text) | customer_address_history : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_date (time) , order_status_code (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) , order_quantity (text)

addresses : country (text) , address_id (number)


Question: Show all distinct cities in the address record.

addresses : address_id (number) , line_1_number_building (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | customers : customer_id (number) , payment_method_code (text) , customer_number (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | contacts : contact_id (number) , customer_id (number) , gender (text) , first_name (text) , last_name (text) , contact_phone (text) | customer_address_history : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_date (time) , order_status_code (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) , order_quantity (text)

addresses : city (text) , address_id (number)


Question: Show each state and the number of addresses in each state.

addresses : address_id (number) , line_1_number_building (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | customers : customer_id (number) , payment_method_code (text) , customer_number (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | contacts : contact_id (number) , customer_id (number) , gender (text) , first_name (text) , last_name (text) , contact_phone (text) | customer_address_history : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_date (time) , order_status_code (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) , order_quantity (text)

addresses : state_province_county (text) , address_id (number)


Question: Show names and phones of customers who do not have address information.

addresses : address_id (number) , line_1_number_building (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | customers : customer_id (number) , payment_method_code (text) , customer_number (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | contacts : contact_id (number) , customer_id (number) , gender (text) , first_name (text) , last_name (text) , contact_phone (text) | customer_address_history : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_date (time) , order_status_code (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) , order_quantity (text)

customers : customer_name (text) , customer_phone (text) , customer_id (number) | customer_address_history : customer_id (number)


Question: Show the name of the customer who has the most orders.

addresses : address_id (number) , line_1_number_building (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | customers : customer_id (number) , payment_method_code (text) , customer_number (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | contacts : contact_id (number) , customer_id (number) , gender (text) , first_name (text) , last_name (text) , contact_phone (text) | customer_address_history : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_date (time) , order_status_code (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) , order_quantity (text)

customers : customer_name (text) , customer_id (number) | customer_orders : customer_id (number) , order_id (number)


Question: Show the product type codes which have at least two products.

addresses : address_id (number) , line_1_number_building (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | customers : customer_id (number) , payment_method_code (text) , customer_number (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | contacts : contact_id (number) , customer_id (number) , gender (text) , first_name (text) , last_name (text) , contact_phone (text) | customer_address_history : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_date (time) , order_status_code (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) , order_quantity (text)

products : product_type_code (text) , product_id (number)


Question: Show the names of customers who have both an order in completed status and an order in part status.

addresses : address_id (number) , line_1_number_building (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | customers : customer_id (number) , payment_method_code (text) , customer_number (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | contacts : contact_id (number) , customer_id (number) , gender (text) , first_name (text) , last_name (text) , contact_phone (text) | customer_address_history : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_date (time) , order_status_code (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) , order_quantity (text)

customers : customer_name (text) , customer_id (number) | customer_orders : customer_id (number) , order_status_code (text) , order_id (number)


Question: Show the name, phone, and payment method code for all customers in descending order of customer number.

addresses : address_id (number) , line_1_number_building (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | customers : customer_id (number) , payment_method_code (text) , customer_number (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | contacts : contact_id (number) , customer_id (number) , gender (text) , first_name (text) , last_name (text) , contact_phone (text) | customer_address_history : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_date (time) , order_status_code (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) , order_quantity (text)

customers : customer_name (text) , customer_phone (text) , payment_method_code (text) , customer_number (text) , customer_id (number)


Question: Show the product name and total order quantity for each product.

addresses : address_id (number) , line_1_number_building (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | customers : customer_id (number) , payment_method_code (text) , customer_number (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | contacts : contact_id (number) , customer_id (number) , gender (text) , first_name (text) , last_name (text) , contact_phone (text) | customer_address_history : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_date (time) , order_status_code (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) , order_quantity (text)

products : product_name (text) , product_id (number) | order_items : order_quantity (text) , product_id (number)


Question: Show the minimum, maximum, average price for all products.

addresses : address_id (number) , line_1_number_building (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | customers : customer_id (number) , payment_method_code (text) , customer_number (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | contacts : contact_id (number) , customer_id (number) , gender (text) , first_name (text) , last_name (text) , contact_phone (text) | customer_address_history : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_date (time) , order_status_code (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) , order_quantity (text)

products : product_price (number) , product_id (number)


Question: How many products have a price higher than the average?

addresses : address_id (number) , line_1_number_building (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | customers : customer_id (number) , payment_method_code (text) , customer_number (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | contacts : contact_id (number) , customer_id (number) , gender (text) , first_name (text) , last_name (text) , contact_phone (text) | customer_address_history : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_date (time) , order_status_code (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) , order_quantity (text)

products : product_price (number) , product_id (number)


Question: Show the customer name, customer address city, date from, and date to for each customer address history.

addresses : address_id (number) , line_1_number_building (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | customers : customer_id (number) , payment_method_code (text) , customer_number (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | contacts : contact_id (number) , customer_id (number) , gender (text) , first_name (text) , last_name (text) , contact_phone (text) | customer_address_history : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_date (time) , order_status_code (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) , order_quantity (text)

customers : customer_name (text) , customer_id (number) | addresses : city (text) , address_id (number) | customer_address_history : date_from (time) , date_to (time) , customer_id (number) , address_id (number)


Question: Show the names of customers who use Credit Card payment method and have more than 2 orders.

addresses : address_id (number) , line_1_number_building (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | customers : customer_id (number) , payment_method_code (text) , customer_number (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | contacts : contact_id (number) , customer_id (number) , gender (text) , first_name (text) , last_name (text) , contact_phone (text) | customer_address_history : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_date (time) , order_status_code (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) , order_quantity (text)

customers : customer_name (text) , customer_id (number) , payment_method_code (text) | customer_orders : customer_id (number) , order_id (number)


Question: What are the name and phone of the customer with the most ordered product quantity?

addresses : address_id (number) , line_1_number_building (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | customers : customer_id (number) , payment_method_code (text) , customer_number (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | contacts : contact_id (number) , customer_id (number) , gender (text) , first_name (text) , last_name (text) , contact_phone (text) | customer_address_history : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_date (time) , order_status_code (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) , order_quantity (text)

customers : customer_name (text) , customer_phone (text) , customer_id (number) | customer_orders : customer_id (number) , order_id (number) | order_items : order_id (number) , order_quantity (text)


Question: Show the product type and name for the products with price higher than 1000 or lower than 500.

addresses : address_id (number) , line_1_number_building (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | customers : customer_id (number) , payment_method_code (text) , customer_number (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | contacts : contact_id (number) , customer_id (number) , gender (text) , first_name (text) , last_name (text) , contact_phone (text) | customer_address_history : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_date (time) , order_status_code (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) , order_quantity (text)

products : product_type_code (text) , product_name (text) , product_price (number) , product_id (number)


Question: Find the name of dorms only for female (F gender).

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)


Question: What are the names of the all-female dorms?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)


Question: Find the name of dorms that can accommodate more than 300 students.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dorm_name (text) , student_capacity (number)


Question: What are the names of all the dorms that can accomdate more than 300 students?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dorm_name (text) , student_capacity (number)


Question: How many female students (sex is F) whose age is below 25?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : sex (text) , age (number) , stuid (number)


Question: How many girl students who are younger than 25?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : sex (text) , age (number) , stuid (number)


Question: Find the first name of students who is older than 20.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : fname (text) , age (number) , stuid (number)


Question: What are the first names of all students who are older than 20?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : fname (text) , age (number) , stuid (number)


Question: Find the first name of students living in city PHL whose age is between 20 and 25.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : fname (text) , city_code (text) , age (number) , stuid (number)


Question: What is the first name of the students who are in age 20 to 25 and living in PHL city?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : fname (text) , city_code (text) , age (number) , stuid (number)


Question: Find the total capacity of all dorms.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)


Question: What is the total student capacity of all dorms?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)


Question: How many students are there?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)


Question: How many students exist?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)


Question: Find the average age of all students living in the each city.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : age (number) , city_code (text) , stuid (number)


Question: What is the average age for each city and what are those cities?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : age (number) , city_code (text) , stuid (number)


Question: Find the average and total capacity of dorms for the students with gender X.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : student_capacity (number) , gender (text)


Question: What is the average and total capacity for all dorms who are of gender X?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : student_capacity (number) , gender (text)


Question: Find the number of dorms that have some amenity.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)


Question: How many dorms have amenities?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)


Question: Find the name of dorms that do not have any amenity

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dorm_name (text) , dormid (number) | has_amenity : dormid (number)


Question: What are the names of all the dorms that don't have any amenities?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dorm_name (text) , dormid (number) | has_amenity : dormid (number)


Question: Find the number of distinct gender for dorms.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)


Question: How many different genders are there in the dorms?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)


Question: Find the capacity and gender type of the dorm whose name has substring ‘Donor’.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : student_capacity (number) , gender (text) , dorm_name (text)


Question: What is the student capacity and type of gender for the dorm whose name as the phrase Donor in it?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : student_capacity (number) , gender (text) , dorm_name (text)


Question: Find the name and gender type of the dorms whose capacity is greater than 300 or less than 100.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dorm_name (text) , gender (text) , student_capacity (number)


Question: What are the names and types of the dorms that have a capacity greater than 300 or less than 100?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dorm_name (text) , gender (text) , student_capacity (number)


Question: Find the numbers of different majors and cities.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : major (number) , city_code (text) , stuid (number)


Question: How many different majors are there and how many different city codes are there for each student?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : major (number) , city_code (text) , stuid (number)


Question: Find the name of dorms which have both TV Lounge and Study Room as amenities.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dorm_name (text) , dormid (number) | has_amenity : dormid (number) , amenid (number) | dorm_amenity : amenid (number) , amenity_name (text)


Question: What is the name of the dorm with both a TV Lounge and Study Room listed as amenities?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dorm_name (text) , dormid (number) | has_amenity : dormid (number) , amenid (number) | dorm_amenity : amenid (number) , amenity_name (text)


Question: Find the name of dorms which have TV Lounge but no Study Room as amenity.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dorm_name (text) , dormid (number) | has_amenity : dormid (number) , amenid (number) | dorm_amenity : amenid (number) , amenity_name (text)


Question: What is the name of each dorm that has a TV Lounge but no study rooms?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dorm_name (text) , dormid (number) | has_amenity : dormid (number) , amenid (number) | dorm_amenity : amenid (number) , amenity_name (text)


Question: Find the last name of students who is either female (sex is F) and living in the city of code BAL or male (sex is M) and in age of below 20.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : lname (text) , sex (text) , city_code (text) , age (number) , stuid (number)


Question: What is the last name of every student who is either female or living in a city with the code BAL or male and under 20?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : lname (text) , sex (text) , city_code (text) , age (number) , stuid (number)


Question: Find the name of the dorm with the largest capacity.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dorm_name (text) , student_capacity (number)


Question: What are the names of the dorm with the largest capacity?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dorm_name (text) , student_capacity (number)


Question: List in alphabetic order all different amenities.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)


Question: What are the different dorm amenity names in alphabetical order?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)


Question: Find the code of city where most of students are living in.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : city_code (text) , stuid (number)


Question: What is the code of the city with the most students?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : city_code (text) , stuid (number)


Question: Find the first and last name of students whose age is younger than the average age.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : fname (text) , lname (text) , age (number) , stuid (number)


Question: What is the first and last name of all students who are younger than average?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : fname (text) , lname (text) , age (number) , stuid (number)


Question: List the first and last name of students who are not living in the city with code HKG, and sorted the results by their ages.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : fname (text) , lname (text) , city_code (text) , age (number) , stuid (number)


Question: What are the first and last names of all students who are not living in the city HKG and order the results by age?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : fname (text) , lname (text) , city_code (text) , age (number) , stuid (number)


Question: List name of all amenities which Anonymous Donor Hall has, and sort the results in alphabetic order.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm_amenity : amenity_name (text) , amenid (number) | has_amenity : amenid (number) , dormid (number) | dorm : dormid (number) , dorm_name (text)


Question: What are the amenities in alphabetical order that Anonymous Donor Hall has?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm_amenity : amenity_name (text) , amenid (number) | has_amenity : amenid (number) , dormid (number) | dorm : dormid (number) , dorm_name (text)


Question: Find the number of dorms and total capacity for each gender.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : student_capacity (number) , gender (text)


Question: How many dorms are there and what is the total capacity for each gender?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : student_capacity (number) , gender (text)


Question: Find the average and oldest age for students with different sex.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : age (number) , sex (text) , stuid (number)


Question: What is the average and oldest age for each gender of student?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : age (number) , sex (text) , stuid (number)


Question: Find the number of students in each major.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : major (number) , stuid (number)


Question: How many students are there in each major?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : major (number) , stuid (number)


Question: Find the number and average age of students living in each city.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : age (number) , city_code (text) , stuid (number)


Question: How many students live in each city and what are their average ages?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : age (number) , city_code (text) , stuid (number)


Question: Find the average age and number of male students (with sex M) from each city.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : age (number) , city_code (text) , sex (text) , stuid (number)


Question: What is the average age and how many male students are there in each city?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : age (number) , city_code (text) , sex (text) , stuid (number)


Question: Find the number of students for the cities where have more than one student.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : city_code (text) , stuid (number)


Question: How many students are from each city, and which cities have more than one cities?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : city_code (text) , stuid (number)


Question: Find the first and last name of students who are not in the largest major.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : fname (text) , lname (text) , major (number) , stuid (number)


Question: What is the first and last name of the students who are not in the largest major?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : fname (text) , lname (text) , major (number) , stuid (number)


Question: Find the number of students whose age is older than the average age for each gender.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : sex (text) , age (number) , stuid (number)


Question: How many students are older than average for each gender?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : sex (text) , age (number) , stuid (number)


Question: Find the average age of students living in each dorm and the name of dorm.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : age (number) , stuid (number) | dorm : dorm_name (text) , dormid (number) | lives_in : stuid (number) , dormid (number)


Question: What is the average age for each dorm and what are the names of each dorm?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : age (number) , stuid (number) | dorm : dorm_name (text) , dormid (number) | lives_in : stuid (number) , dormid (number)


Question: Find the number of amenities for each of the dorms that can accommodate more than 100 students.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dormid (number) , student_capacity (number) | has_amenity : dormid (number)


Question: For each dorm, how many amenities does it have?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dormid (number) , student_capacity (number) | has_amenity : dormid (number)


Question: Find the number of students who is older than 20 in each dorm.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dorm_name (text) , dormid (number) | student : stuid (number) , age (number) | lives_in : stuid (number) , dormid (number)


Question: How many students are older than 20 in each dorm?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dorm_name (text) , dormid (number) | student : stuid (number) , age (number) | lives_in : stuid (number) , dormid (number)


Question: Find the first name of students who are living in the Smith Hall.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : fname (text) , stuid (number) | lives_in : stuid (number) , dormid (number) | dorm : dormid (number) , dorm_name (text)


Question: What are the first names of all students in Smith Hall?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : fname (text) , stuid (number) | lives_in : stuid (number) , dormid (number) | dorm : dormid (number) , dorm_name (text)


Question: Find the average age of students who are living in the dorm with the largest capacity.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : age (number) , stuid (number) | lives_in : stuid (number) , dormid (number) | dorm : dormid (number) , student_capacity (number)


Question: What is the average age of students who are living in the dorm with the largest capacity?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : age (number) , stuid (number) | lives_in : stuid (number) , dormid (number) | dorm : dormid (number) , student_capacity (number)


Question: Find the total number of students living in the male dorm (with gender M).

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : stuid (number) | lives_in : stuid (number) , dormid (number) | dorm : dormid (number) , gender (text)


Question: What are the total number of students who are living in a male dorm?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : stuid (number) | lives_in : stuid (number) , dormid (number) | dorm : dormid (number) , gender (text)


Question: Find the number of female students (with F sex) living in Smith Hall

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : stuid (number) , sex (text) | lives_in : stuid (number) , dormid (number) | dorm : dormid (number) , dorm_name (text)


Question: How many female students live in Smith Hall?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : stuid (number) , sex (text) | lives_in : stuid (number) , dormid (number) | dorm : dormid (number) , dorm_name (text)


Question: Find the name of amenities Smith Hall dorm have.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm_amenity : amenity_name (text) , amenid (number) | dorm : dormid (number) , dorm_name (text) | has_amenity : dormid (number) , amenid (number)


Question: What are the names of the amenities that Smith Hall has?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm_amenity : amenity_name (text) , amenid (number) | dorm : dormid (number) , dorm_name (text) | has_amenity : dormid (number) , amenid (number)


Question: Find the name of amenities Smith Hall dorm have. ordered the results by amenity names.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm_amenity : amenity_name (text) , amenid (number) | dorm : dormid (number) , dorm_name (text) | has_amenity : dormid (number) , amenid (number)


Question: What amenities does Smith Hall have in alphabetical order?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm_amenity : amenity_name (text) , amenid (number) | dorm : dormid (number) , dorm_name (text) | has_amenity : dormid (number) , amenid (number)


Question: Find the name of amenity that is most common in all dorms.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm_amenity : amenity_name (text) , amenid (number) | has_amenity : amenid (number)


Question: What is the most common amenity in the dorms?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm_amenity : amenity_name (text) , amenid (number) | has_amenity : amenid (number)


Question: Find the first name of students who are living in the dorm that has most number of amenities.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : fname (text) , stuid (number) | lives_in : stuid (number) , dormid (number) | dorm : dormid (number) | has_amenity : dormid (number) , amenid (number) | dorm_amenity : amenid (number)


Question: What are the first names of all students who live in the dorm with the most amenities?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : fname (text) , stuid (number) | lives_in : stuid (number) , dormid (number) | dorm : dormid (number) | has_amenity : dormid (number) , amenid (number) | dorm_amenity : amenid (number)


Question: Find the name and capacity of the dorm with least number of amenities.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dorm_name (text) , student_capacity (number) , dormid (number) | has_amenity : dormid (number) , amenid (number) | dorm_amenity : amenid (number)


Question: What is the name and capacity of the dorm with the fewest amount of amenities?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dorm_name (text) , student_capacity (number) , dormid (number) | has_amenity : dormid (number) , amenid (number) | dorm_amenity : amenid (number)


Question: Find the name of dorms that do not have amenity TV Lounge.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dorm_name (text) , dormid (number) | has_amenity : dormid (number) , amenid (number) | dorm_amenity : amenid (number) , amenity_name (text)


Question: What are the names of the dorm that does not have a TV Lounge?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm : dorm_name (text) , dormid (number) | has_amenity : dormid (number) , amenid (number) | dorm_amenity : amenid (number) , amenity_name (text)


Question: Find the first and last name of students who are living in the dorms that have amenity TV Lounge.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : fname (text) , lname (text) , stuid (number) | lives_in : stuid (number) , dormid (number) | has_amenity : dormid (number) , amenid (number) | dorm_amenity : amenid (number) , amenity_name (text)


Question: What are the first and last names of all students who are living in a dorm with a TV Lounge?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : fname (text) , lname (text) , stuid (number) | lives_in : stuid (number) , dormid (number) | has_amenity : dormid (number) , amenid (number) | dorm_amenity : amenid (number) , amenity_name (text)


Question: Find the first name and age of students who are living in the dorms that do not have amenity TV Lounge.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : fname (text) , age (number) , stuid (number) | lives_in : stuid (number) , dormid (number) | has_amenity : dormid (number) , amenid (number) | dorm_amenity : amenid (number) , amenity_name (text)


Question: What is the first name and age of every student who lives in a dorm with a TV Lounge?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

student : fname (text) , age (number) , stuid (number) | lives_in : stuid (number) , dormid (number) | has_amenity : dormid (number) , amenid (number) | dorm_amenity : amenid (number) , amenity_name (text)


Question: Find the name of amenities of the dorm where the student with last name Smith is living in.

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm_amenity : amenity_name (text) , amenid (number) | dorm : dormid (number) | has_amenity : dormid (number) , amenid (number) | lives_in : dormid (number) , stuid (number) | student : stuid (number) , lname (text)


Question: What are the amenities in the dorm that a student who has the last name of Smith lives in?

student : stuid (number) , lname (text) , fname (text) , age (number) , sex (text) , major (number) , advisor (number) , city_code (text) | dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | dorm_amenity : amenid (number) , amenity_name (text) | has_amenity : dormid (number) , amenid (number) | lives_in : stuid (number) , dormid (number) , room_number (number)

dorm_amenity : amenity_name (text) , amenid (number) | dorm : dormid (number) | has_amenity : dormid (number) , amenid (number) | lives_in : dormid (number) , stuid (number) | student : stuid (number) , lname (text)


Question: How many customers are there?

staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)


Question: Count the number of customers.

staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)


Question: Find the emails and phone numbers of all the customers, ordered by email address and phone number.

staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)

customers : email_address (text) , phone_number (text) , customer_id (number)


Question: What are the emails and phone numbers of all customers, sorted by email address and phone number?

staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)

customers : email_address (text) , phone_number (text) , customer_id (number)


Question: Which city has the least number of customers whose type code is "Good Credit Rating"?

staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)

customers : town_city (text) , customer_type_code (text) , customer_id (number)


Question: Return the city with the customer type code "Good Credit Rating" that had the fewest customers.

staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)

customers : town_city (text) , customer_type_code (text) , customer_id (number)


Question: List the name of all products along with the number of complaints that they have received.

staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)

products : product_name (text) , product_id (number) | complaints : product_id (number)


Question: What are all the different product names, and how many complains has each received?

staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)

products : product_name (text) , product_id (number) | complaints : product_id (number)


Question: Find the emails of customers who has filed a complaints of the product with the most complaints.

staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)

customers : email_address (text) , customer_id (number) | complaints : customer_id (number)


Question: What are the emails of customers who have filed complaints on the product which has had the greatest number of complaints?

staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)

customers : email_address (text) , customer_id (number) | complaints : customer_id (number)