SQL function
cast(expression as type):
It is ANSI standard. Is the type standardized? what types are allowed? Are they different from database to database?
Looked at the MySQL and others. MySQL has signed/unsigned, others has INT.
CAST()
is ANSI standard. Off the top of my head, ANSI data types are things like:
DECIMAL
/NUMERIC
(scale, precision)VARCHAR()
/CHAR()
DATE
/TIME
/DATETIME
/INTERVAL
DOUBLE PRECISION
/FLOAT
BIGINT
/INT
/SMALLINT
MySQL changes the syntax a bit. So, UNSIGNED
and SIGNED
are used instead of INT
. And CHAR
is used for all the character types. Other databases have their own modification for CAST()
. For instance Google BigQuery uses string
instead of the character types.