SQL: Difficult

creating/modifying tables

Write the SQL statement(s) to create each of the requested tables. For each question, the table that your code should produce is shown.

Screen Shot 2019-01-16 at 11.34.11 AM.png

Create a table of cities, flights, and attractions in alphabetical order by city.
‘Baltimore’ | ‘Boston’ | ‘Baltimore Aquarium’
‘Chicago’ | ‘Baltimore’ | ‘Navy Pier’
‘New York’ | ‘ Chicago’ | ‘Central Park’
‘Los Angeles’ | ‘New York’ | ‘Hollywood’
‘San Francisco’ | ‘New York’ | ‘Golden Gate Bridge’

select ______ ;

Create a table of all paths to Chicago involving two flights or less and the number of flights. Hint: First create a table paths and use that to help you create paths_to_chicago.
‘Chicago’ | 0
‘New York, Chicago’ | 1
‘Los Angeles, New York, Chicago’ | 2
‘San Francisco, Los Angeles, Chicago’ | 2

create table paths(path, num_flights, last_location);
______ ;
create table paths_to_chicago as select ______;