全部产品
存储与CDN 数据库 安全 应用服务 数加·人工智能 数加·大数据基础服务 互联网中间件 视频服务 开发者工具 解决方案 物联网

SQL 修饰

更新时间:2017-11-03 11:55:36

GTS 的隔离级别默认为读未提交,该模式中下表 select 语句的 SQL 修饰用法都是支持的;使用 hint 可以让 GTS 达到读已提交,该模式下 select 语句的用法只能部分支持,具体的支持强度如下表所示。

GTS 的读 hint 为:/+txc({ ‘LEVEL’:’READCOMMITED’})/,用法举例如下:/+txc({ ‘LEVEL’:’READCOMMITED’})/select name from tb where id =1;

DML语句支持

类型 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, … ]

Select 语句支持

类型 SQL 实例 读未提交 读已提交
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
ON DUPLICATE INSERT INTO tb1_name
[(col_name,…)]
VALUES ({expr |
DEFAULT},…),(…),…
[ ON DUPLICATE KEY UPDATE
col_name=expr, … ]
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
  • INNER JOIN
  • LEFT JOIN
  • RIGHT JOIN
  • FULL JOIN
SELECT col_name1, col_name2
FROM tb1_name
JOIN tb2_name>
ON tb1_name. col_name1= tb2_name. col_name1
  • UNION
  • UNION ALL
  • SELECT INTO
SELECT col_name1, col_name2 FROM tb1_name
UNION
SELECT col_name1, col_name2 FROM tb2_name
本文导读目录