mysql易忘知识点

1.数据类型转换:cast(字段名 as 转换的类型)

常用类型如下:
CHAR[(N)] 字符型 
DATE  日期型
DATETIME  日期和时间型
DECIMAL  float型
SIGNED  int
TIME  时间型
示例:date(类型是日期)字段的值是    2015-11-03 15:31:26
cast(date as signed)  -     20151103153126
cast(date as char)  -        2015-11-03 15:31:26
cast(date as datetime)  -  2015-11-03 15:31:26
cast(date as date)  -      2015-11-03
cast(date as time)  -      15:31:26

你可能感兴趣的:(mysql易忘知识点)