首页 > 数据库技术 > 详细

数据库操纵语言(DML)

时间:2021-07-03 11:01:28      阅读:23      评论:0      收藏:0      [点我收藏+]

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)

原文:https://www.cnblogs.com/yhcTACK/p/14965423.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!