跳至内容

SQL 方言参考/事务

来自维基教科书,开放的书籍,开放的世界

此页面包含比较表,它们可能很大且复杂

虽然完全可以以完整状态查看它们,但建议安装一个比较表扩展,它可以允许选择特定列进行比较。

SQL 版本 功能 标准
SQL:2011
DB2 Firebird Ingres Linter MSSQL MySQL
Vers. 5.x
MonetDB Oracle
Vers. 11.x
PostgreSQL SQLite Virtuoso
? 开始 START TRANSACTION
[事务特性]
隐式 SET TRANSACTION ? ? BEGIN TRAN[SACTION] BEGIN [WORK]
START [TRANSACTION]
START TRANSACTION
BEGIN TRANSACTION
隐式 BEGIN [WORK|TRANSACTION]
START TRANSACTION
BEGIN [TRANSACTION] 隐式
? 提交 COMMIT [WORK] COMMIT [WORK] COMMIT [WORK] [EXEC SQL] COMMIT [WORK] ? COMMIT [WORK]
COMMIT TRAN[SACTION] [transaction_name]
COMMIT [WORK] COMMIT [WORK] [AND [NO] CHAIN] COMMIT [WORK] COMMIT [WORK|TRANSACTION] COMMIT [TRANSACTION]
END [TRANSACTION]
COMMIT WORK
? 回滚整个事务 ROLLBACK [WORK] ROLLBACK [WORK] ROLLBACK [WORK] [EXEC SQL] ROLLBACK [WORK] ? ROLLBACK [WORK]
ROLLBACK TRAN[SACTION]
ROLLBACK [WORK] ROLLBACK [WORK] [AND [NO] CHAIN] ROLLBACK [WORK] ROLLBACK [WORK|TRANSACTION] ROLLBACK [TRANSACTION] ROLLBACK WORK
? 在事务中定义一个保存点x SAVEPOINT x SAVEPOINT x ON ROLLBACK RETAIN CURSORS SAVEPOINT x SAVEPOINT x ? SAVE TRAN[SACTION] x SAVEPOINT x SAVEPOINT x SAVEPOINT x SAVEPOINT x SAVEPOINT x N/A
? 回滚到给定的保存点x ROLLBACK [WORK] TO SAVEPOINT x ROLLBACK [WORK] TO SAVEPOINT x ROLLBACK [WORK] TO [SAVEPOINT] x [EXEC SQL] ROLLBACK [WORK] TO x ? ROLLBACK TRAN[SACTION] x ROLLBACK [WORK] TO [SAVEPOINT] x ROLLBACK [WORK] [AND [NO] CHAIN] TO SAVEPOINT x ROLLBACK [WORK] TO [SAVEPOINT] x ROLLBACK [WORK|TRANSACTION] TO [SAVEPOINT] x ROLLBACK [TRANSACTION] TO [SAVEPOINT] x N/A
? 释放(忘记)保存点x RELEASE SAVEPOINT x RELEASE [TO] SAVEPOINT x RELEASE SAVEPOINT x N/A ? N/A RELEASE SAVEPOINT x RELEASE SAVEPOINT x N/A RELEASE [SAVEPOINT] x RELEASE [SAVEPOINT] x N/A
? 为两阶段提交准备名为id的事务 ? ? N/A ? ? ? ? N/A ? PREPARE TRANSACTION id N/A ?
? 提交名为id的已准备事务 ? ? N/A ? ? ? ? N/A ? COMMIT PREPARED id N/A ?
? 回滚名为id的已准备事务 ? ? N/A ? ? ? ? N/A ? ROLLBACK PREPARED id N/A ?
开始 提交 回滚 准备 执行已准备好的
Linter 隐式
  • 执行一个COMMIT语句
  • 执行任何 DDL 语句
  • 在 AUTOCOMMIT 模式下执行任何语句
  • 执行一个ROLLBACK语句
  • 用户进程异常终止或在没有COMMIT/ROLLBACK的情况下断开连接
? ?
华夏公益教科书