Effects of casting
When you cast data from one type to another, information can be lost or changed. See how the casting changes values and practice casting data using the CAST()
function and the ::
syntax.
SELECT CAST(value AS new_type);
SELECT value::new_type;
This exercise is part of the course
Exploratory Data Analysis in SQL
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
-- Select the original value
SELECT ___,
-- Cast profits_change
CAST(___ ___ ___) AS profits_change_int
FROM fortune500;