We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f5a9b73 commit 568018dCopy full SHA for 568018d
Flight Records
@@ -0,0 +1,18 @@
1
+'''
2
+Write a query to create a new table, named flight routes, that displays unique pairs of two locations.
3
4
+
5
+with grouped_pairs as(
6
+select
7
8
9
+case when f1.source_location< f1.destination_location then f1.source_location else f1.destination_location end as destination_one,
10
+case when f1.source_location > f1.destination_location then f1.source_location else f1.destination_location end as destination_two
11
12
+from flights f1)
13
14
15
16
+select destination_one, destination_two from grouped_pairs
17
18
+group by 1,2
0 commit comments