1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Redshift

Connected

Exercise

Explicitly converting types

While Redshift has a powerful type compatibility system, there will still be times when you need to convert one data type to another explicitly. Remember several of the functions use format strings, like WW represents the week of the year, DD the two digit day, MM the two digit month, YYYY the four digit year, and DAY represents the day's name.

Instructions 1/3

undefined XP
  • 1
    • Select year_qtr from spectrumdb.ecommerce_sales.
    • CAST percent_ecom to a decimal with 4 digits and 2 decimal places
  • 2
    • Select the week of the year from 2024-09-13.
    • Select the name of the day of the week from the same date.
  • 3
    • Select the conversion of '13-09-2024' to a date using a TO function