LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Introduction to Redshift

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

-- Select year_qtr from spectrumdb.ecommerce_sales.
SELECT year_qtr, 
       -- Convert percent_ecom to a decimal
       ___(___ ___ ___(4, ___)) AS percent_ecom_two_places 
  FROM spectrumdb.ecommerce_sales;
Code bearbeiten und ausführen