数据库操纵语言(DML)

2021/7/3 2:21:20

本文主要是介绍数据库操纵语言(DML),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

Insert 插入语句:

insert into 表名(字段名1,字段名2,字段名3,…)values(”字段值1”,”字段值2”,”字段值3”…)

例:insert into student(userID,name,sex,…)values(“001”,”张三”,”男”,…);

Insert …select语句:

insert into 表名(字段名1,字段名2,字段名3,…)select 语句

例:insert into student(userID,name) select ID,name from user where ID=”002”; # 将user表中的用户id和用户名插入到student表中。

Update语句:

Update 表名 set列名=”更新值” where 条件

例:update student set name=”Tom” where name =”Tiny”  # 将student表中Tom的姓名改为Tiny。

注:修改多个列的值时可以在字段中加英文逗号,

例:update student set name =”Tom”,sex=”男”;  # 不加where就是表示修改所有的姓名和性别。

Delete语句:

Delete from 表名 where 条件

例:delete from student where name=”Tom”; #从student表中删除名字为Tom的数据。 



这篇关于数据库操纵语言(DML)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程