runtime
06 / 139

task Column aliases · warm-up

Rename and convert a column

For every route that departs from JFK, return route_id, destination, miles (the distance_miles column) and km (miles × 1.609344, rounded to the nearest whole number).

what to return

Columns
route_iddestinationmileskm in this order
Rows
55 rows · any order
Skill
Name output columns and calculated values. Refresher: Aliases & calculated columns →

expected result

Your query should return exactly these columns and values. Run it and compare.

expected result55 rows · any order
route_iddestinationmileskm
2512ATL7601223
2513AUS15212448
2514BNA7651231

first 3 of 55 rows

data you can query

U.S. Flights dataset: the first 6 rows of each table. Under each column name: the kind of value it holds, and which table it links to. Your queries run on all rows.

routes4 columns · 5,436 rows
route_idnumber · unique idorigintext · links to airportsdestinationtext · links to airportsdistance_milesnumber
1ABECLT481
2ABEFLL1041
3ABEMCO906
4ABEMLB914
5ABEMYR518
6ABEPGD1018
route_idnumber · unique id
1
origintext · links to airports
ABE
destinationtext · links to airports
CLT
distance_milesnumber
481
route_idnumber · unique id
2
origintext · links to airports
ABE
destinationtext · links to airports
FLL
distance_milesnumber
1041
route_idnumber · unique id
3
origintext · links to airports
ABE
destinationtext · links to airports
MCO
distance_milesnumber
906
route_idnumber · unique id
4
origintext · links to airports
ABE
destinationtext · links to airports
MLB
distance_milesnumber
914
route_idnumber · unique id
5
origintext · links to airports
ABE
destinationtext · links to airports
MYR
distance_milesnumber
518
route_idnumber · unique id
6
origintext · links to airports
ABE
destinationtext · links to airports
PGD
distance_milesnumber
1018

first 6 of 5,436 rows · your queries use all of them

solution.sql
 

Hints and the answer are always available. Using them counts the question as solved with help.

Rename and convert a column — SQL practice · Runtime