数据的高级操作
更新数据
- 基本语法:
update + 表名 + set + 字段 = 值 + [where 条件];
- 高级语法:
update + 表名 + set + 字段 = 值 + [where 条件] + [limit 更新数量];
执行如下 SQL 语句,进行测试:
-- 将表 my_copy 中的部分 a 更新为 c
update my_copy set name = 'c' where name = 'a' limit 3;
执行上述 SQL 语句前:
执行上述 SQL 语句后:
删除数据
与更新类似,可以通过limit
来限制删除的数量。
- 基本语法:
delete + from &#