MulaiMulai sekarang secara gratis

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;

Latihan ini adalah bagian dari kursus

Exploratory Data Analysis in SQL

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

-- Select the original value
SELECT ___, 
	   -- Cast profits_change
       CAST(___ ___ ___) AS profits_change_int
  FROM fortune500;
Edit dan Jalankan Kode