码迷,mamicode.com
首页 > 数据库 > 详细

阿里云-maxcompute---sql语法

时间:2020-05-17 21:48:36      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:sign   语法   table   com   结果   sql语法   阿里   --   time   

1.CAST

Cast(字段名 as 转换的类型 ),其中类型可以为:

CHAR[(N)] 字符型 
DATE  日期型
DATETIME  日期和时间型
DECIMAL  float型
SIGNED  int
TIME  时间型

例如表table1

date

2015-11-03 15:31:26

select cast(date as signed) as date from  table1;

结果如下:

date

20151103153126

 

select cast(date as char) as date from  table1;

结果如下:

date

2015-11-03 15:31:26

 

 

select cast(date as datetime) as date from  table1;

结果如下:

date

 

2015-11-03 15:31:26

 

select cast(date as date) as date from  table1;

结果如下:

date

 

2015-11-03

 

select cast(date as time) as date from  table1;

结果如下:

date

15:31:26

这里date对应日期,time对应时间

阿里云-maxcompute---sql语法

标签:sign   语法   table   com   结果   sql语法   阿里   --   time   

原文地址:https://www.cnblogs.com/xlhlx/p/12907021.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!