Get startedGet started for free

Unifying flight formats II

In the previous exercise, you used CONCAT(), REPLICATE(), and LEN(). You got every register with more than 100 delays from the flight_statistics table. In a unique column, you concatenated the carrier_code, registration_code, and airport_code, having a similar format to this one: "AA - 0000119, JFK".

In this exercise, you will solve the same problem again, this time using the FORMAT() and CONCAT() functions together.

This exercise is part of the course

Cleaning Data in SQL Server Databases

View Course

Exercise instructions

  • Concatenate the carrier_code, formatted registration_code, and airport_code together using the appropriate function.
  • Format the registration_code column while casting it as an integer.
  • Filter registers with more than 100 delays.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

SELECT 
    -- Concat the strings
	___(
		carrier_code, 
		' - ', 
        -- Format the code
		___(___(registration_code AS INT), '0000000'),
		', ', 
		airport_code
	) AS registration_code
FROM flight_statistics
-- Filter registers with more than 100 delays
WHERE ___ > 100
Edit and Run Code