Quotes help make search much faster. Example: "Practice Makes Perfect"

Monday, July 18, 2016

SQL: Table Transformation Lesson 6 Sample Solution


Instructions:
Write a query to view flights by origin, flight id, and sequence number. Alias the sequence number column as flight_sequence_number.

Sample Solution:
SELECT origin, id,
    (SELECT COUNT(*)
FROM flights f
WHERE f.id < flights.id
AND f.origin=flights.origin) + 1
 AS flight_sequence_number
FROM flights;

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts