应用管理与运维平台 ServiceStage应用管理与运维平台 ServiceStage

更新时间:2021/08/03 GMT+08:00
分享

SQL修饰

DTM中SELECT语句的隔离级别默认为读未提交。

该模式下DML语句支持的的SQL修饰用法请参见表1,SELECT语句支持的的SQL修饰用法请参见表2

表1 DML语句支持的SQL修饰用法

类型

SQL实例

AND & OR

UPDATE … WHERE col_name1=expr1 AND col_name2= expr2

LIKE

UPDATE ... WHERE col_name1 LIKE 'NE'

通配符

UPDATE ... WHERE col_name1 LIKE 'NE%'

BETWEEN

UPDATE ... WHERE col_name1 BETWEEN expr1 AND expr2

ON DUPLICATE

INSERT INTO tb1_name [(col_name,...)]VALUES ({expr | DEFAULT},...),(...),...[ ON DUPLICATE KEY UPDATE col_name=expr, ... ]

表2 SELECT语句对函数支持

类型

SQL 实例

MySQL

PostgreSQL

GaussDB(for MySQL)

GaussDB(openGauss)

AND & OR

SELECT * FROM tb1_name WHERE col_name1=expr1 AND col_name2= expr2

ORDER BY

SELECT col_name1, col_name2 FROM tb1_name ORDER BY col_name1

GROUP BY

SELECT col_name1, col_name2 FROM tb1_name GROUP BY col_name1

LIKE

SELECT col_name1, col_name2 FROM tb1_name WHERE col_name1 LIKE ‘NE’

通配符

SELECT col_name1, col_name2 FROM tb1_name WHERE col_name1 LIKE ‘NE%’

EXISTS

SELECT col_name1, col_name2 FROM tb1_name WHERE EXISTS (expr1)

IN

SELECT col_name1, col_name2 FROM tb1_name WHERE col_name1 IN (expr1, expr2,…)

BETWEEN

SELECT col_name1, col_name2 FROM tb1_name WHERE col_name1 BETWEEN expr1 AND expr2

ALIASES

SELECT t1. col_name1, t2.col_name2

FROM tb1_name AS t1, tb2_name AS t2

WHERE t1. col_name=expr AND t2. col_name=expr

TOP

SELECT TOP 2 * FROM tb1_name

LIMIT

SELECT col_name1, col_name2 FROM tb1_name LIMIT 5

JOIN

SELECT col_name1, col_name2 FROM tb1_name JOIN tb2_name>ON tb1_name. col_name1= tb2_name. col_name1

INNER JOIN

-

LEFT JOIN

-

RIGHT JOIN

-

FULL JOIN

-

UNION

-

UNION ALL

-

SELECT INTO

-

分享:

    相关文档

    相关产品