MySQL 타입 변환 Cast / Convert
MySQL 타입변환 Cast
CAST(데이터 AS 타입)
https://dev.mysql.com/doc/refman/8.0/en/cast-functions.html#function_cast
MySQL :: MySQL 8.0 Reference Manual :: 12.10 Cast Functions and Operators
MySQL 8.0 Reference Manual / Functions and Operators / Cast Functions and Operators 12.10 Cast Functions and Operators Table 12.15 Cast Functions and Operators Name Description Deprecated BINARY Cast a string to a binary string 8.0.27 CAST() Cas
dev.mysql.com
예제
SET @t := '10';
// cast to unsigned int
SELECT CAST(@t AS UNSIGNED);
// cast to char
SELECT CAST(@t AS CHAR);
MySQL 타입변환 CONVERT
CONVERT(데이터, 타입)
https://dev.mysql.com/doc/refman/8.0/en/cast-functions.html#function_convert
MySQL :: MySQL 8.0 Reference Manual :: 12.10 Cast Functions and Operators
MySQL 8.0 Reference Manual / Functions and Operators / Cast Functions and Operators 12.10 Cast Functions and Operators Table 12.15 Cast Functions and Operators Name Description Deprecated BINARY Cast a string to a binary string 8.0.27 CAST() Cas
dev.mysql.com
예제
SET @t := '10';
// cast to unsigned int
SELECT CONVERT(@t, UNSIGNED);
// cast to char
SELECT CONVERT(@t, CHAR);