达蒙数据与 mysql 数据库的区别 - 高扩展性
支持拓展软件包和多种工具,实现海量数据分析处理、数据共享集群(DSC)和无共享数据库集群(MPP)等扩展功能
与MySQL的区别
-
创建表的时候,不支持在列的后面直接加 comment 注释,使用 COMMENT ON IS 代替,如:
COMMENT ON TABLE xxx IS xxx
COMMENT ON COLUMN xxx IS xxx -
不支持 date_sub 函数,使用 dateadd(datepart,n,date) 代替,
其中,datepart可以为:year(yy,yyyy),quarter(qq,q),month(mm,m),dayofyear(dy,y),day(dd,d),week(wk,ww),weekday(dw),hour(hh), minute(mi,n), second(ss,s), millisecond(ms)
例子:
select dateadd(month, -6, now());
select dateadd(month, 2, now()); -
不支持 date_format 函数,它有三种代替方法:
a: 使用 datepart 代替:语法:datepart(datepart, date),返回代表日期的指定部分的整数,
datepart可以为:year(yy,yyyy),quarter(qq,q),month(mm,m),dayofyear(dy,y),day(dd,d),week(wk,ww),weekday(dw),hour(hh), minute(mi,n),second(ss,s), millisecond(ms) 例子: select datepart(year, '2018-12-13 08:45:00'); --2018 select datepart(month, '2018-12-13 08:45:00'); --12
b: 使用 date_part 代替,功能和 datepart 一样,写法不同,参数顺序颠倒,且都要加引号,
例子: select date_part('2018-12-13 08:45:00', 'year');--2018 select date_part('2018-12-13 08:45:00', 'mm'); -- 12
c: 使用 extract 代替,语法:extract(dtfield from date),从日期类型date中抽取dtfield对应的值
dtfield 可以是 year,month,day,hour,minute,second
例子:
select extract(year from ‘2018-12-13 08:45:00’); --2018
select extract(month from ‘2018-12-13 08:45:00’); --12 -
不支持 substring_index 函数, 使用 substr / substring 代替,
语法:
substr(char[,m[,n]])
substring(char[from m[ for n]]) -
不支持 group_concat 函数,使用 wm_concat 代替,
例子:
select wm_concat(id) as idstr from persion ORDER BY id ; -
不支持 from_unixtime 函数,使用 round 代替
语法:round(date[,format])
-
不支持 case-when-then-else ,
例如:
select case when id = 2 then “aaa” when id = 3 then “bbb” else “ccc” end as test
from (select id from person) tt; -
current_timestamp 的返回值带有时区,
例子:
select current_timestamp();
2018-12-17 14:34:18.433839 +08:00 -
convert(type, value) 函数,
与 mysql 的 convert 一样,但是参数是反过来的,mysql 是 convert(value, type)
-
不支持 on duplicate key update,
使用 merge into 代替
-
不支持 ignore,即 insert ignore into
-
不支持 replace into,
使用 merge into 代替
-
不支持 if。
-
不支持 “”,只支持’’
-
不支持 auto_increment, 使用 identity 代替
如: identity(1, 1),从 1 开始,每次增 1
-
不支持 longtext 类型,
可用 CLOB 代替。
总结
达梦数据库和 oracle 数据库比较像,如果找不到和 MySQL 对应的函数,可以看下 oracle 的相关函数。
下一篇: 梦见花开花落