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.
Este exercício faz parte do curso
Cleaning Data in SQL Server Databases
Instruções do exercício
- Concatenate the
carrier_code
, formattedregistration_code
, andairport_code
together using the appropriate function. - Format the
registration_code
column while casting it as an integer. - Filter registers with more than 100 delays.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
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