db_id
stringclasses
146 values
question_en
stringlengths
3
224
hardness
stringclasses
4 values
schema_llm
stringclasses
146 values
query_llm
stringlengths
18
631
schema_llm_min
stringclasses
147 values
schema_dict
stringclasses
146 values
tables_and_columns
stringlengths
18
266
schema_reduzido
stringlengths
25
718
schema_reduzido_only_tables
stringlengths
80
2.27k
bike_1
What are the dates that have an average sea level pressure between 30.3 and 31?
easy
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_Speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
SELECT date FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
{ 'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code'] }
{ 'weather': ['date', 'mean_sea_level_pressure_inches'] }
TABLE weather ( weather.date (TEXT), weather.mean_sea_level_pressure_inches (NUMERIC), ) Possible JOINs:
TABLE weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_Speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs:
bike_1
Find the day in which the difference between the max temperature and min temperature was the smallest. Also report the difference.
medium
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_Speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
SELECT date , max_temperature_f - min_temperature_f FROM weather ORDER BY max_temperature_f - min_temperature_f LIMIT 1
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
{ 'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code'] }
{ 'weather': ['date', 'max_temperature_f', 'min_temperature_f'] }
TABLE weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), ) Possible JOINs:
TABLE weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_Speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs:
bike_1
What are the days that had the smallest temperature range, and what was that range?
medium
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_Speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
SELECT date , max_temperature_f - min_temperature_f FROM weather ORDER BY max_temperature_f - min_temperature_f LIMIT 1
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
{ 'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code'] }
{ 'weather': ['date', 'max_temperature_f', 'min_temperature_f'] }
TABLE weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), ) Possible JOINs:
TABLE weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_Speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs:
bike_1
What are the id and name of the stations that have ever had more than 12 bikes available?
medium
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_Speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
SELECT DISTINCT station.id , station.name FROM station JOIN status ON station.id = status.station_id WHERE status.bikes_available > 12
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
{ 'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code'] }
{ 'station': ['id', 'name'], 'status': ['station_id', 'bikes_available'] }
TABLE station ( station.id (INTEGER), station.name (TEXT), ) TABLE status ( status.station_id (INTEGER), status.bikes_available (INTEGER), ) Possible JOINs: status.station_id = station.id
TABLE station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) TABLE status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Possible JOINs: status.station_id = station.id
bike_1
What are the different ids and names of the stations that have had more than 12 bikes available?
medium
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_Speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
SELECT DISTINCT station.id , station.name FROM station JOIN status ON station.id = status.station_id WHERE status.bikes_available > 12
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
{ 'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code'] }
{ 'station': ['id', 'name'], 'status': ['station_id', 'bikes_available'] }
TABLE station ( station.id (INTEGER), station.name (TEXT), ) TABLE status ( status.station_id (INTEGER), status.bikes_available (INTEGER), ) Possible JOINs: status.station_id = station.id
TABLE station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) TABLE status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Possible JOINs: status.station_id = station.id
bike_1
Give me the zip code where the average mean humidity is below 70 and at least 100 trips took place.
hard
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_Speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
SELECT zip_code FROM weather GROUP BY zip_code HAVING avg(mean_humidity) < 70 INTERSECT SELECT zip_code FROM trip GROUP BY zip_code HAVING count(*) >= 100
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
{ 'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code'] }
{ 'weather': ['mean_humidity', 'zip_code'], 'trip': ['id', 'zip_code'] }
TABLE trip ( trip.id (INTEGER), trip.zip_code (INTEGER), ) TABLE weather ( weather.mean_humidity (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs:
TABLE trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) TABLE weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_Speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs:
bike_1
What are the zip codes that have an average mean humidity below 70 and had at least 100 trips come through there?
hard
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_Speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
SELECT zip_code FROM weather GROUP BY zip_code HAVING avg(mean_humidity) < 70 INTERSECT SELECT zip_code FROM trip GROUP BY zip_code HAVING count(*) >= 100
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
{ 'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code'] }
{ 'weather': ['mean_humidity', 'zip_code'], 'trip': ['id', 'zip_code'] }
TABLE trip ( trip.id (INTEGER), trip.zip_code (INTEGER), ) TABLE weather ( weather.mean_humidity (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs:
TABLE trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) TABLE weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_Speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs:
bike_1
What are the names of stations that are located in Palo Alto city but have never been the ending point of trips more than 100 times?
hard
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_Speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
SELECT name FROM station WHERE city = "Palo Alto" EXCEPT SELECT end_station_name FROM trip GROUP BY end_station_name HAVING count(*) > 100
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
{ 'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code'] }
{ 'station': ['id', 'name', 'city'], 'trip': ['id', 'end_station_name'] }
TABLE station ( station.id (INTEGER), station.name (TEXT), station.city (TEXT), ) TABLE trip ( trip.id (INTEGER), trip.end_station_name (TEXT), ) Possible JOINs:
TABLE station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) TABLE trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Possible JOINs:
bike_1
What are the names of the stations that are located in Palo Alto but have never been the ending point of the trips
hard
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_Speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
SELECT name FROM station WHERE city = "Palo Alto" EXCEPT SELECT end_station_name FROM trip GROUP BY end_station_name HAVING count(*) > 100
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
{ 'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code'] }
{ 'station': ['id', 'name', 'city'], 'trip': ['id', 'end_station_name'] }
TABLE station ( station.id (INTEGER), station.name (TEXT), station.city (TEXT), ) TABLE trip ( trip.id (INTEGER), trip.end_station_name (TEXT), ) Possible JOINs:
TABLE station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) TABLE trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Possible JOINs:
bike_1
How many trips started from Mountain View city and ended at Palo Alto city?
extra
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_Speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
SELECT count(*) FROM station JOIN trip JOIN station JOIN trip ON station.id = trip.start_station_id AND trip.id = trip.id AND station.id = trip.end_station_id WHERE station.city = "Mountain View" AND station.city = "Palo Alto"
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
{ 'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code'] }
{ 'station': ['id', 'city'], 'trip': ['id', 'start_station_id', 'end_station_id'] }
TABLE station ( station.id (INTEGER), station.city (TEXT), ) TABLE trip ( trip.id (INTEGER), trip.start_station_id (INTEGER), trip.end_station_id (INTEGER), ) Possible JOINs:
TABLE station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) TABLE trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Possible JOINs:
bike_1
How many trips stated from a station in Mountain View and ended at one in Palo Alto?
extra
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_Speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
SELECT count(*) FROM station JOIN trip JOIN station JOIN trip ON station.id = trip.start_station_id AND trip.id = trip.id AND station.id = trip.end_station_id WHERE station.city = "Mountain View" AND station.city = "Palo Alto"
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
{ 'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code'] }
{ 'station': ['id', 'city'], 'trip': ['id', 'start_station_id', 'end_station_id'] }
TABLE station ( station.id (INTEGER), station.city (TEXT), ) TABLE trip ( trip.id (INTEGER), trip.start_station_id (INTEGER), trip.end_station_id (INTEGER), ) Possible JOINs:
TABLE station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) TABLE trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Possible JOINs:
bike_1
What is the average latitude and longitude of the starting points of all trips?
medium
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_Speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
SELECT avg(station.lat) , avg(station.long) FROM station JOIN trip ON station.id = trip.start_station_id
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
{ 'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code'] }
{ 'station': ['id', 'lat', 'long'], 'trip': ['id', 'start_station_id'] }
TABLE station ( station.id (INTEGER), station.lat (NUMERIC), station.long (NUMERIC), ) TABLE trip ( trip.id (INTEGER), trip.start_station_id (INTEGER), ) Possible JOINs:
TABLE station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) TABLE trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Possible JOINs:
bike_1
What is the average latitude and longitude of all starting stations for the trips?
medium
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_Speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
SELECT avg(station.lat) , avg(station.long) FROM station JOIN trip ON station.id = trip.start_station_id
Table station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) Table status ( status.station_id (INTEGER), status.bikes_available (INTEGER), status.docks_available (INTEGER), status.time (TEXT), ) Table trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Table weather ( weather.date (TEXT), weather.max_temperature_f (INTEGER), weather.mean_temperature_f (INTEGER), weather.min_temperature_f (INTEGER), weather.max_dew_point_f (INTEGER), weather.mean_dew_point_f (INTEGER), weather.min_dew_point_f (INTEGER), weather.max_humidity (INTEGER), weather.mean_humidity (INTEGER), weather.min_humidity (INTEGER), weather.max_sea_level_pressure_inches (NUMERIC), weather.mean_sea_level_pressure_inches (NUMERIC), weather.min_sea_level_pressure_inches (NUMERIC), weather.max_visibility_miles (INTEGER), weather.mean_visibility_miles (INTEGER), weather.min_visibility_miles (INTEGER), weather.max_wind_speed_mph (INTEGER), weather.mean_wind_speed_mph (INTEGER), weather.max_gust_speed_mph (INTEGER), weather.precipitation_inches (INTEGER), weather.cloud_cover (INTEGER), weather.events (TEXT), weather.wind_dir_degrees (INTEGER), weather.zip_code (INTEGER), ) Possible JOINs: status.station_id = station.id
{ 'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code'] }
{ 'station': ['id', 'lat', 'long'], 'trip': ['id', 'start_station_id'] }
TABLE station ( station.id (INTEGER), station.lat (NUMERIC), station.long (NUMERIC), ) TABLE trip ( trip.id (INTEGER), trip.start_station_id (INTEGER), ) Possible JOINs:
TABLE station ( station.id (INTEGER), station.name (TEXT), station.lat (NUMERIC), station.long (NUMERIC), station.dock_count (INTEGER), station.city (TEXT), station.installation_date (TEXT), ) TABLE trip ( trip.id (INTEGER), trip.duration (INTEGER), trip.start_date (TEXT), trip.start_station_name (TEXT), trip.start_station_id (INTEGER), trip.end_date (TEXT), trip.end_station_name (TEXT), trip.end_station_id (INTEGER), trip.bike_id (INTEGER), trip.subscription_type (TEXT), trip.zip_code (INTEGER), ) Possible JOINs:
book_2
How many books are there?
easy
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT count(*) FROM book
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'book': ['book_id'] }
TABLE book ( book.Book_ID (INT), ) Possible JOINs:
TABLE book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Possible JOINs:
book_2
List the writers of the books in ascending alphabetical order.
easy
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT Writer FROM book ORDER BY Writer ASC
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'book': ['book_id', 'writer'] }
TABLE book ( book.Book_ID (INT), book.Writer (TEXT), ) Possible JOINs:
TABLE book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Possible JOINs:
book_2
List the titles of the books in ascending order of issues.
easy
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT Title FROM book ORDER BY Issues ASC
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'book': ['book_id', 'title', 'issues'] }
TABLE book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), ) Possible JOINs:
TABLE book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Possible JOINs:
book_2
What are the titles of the books whose writer is not "Elaine Lee"?
easy
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT Title FROM book WHERE Writer != "Elaine Lee"
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'book': ['book_id', 'title', 'writer'] }
TABLE book ( book.Book_ID (INT), book.Title (TEXT), book.Writer (TEXT), ) Possible JOINs:
TABLE book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Possible JOINs:
book_2
What are the title and issues of the books?
medium
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT Title , Issues FROM book
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'book': ['book_id', 'title', 'issues'] }
TABLE book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), ) Possible JOINs:
TABLE book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Possible JOINs:
book_2
What are the dates of publications in descending order of price?
easy
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT Publication_Date FROM publication ORDER BY Price DESC
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'publication': ['publication_id', 'publication_date', 'price'] }
TABLE publication ( publication.Publication_ID (INT), publication.Publication_Date (TEXT), publication.Price (REAL), )
TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
book_2
What are the distinct publishers of publications with price higher than 5000000?
easy
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT DISTINCT Publisher FROM publication WHERE Price > 5000000
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'publication': ['publication_id', 'publisher', 'price'] }
TABLE publication ( publication.Publication_ID (INT), publication.Publisher (TEXT), publication.Price (REAL), )
TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
book_2
List the publisher of the publication with the highest price.
medium
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT Publisher FROM publication ORDER BY Price DESC LIMIT 1
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'publication': ['publication_id', 'publisher', 'price'] }
TABLE publication ( publication.Publication_ID (INT), publication.Publisher (TEXT), publication.Price (REAL), )
TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
book_2
List the publication dates of publications with 3 lowest prices.
medium
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT Publication_Date FROM publication ORDER BY Price ASC LIMIT 3
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'publication': ['publication_id', 'publication_date', 'price'] }
TABLE publication ( publication.Publication_ID (INT), publication.Publication_Date (TEXT), publication.Price (REAL), )
TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
book_2
Show the title and publication dates of books.
medium
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT book.Title , publication.Publication_Date FROM book JOIN publication ON book.Book_ID = publication.Book_ID
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'book': ['book_id', 'title'], 'publication': ['publication_id', 'book_id', 'publication_date'] }
TABLE book ( book.Book_ID (INT), book.Title (TEXT), ) TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publication_Date (TEXT), )
TABLE book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
book_2
Show writers who have published a book with price more than 4000000.
medium
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT book.Writer FROM book JOIN publication ON book.Book_ID = publication.Book_ID WHERE publication.Price > 4000000
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'book': ['book_id', 'writer'], 'publication': ['publication_id', 'book_id', 'price'] }
TABLE book ( book.Book_ID (INT), book.Writer (TEXT), ) TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Price (REAL), )
TABLE book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
book_2
Show the titles of books in descending order of publication price.
medium
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT book.Title FROM book JOIN publication ON book.Book_ID = publication.Book_ID ORDER BY publication.Price DESC
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'book': ['book_id', 'title'], 'publication': ['publication_id', 'book_id', 'price'] }
TABLE book ( book.Book_ID (INT), book.Title (TEXT), ) TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Price (REAL), )
TABLE book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
book_2
Show publishers that have more than one publication.
easy
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT Publisher FROM publication GROUP BY Publisher HAVING COUNT(*) > 1
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'publication': ['publication_id', 'publisher'] }
TABLE publication ( publication.Publication_ID (INT), publication.Publisher (TEXT), )
TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
book_2
Show different publishers together with the number of publications they have.
medium
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT Publisher , COUNT(*) FROM publication GROUP BY Publisher
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'publication': ['publication_id', 'publisher'] }
TABLE publication ( publication.Publication_ID (INT), publication.Publisher (TEXT), )
TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
book_2
Please show the most common publication date.
hard
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT Publication_Date FROM publication GROUP BY Publication_Date ORDER BY COUNT(*) DESC LIMIT 1
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'publication': ['publication_id', 'publication_date'] }
TABLE publication ( publication.Publication_ID (INT), publication.Publication_Date (TEXT), )
TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
book_2
List the writers who have written more than one book.
easy
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT Writer FROM book GROUP BY Writer HAVING COUNT(*) > 1
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'book': ['book_id', 'writer'] }
TABLE book ( book.Book_ID (INT), book.Writer (TEXT), ) Possible JOINs:
TABLE book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Possible JOINs:
book_2
List the titles of books that are not published.
hard
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT Title FROM book WHERE Book_ID NOT IN (SELECT Book_ID FROM publication)
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'book': ['book_id', 'title'], 'publication': ['publication_id', 'book_id'] }
TABLE book ( book.Book_ID (INT), book.Title (TEXT), ) TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), )
TABLE book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
book_2
Show the publishers that have publications with price higher than 10000000 and publications with price lower than 5000000.
hard
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT Publisher FROM publication WHERE Price > 10000000 INTERSECT SELECT Publisher FROM publication WHERE Price < 5000000
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'publication': ['publication_id', 'publisher', 'price'] }
TABLE publication ( publication.Publication_ID (INT), publication.Publisher (TEXT), publication.Price (REAL), )
TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
book_2
What is the number of distinct publication dates?
easy
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT COUNT (DISTINCT Publication_Date) FROM publication
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'publication': ['publication_id', 'publication_date'] }
TABLE publication ( publication.Publication_ID (INT), publication.Publication_Date (TEXT), )
TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
book_2
How many distinct publication dates are there in our record?
easy
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT COUNT (DISTINCT Publication_Date) FROM publication
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'publication': ['publication_id', 'publication_date'] }
TABLE publication ( publication.Publication_ID (INT), publication.Publication_Date (TEXT), )
TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
book_2
Show the prices of publications whose publisher is either "Person" or "Wiley"
medium
Table book ( book.Book_ID (INT), book.Title (TEXT), book.Issues (REAL), book.Writer (TEXT), ) Table publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
SELECT Price FROM publication WHERE Publisher = "Person" OR Publisher = "Wiley"
Table book ( book.book_id (INT), book.title (TEXT), book.issues (REAL), book.writer (TEXT), ) Table publication ( publication.publication_id (INT), publication.book_id (INT), publication.publisher (TEXT), publication.publication_date (TEXT), publication.price (REAL), ) Possible JOINs: publication.book_id = book.book_id
{ 'publication': ['publication_id', 'book_id', 'publisher', 'publication_date', 'price'], 'book': ['book_id', 'title', 'issues', 'writer'] }
{ 'publication': ['publication_id', 'publisher', 'price'] }
TABLE publication ( publication.Publication_ID (INT), publication.Publisher (TEXT), publication.Price (REAL), )
TABLE publication ( publication.Publication_ID (INT), publication.Book_ID (INT), publication.Publisher (TEXT), publication.Publication_Date (TEXT), publication.Price (REAL), ) Possible JOINs: publication.Book_ID = book.Book_ID
musical
How many actors are there?
easy
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT count(*) FROM actor
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id'] }
TABLE actor ( actor.Actor_ID (INT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
Count the number of actors.
easy
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT count(*) FROM actor
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id'] }
TABLE actor ( actor.Actor_ID (INT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
List the name of actors in ascending alphabetical order.
easy
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Name FROM actor ORDER BY Name ASC
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'name'] }
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
What are the names of actors, ordered alphabetically?
easy
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Name FROM actor ORDER BY Name ASC
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'name'] }
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
What are the characters and duration of actors?
medium
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT CHARACTER , Duration FROM actor
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'character', 'duration'] }
TABLE actor ( actor.Actor_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
Return the characters and durations for each actor.
medium
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT CHARACTER , Duration FROM actor
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'character', 'duration'] }
TABLE actor ( actor.Actor_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
List the name of actors whose age is not 20.
easy
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Name FROM actor WHERE Age != 20
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'name', 'age'] }
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.age (INT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
What are the names of actors who are not 20 years old?
easy
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Name FROM actor WHERE Age != 20
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'name', 'age'] }
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.age (INT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
What are the characters of actors in descending order of age?
easy
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT CHARACTER FROM actor ORDER BY age DESC
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'character', 'age'] }
TABLE actor ( actor.Actor_ID (INT), actor.Character (TEXT), actor.age (INT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
Return the characters for actors, ordered by age descending.
easy
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT CHARACTER FROM actor ORDER BY age DESC
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'character', 'age'] }
TABLE actor ( actor.Actor_ID (INT), actor.Character (TEXT), actor.age (INT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
What is the duration of the oldest actor?
medium
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Duration FROM actor ORDER BY Age DESC LIMIT 1
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'duration', 'age'] }
TABLE actor ( actor.Actor_ID (INT), actor.Duration (TEXT), actor.age (INT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
Return the duration of the actor with the greatest age.
medium
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Duration FROM actor ORDER BY Age DESC LIMIT 1
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'duration', 'age'] }
TABLE actor ( actor.Actor_ID (INT), actor.Duration (TEXT), actor.age (INT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
What are the names of musicals with nominee "Bob Fosse"?
easy
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Name FROM musical WHERE Nominee = "Bob Fosse"
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'musical': ['musical_id', 'name', 'nominee'] }
TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Nominee (TEXT), ) Possible JOINs:
TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs:
musical
Return the names of musicals who have the nominee Bob Fosse.
easy
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Name FROM musical WHERE Nominee = "Bob Fosse"
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'musical': ['musical_id', 'name', 'nominee'] }
TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Nominee (TEXT), ) Possible JOINs:
TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs:
musical
What are the distinct nominees of the musicals with the award that is not "Tony Award"?
easy
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT DISTINCT Nominee FROM musical WHERE Award != "Tony Award"
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'musical': ['musical_id', 'award', 'nominee'] }
TABLE musical ( musical.Musical_ID (INT), musical.Award (TEXT), musical.Nominee (TEXT), ) Possible JOINs:
TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs:
musical
Return the different nominees of musicals that have an award that is not the Tony Award.
easy
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT DISTINCT Nominee FROM musical WHERE Award != "Tony Award"
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'musical': ['musical_id', 'award', 'nominee'] }
TABLE musical ( musical.Musical_ID (INT), musical.Award (TEXT), musical.Nominee (TEXT), ) Possible JOINs:
TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs:
musical
Show names of actors and names of musicals they are in.
medium
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT actor.Name , musical.Name FROM actor JOIN musical ON actor.Musical_ID = musical.Musical_ID
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'name', 'musical_id'], 'musical': ['musical_id', 'name'] }
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
What are the names of actors and the musicals that they are in?
medium
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT actor.Name , musical.Name FROM actor JOIN musical ON actor.Musical_ID = musical.Musical_ID
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'name', 'musical_id'], 'musical': ['musical_id', 'name'] }
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
Show names of actors that have appeared in musical with name "The Phantom of the Opera".
medium
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT actor.Name FROM actor JOIN musical ON actor.Musical_ID = musical.Musical_ID WHERE musical.Name = "The Phantom of the Opera"
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'name', 'musical_id'], 'musical': ['musical_id', 'name'] }
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
What are the names of actors who have been in the musical titled The Phantom of the Opera?
medium
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT actor.Name FROM actor JOIN musical ON actor.Musical_ID = musical.Musical_ID WHERE musical.Name = "The Phantom of the Opera"
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'name', 'musical_id'], 'musical': ['musical_id', 'name'] }
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
Show names of actors in descending order of the year their musical is awarded.
medium
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT actor.Name FROM actor JOIN musical ON actor.Musical_ID = musical.Musical_ID ORDER BY musical.Year DESC
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'name', 'musical_id'], 'musical': ['musical_id', 'year'] }
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Year (INT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
What are the names of actors ordered descending by the year in which their musical was awarded?
medium
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT actor.Name FROM actor JOIN musical ON actor.Musical_ID = musical.Musical_ID ORDER BY musical.Year DESC
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'name', 'musical_id'], 'musical': ['musical_id', 'year'] }
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Year (INT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
Show names of musicals and the number of actors who have appeared in the musicals.
medium
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT musical.Name , COUNT(*) FROM actor JOIN musical ON actor.Musical_ID = musical.Musical_ID GROUP BY actor.Musical_ID
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'musical_id'], 'musical': ['musical_id', 'name'] }
TABLE actor ( actor.Actor_ID (INT), actor.Musical_ID (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
How many actors have appeared in each musical?
medium
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT musical.Name , COUNT(*) FROM actor JOIN musical ON actor.Musical_ID = musical.Musical_ID GROUP BY actor.Musical_ID
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'musical_id'], 'musical': ['musical_id', 'name'] }
TABLE actor ( actor.Actor_ID (INT), actor.Musical_ID (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
Show names of musicals which have at least three actors.
medium
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT musical.Name FROM actor JOIN musical ON actor.Musical_ID = musical.Musical_ID GROUP BY actor.Musical_ID HAVING COUNT(*) >= 3
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'musical_id'], 'musical': ['musical_id', 'name'] }
TABLE actor ( actor.Actor_ID (INT), actor.Musical_ID (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
What are the names of musicals who have at 3 or more actors?
medium
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT musical.Name FROM actor JOIN musical ON actor.Musical_ID = musical.Musical_ID GROUP BY actor.Musical_ID HAVING COUNT(*) >= 3
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'actor': ['actor_id', 'musical_id'], 'musical': ['musical_id', 'name'] }
TABLE actor ( actor.Actor_ID (INT), actor.Musical_ID (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
Show different nominees and the number of musicals they have been nominated.
medium
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Nominee , COUNT(*) FROM musical GROUP BY Nominee
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'musical': ['musical_id', 'nominee'] }
TABLE musical ( musical.Musical_ID (INT), musical.Nominee (TEXT), ) Possible JOINs:
TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs:
musical
How many musicals has each nominee been nominated for?
medium
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Nominee , COUNT(*) FROM musical GROUP BY Nominee
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'musical': ['musical_id', 'nominee'] }
TABLE musical ( musical.Musical_ID (INT), musical.Nominee (TEXT), ) Possible JOINs:
TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs:
musical
Please show the nominee who has been nominated the greatest number of times.
hard
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Nominee FROM musical GROUP BY Nominee ORDER BY COUNT(*) DESC LIMIT 1
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'musical': ['musical_id', 'nominee'] }
TABLE musical ( musical.Musical_ID (INT), musical.Nominee (TEXT), ) Possible JOINs:
TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs:
musical
Who is the nominee who has been nominated for the most musicals?
hard
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Nominee FROM musical GROUP BY Nominee ORDER BY COUNT(*) DESC LIMIT 1
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'musical': ['musical_id', 'nominee'] }
TABLE musical ( musical.Musical_ID (INT), musical.Nominee (TEXT), ) Possible JOINs:
TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs:
musical
List the most common result of the musicals.
hard
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT RESULT FROM musical GROUP BY RESULT ORDER BY COUNT(*) DESC LIMIT 1
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'musical': ['musical_id', 'result'] }
TABLE musical ( musical.Musical_ID (INT), musical.Result (TEXT), ) Possible JOINs:
TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs:
musical
Return the most frequent result across all musicals.
hard
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT RESULT FROM musical GROUP BY RESULT ORDER BY COUNT(*) DESC LIMIT 1
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'musical': ['musical_id', 'result'] }
TABLE musical ( musical.Musical_ID (INT), musical.Result (TEXT), ) Possible JOINs:
TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs:
musical
List the nominees that have been nominated more than two musicals.
easy
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Nominee FROM musical GROUP BY Nominee HAVING COUNT(*) > 2
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'musical': ['musical_id', 'nominee'] }
TABLE musical ( musical.Musical_ID (INT), musical.Nominee (TEXT), ) Possible JOINs:
TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs:
musical
Who are the nominees who have been nominated more than two times?
easy
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Nominee FROM musical GROUP BY Nominee HAVING COUNT(*) > 2
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'musical': ['musical_id', 'nominee'] }
TABLE musical ( musical.Musical_ID (INT), musical.Nominee (TEXT), ) Possible JOINs:
TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs:
musical
List the name of musicals that do not have actors.
hard
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Name FROM musical WHERE Musical_ID NOT IN (SELECT Musical_ID FROM actor)
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'musical': ['musical_id', 'name'], 'actor': ['actor_id', 'name', 'musical_id'] }
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
What are the names of musicals who have no actors?
hard
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Name FROM musical WHERE Musical_ID NOT IN (SELECT Musical_ID FROM actor)
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'musical': ['musical_id', 'name'], 'actor': ['actor_id', 'name', 'musical_id'] }
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), )
TABLE actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
musical
Show the nominees that have nominated musicals for both "Tony Award" and "Drama Desk Award".
hard
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Nominee FROM musical WHERE Award = "Tony Award" INTERSECT SELECT Nominee FROM musical WHERE Award = "Drama Desk Award"
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'musical': ['musical_id', 'award', 'nominee'] }
TABLE musical ( musical.Musical_ID (INT), musical.Award (TEXT), musical.Nominee (TEXT), ) Possible JOINs:
TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs:
musical
Who are the nominees who have been nominated for both a Tony Award and a Drama Desk Award?
hard
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Nominee FROM musical WHERE Award = "Tony Award" INTERSECT SELECT Nominee FROM musical WHERE Award = "Drama Desk Award"
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'musical': ['musical_id', 'award', 'nominee'] }
TABLE musical ( musical.Musical_ID (INT), musical.Award (TEXT), musical.Nominee (TEXT), ) Possible JOINs:
TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs:
musical
Show the musical nominee with award "Bob Fosse" or "Cleavant Derricks".
medium
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Nominee FROM musical WHERE Award = "Tony Award" OR Award = "Cleavant Derricks"
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'musical': ['musical_id', 'award', 'nominee'] }
TABLE musical ( musical.Musical_ID (INT), musical.Award (TEXT), musical.Nominee (TEXT), ) Possible JOINs:
TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs:
musical
Who are the nominees who were nominated for either of the Bob Fosse or Cleavant Derricks awards?
medium
Table actor ( actor.Actor_ID (INT), actor.Name (TEXT), actor.Musical_ID (INT), actor.Character (TEXT), actor.Duration (TEXT), actor.age (INT), ) Table musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs: actor.Musical_ID = actor.Actor_ID
SELECT Nominee FROM musical WHERE Award = "Tony Award" OR Award = "Cleavant Derricks"
Table actor ( actor.actor_id (INT), actor.name (TEXT), actor.musical_id (INT), actor.character (TEXT), actor.duration (TEXT), actor.age (INT), ) Table musical ( musical.musical_id (INT), musical.name (TEXT), musical.year (INT), musical.award (TEXT), musical.category (TEXT), musical.nominee (TEXT), musical.result (TEXT), ) Possible JOINs: actor.musical_id = actor.actor_id
{ 'musical': ['musical_id', 'name', 'year', 'award', 'category', 'nominee', 'result'], 'actor': ['actor_id', 'name', 'musical_id', 'character', 'duration', 'age'] }
{ 'musical': ['musical_id', 'award', 'nominee'] }
TABLE musical ( musical.Musical_ID (INT), musical.Award (TEXT), musical.Nominee (TEXT), ) Possible JOINs:
TABLE musical ( musical.Musical_ID (INT), musical.Name (TEXT), musical.Year (INT), musical.Award (TEXT), musical.Category (TEXT), musical.Nominee (TEXT), musical.Result (TEXT), ) Possible JOINs:
twitter_1
Find the emails of the user named "Mary".
easy
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT email FROM user_profiles WHERE name = 'Mary'
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'name', 'email'] }
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), ) Possible JOINs:
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs:
twitter_1
What is the partition id of the user named "Iron Man".
easy
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT partitionid FROM user_profiles WHERE name = 'Iron Man'
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'name', 'partitionid'] }
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.partitionid (int(11)), ) Possible JOINs:
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs:
twitter_1
How many users are there?
easy
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT count(*) FROM user_profiles
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid'] }
TABLE user_profiles ( user_profiles.uid (int(11)), ) Possible JOINs:
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs:
twitter_1
How many followers does each user have?
easy
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT count(*) FROM follows
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'follows': ['f1'] }
TABLE follows ( follows.f1 (int(11)), )
TABLE follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid
twitter_1
Find the number of followers for each user.
easy
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT count(*) FROM follows GROUP BY f1
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'follows': ['f1'] }
TABLE follows ( follows.f1 (int(11)), )
TABLE follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid
twitter_1
Find the number of tweets in record.
easy
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT count(*) FROM tweets
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'tweets': ['id'] }
TABLE tweets ( tweets.id (bigint(20)), )
TABLE tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Possible JOINs: tweets.uid = user_profiles.uid
twitter_1
Find the number of users who posted some tweets.
easy
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT count(DISTINCT UID) FROM tweets
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'tweets': ['id', 'uid'] }
TABLE tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), )
TABLE tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Possible JOINs: tweets.uid = user_profiles.uid
twitter_1
Find the name and email of the user whose name contains the word ‘Swift’.
medium
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT name , email FROM user_profiles WHERE name LIKE '%Swift%'
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'name', 'email'] }
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), ) Possible JOINs:
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs:
twitter_1
Find the names of users whose emails contain ‘superstar’ or ‘edu’.
extra
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT name FROM user_profiles WHERE email LIKE '%superstar%' OR email LIKE '%edu%'
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'name', 'email'] }
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), ) Possible JOINs:
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs:
twitter_1
Return the text of tweets about the topic 'intern'.
medium
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT text FROM tweets WHERE text LIKE '%intern%'
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'tweets': ['id', 'text'] }
TABLE tweets ( tweets.id (bigint(20)), tweets.text (char(140)), )
TABLE tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Possible JOINs: tweets.uid = user_profiles.uid
twitter_1
Find the name and email of the users who have more than 1000 followers.
medium
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT name , email FROM user_profiles WHERE followers > 1000
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'name', 'email', 'followers'] }
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.followers (int(11)), ) Possible JOINs:
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs:
twitter_1
Find the names of the users whose number of followers is greater than that of the user named "Tyler Swift".
extra
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT user_profiles.name FROM user_profiles JOIN follows ON user_profiles.uid = follows.f1 GROUP BY follows.f1 HAVING count(*) > (SELECT count(*) FROM user_profiles JOIN follows ON user_profiles.uid = follows.f1 WHERE user_profiles.name = 'Tyler Swift')
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'name'], 'follows': ['f1'] }
TABLE follows ( follows.f1 (int(11)), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), ) Possible JOINs: follows.f1 = user_profiles.uid
TABLE follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid
twitter_1
Find the name and email for the users who have more than one follower.
medium
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT user_profiles.name , user_profiles.email FROM user_profiles JOIN follows ON user_profiles.uid = follows.f1 GROUP BY follows.f1 HAVING count(*) > 1
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'name', 'email'], 'follows': ['f1'] }
TABLE follows ( follows.f1 (int(11)), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), ) Possible JOINs: follows.f1 = user_profiles.uid
TABLE follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid
twitter_1
Find the names of users who have more than one tweet.
medium
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT user_profiles.name FROM user_profiles JOIN tweets ON user_profiles.uid = tweets.uid GROUP BY tweets.uid HAVING count(*) > 1
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'name'], 'tweets': ['id', 'uid'] }
TABLE tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), ) Possible JOINs: tweets.uid = user_profiles.uid
TABLE tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: tweets.uid = user_profiles.uid
twitter_1
Find the id of users who are followed by Mary and Susan.
extra
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT follows.f1 FROM user_profiles JOIN follows ON user_profiles.uid = follows.f2 WHERE user_profiles.name = "Mary" INTERSECT SELECT follows.f1 FROM user_profiles JOIN follows ON user_profiles.uid = follows.f2 WHERE user_profiles.name = "Susan"
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'name'], 'follows': ['f1', 'f2'] }
TABLE follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid
TABLE follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid
twitter_1
Find the id of users who are followed by Mary or Susan.
hard
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT follows.f1 FROM user_profiles JOIN follows ON user_profiles.uid = follows.f2 WHERE user_profiles.name = "Mary" OR user_profiles.name = "Susan"
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'name'], 'follows': ['f1', 'f2'] }
TABLE follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid
TABLE follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid
twitter_1
Find the name of the user who has the largest number of followers.
medium
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT name FROM user_profiles ORDER BY followers DESC LIMIT 1
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'name', 'followers'] }
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.followers (int(11)), ) Possible JOINs:
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs:
twitter_1
Find the name and email of the user followed by the least number of people.
medium
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT name , email FROM user_profiles ORDER BY followers LIMIT 1
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'name', 'email', 'followers'] }
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.followers (int(11)), ) Possible JOINs:
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs:
twitter_1
List the name and number of followers for each user, and sort the results by the number of followers in descending order.
medium
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT name , followers FROM user_profiles ORDER BY followers DESC
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'name', 'followers'] }
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.followers (int(11)), ) Possible JOINs:
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs:
twitter_1
List the names of 5 users followed by the largest number of other users.
medium
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT name FROM user_profiles ORDER BY followers DESC LIMIT 5
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'name', 'followers'] }
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.followers (int(11)), ) Possible JOINs:
TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs:
twitter_1
List the text of all tweets in the order of date.
easy
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT text FROM tweets ORDER BY createdate
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'tweets': ['id', 'text', 'createdate'] }
TABLE tweets ( tweets.id (bigint(20)), tweets.text (char(140)), tweets.createdate (datetime), )
TABLE tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Possible JOINs: tweets.uid = user_profiles.uid
twitter_1
Find the name of each user and number of tweets tweeted by each of them.
medium
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT user_profiles.name , count(*) FROM user_profiles JOIN tweets ON user_profiles.uid = tweets.uid GROUP BY tweets.uid
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'name'], 'tweets': ['id', 'uid'] }
TABLE tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), ) Possible JOINs: tweets.uid = user_profiles.uid
TABLE tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: tweets.uid = user_profiles.uid
twitter_1
Find the name and partition id for users who tweeted less than twice.
medium
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT user_profiles.name , user_profiles.partitionid FROM user_profiles JOIN tweets ON user_profiles.uid = tweets.uid GROUP BY tweets.uid HAVING count(*) < 2
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'name', 'partitionid'], 'tweets': ['id', 'uid'] }
TABLE tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.partitionid (int(11)), ) Possible JOINs: tweets.uid = user_profiles.uid
TABLE tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: tweets.uid = user_profiles.uid
twitter_1
Find the name of the user who tweeted more than once, and number of tweets tweeted by them.
medium
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT user_profiles.name , count(*) FROM user_profiles JOIN tweets ON user_profiles.uid = tweets.uid GROUP BY tweets.uid HAVING count(*) > 1
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'name'], 'tweets': ['id', 'uid'] }
TABLE tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), ) Possible JOINs: tweets.uid = user_profiles.uid
TABLE tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: tweets.uid = user_profiles.uid
twitter_1
Find the average number of followers for the users who do not have any tweet.
extra
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT avg(followers) FROM user_profiles WHERE UID NOT IN (SELECT UID FROM tweets)
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'followers'], 'tweets': ['id', 'uid'] }
TABLE tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: tweets.uid = user_profiles.uid
TABLE tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: tweets.uid = user_profiles.uid
twitter_1
Find the average number of followers for the users who had some tweets.
hard
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
SELECT avg(followers) FROM user_profiles WHERE UID IN (SELECT UID FROM tweets)
Table follows ( follows.f1 (int(11)), follows.f2 (int(11)), ) Table tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) Table user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: follows.f1 = user_profiles.uid follows.f2 = user_profiles.uid tweets.uid = user_profiles.uid
{ 'follows': ['f1', 'f2'], 'tweets': ['id', 'uid', 'text', 'createdate'], 'user_profiles': ['uid', 'name', 'email', 'partitionid', 'followers'] }
{ 'user_profiles': ['uid', 'followers'], 'tweets': ['id', 'uid'] }
TABLE tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: tweets.uid = user_profiles.uid
TABLE tweets ( tweets.id (bigint(20)), tweets.uid (int(11)), tweets.text (char(140)), tweets.createdate (datetime), ) TABLE user_profiles ( user_profiles.uid (int(11)), user_profiles.name (varchar(255)), user_profiles.email (varchar(255)), user_profiles.partitionid (int(11)), user_profiles.followers (int(11)), ) Possible JOINs: tweets.uid = user_profiles.uid