達(dá)夢(mèng)數(shù)據(jù)庫(kù):第一章:MySQL數(shù)據(jù)庫(kù)與達(dá)夢(mèng)數(shù)據(jù)庫(kù)的區(qū)別
達(dá)夢(mèng)數(shù)據(jù)庫(kù)管理系統(tǒng)是達(dá)夢(mèng)公司推出的具有完全自主知識(shí)產(chǎn)權(quán)的高性能數(shù)據(jù)庫(kù)管理系統(tǒng),簡(jiǎn)稱DM,它具有如下特點(diǎn):
1、通用性
達(dá)夢(mèng)數(shù)據(jù)庫(kù)管理系統(tǒng)兼容多種硬件體系,可運(yùn)行于X86、X64、SPARC、POWER等硬件體系之上。DM各種平臺(tái)上的數(shù)據(jù)存儲(chǔ)結(jié)構(gòu)和消息通信結(jié)構(gòu)完全一致,使得DM各種組件在不同的硬件平臺(tái)上具有一致的使用特性。
達(dá)夢(mèng)數(shù)據(jù)庫(kù)管理系統(tǒng)產(chǎn)品實(shí)現(xiàn)了平臺(tái)無關(guān)性,支持Windows系列、各版本Linux(2.4及2.4以上內(nèi)核)、Unix、Kylin、AIX、Solaris等各種主流操作系統(tǒng)。達(dá)夢(mèng)數(shù)據(jù)庫(kù)的服務(wù)器、接口程序和管理工具均可在32位/64 位版本操作系統(tǒng)上使用。
2、高性能
支持列存儲(chǔ)、數(shù)據(jù)壓縮、物化視圖等面向聯(lián)機(jī)事務(wù)分析場(chǎng)景的優(yōu)化選項(xiàng);
通過表級(jí)行存儲(chǔ)、列存儲(chǔ)選項(xiàng)技術(shù),在同一產(chǎn)品中提供對(duì)聯(lián)機(jī)事務(wù)處理和聯(lián)機(jī)分析處理業(yè)務(wù)場(chǎng)景的支持;
3、高可用
可配置數(shù)據(jù)守護(hù)系統(tǒng)(主備),自動(dòng)快速故障恢復(fù),具有強(qiáng)大的容災(zāi)處理能力。
4、跨平臺(tái)
跨平臺(tái),支持主流軟硬件體系(支持windows、Linux、中標(biāo)麒麟、銀河麒麟等操作系統(tǒng)),支持主流標(biāo)準(zhǔn)接口。
5、高可擴(kuò)展
支持拓展軟件包和多種工具,實(shí)現(xiàn)海量數(shù)據(jù)分析處理、數(shù)據(jù)共享集群(DSC)和無共享數(shù)據(jù)庫(kù)集群(MPP)等擴(kuò)展功能
與MySQL的區(qū)別
1. 創(chuàng)建表的時(shí)候,不支持在列的后面直接加 comment 注釋,使用 COMMENT ON IS 代替,如:
COMMENT ON TABLE xxx IS xxx
COMMENT ON COLUMN xxx IS xxx
2. 不支持 date_sub 函數(shù),使用 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());
3. 不支持 date_format 函數(shù),它有三種代替方法:
a: 使用 datepart 代替:語法:datepart(datepart, date),返回代表日期的指定部分的整數(shù),
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 一樣,寫法不同,參數(shù)順序顛倒,且都要加引號(hào),
例子:
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對(duì)應(yīng)的值
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
4. 不支持 substring_index 函數(shù), 使用 substr / substring 代替,
語法:
substr(char[,m[,n]])
substring(char[from m[ for n]])
5. 不支持 group_concat 函數(shù),使用 wm_concat 代替,
例子:
select wm_concat(id) as idstr from persion ORDER BY id ;
6. 不支持 from_unixtime 函數(shù),使用 round 代替
語法:round(date[,format])
7. 不支持 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;
8. current_timestamp 的返回值帶有時(shí)區(qū),
例子:
select current_timestamp();
2018-12-17 14:34:18.433839 +08:00
9. convert(type, value) 函數(shù),
與 mysql 的 convert 一樣,但是參數(shù)是反過來的,mysql 是 convert(value, type)
10. 不支持 on duplicate key update,
使用 merge into 代替
11. 不支持 ignore,即 insert ignore into
12. 不支持 replace into,
使用 merge into 代替
13. 不支持 if。
14. 不支持 "",只支持''
15. 不支持 auto_increment, 使用 identity 代替
如: identity(1, 1),從 1 開始,每次增 1
16. 不支持 longtext 類型,
可用 CLOB 代替。