这是我第一次尝试进行交易,并且我希望进行交易以从类表中删除所有德国船只,并同时在表格中添加新的美国船只。
START TRANSACTION
-- Delete Germany from classes table
DELETE FROM classes WHERE country = 'Germany';
-- Add new ship for USA into classes table
INSERT INTO `classes` (`class`,`type`,`country`,`numGuns`,`bore`,`displacement`)
VALUES ('SS Farkas','bb','USA','10','20','36000');
-- Commit the transaction
commit;
我尝试在DELETE FROM语句的开头执行时遇到此语法错误:
语法错误:'删除' (删除)在此位置无效输入
答案 0 :(得分:0)
您遗失;
:
START TRANSACTION;
-- Delete Germany from classes table
DELETE FROM classes WHERE country = 'Germany';
-- Add new ship for USA into classes table
INSERT INTO `classes` (`class`,`type`,`country`,`numGuns`,`bore`,`displacement`)
VALUES ('SS Farkas','bb','USA','10','20','36000');
-- Commit the transaction
commit;
答案 1 :(得分:0)
删除查询有效,但您遗失了;
。
START TRANSACTION
应为START TRANSACTION;