The cast functions are useful when you want to create a column with a specific type in a CREATE ... SELECT statement : CAST : Cast Functions Operators MySQL TUTORIALS


MySQL TUTORIALS » Cast Functions Operators » CAST »

 

The cast functions are useful when you want to create a column with a specific type in a CREATE ... SELECT statement


mysql>
mysql> CREATE TABLE new_table SELECT CAST('2000-01-01' AS DATE);
Query OK, row affected (0.08 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql>
mysql> select from new_table;
+----------------------------+
| CAST('2000-01-01' AS DATE|
+----------------------------+
2000-01-01                 |
+----------------------------+
row in set (0.00 sec)

mysql>
mysql> drop table new_table;
Query OK, rows affected (0.00 sec)



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Cast Functions Operators
» CAST