重新了解数据库——DML

DML其实就是数据库操作语言,其实主要就是我们平时写的增删改语句。

添加

insert into 表名(字段1,字段2..)values('值1','值2');

修改

update 表 set 字段=值,字段=值.. where 字段=值;

--在某个范围内

update 表 set 字段=值,字段=值.. where 字段 between 值 and 值;

AND(&&)

update 表 set 字段=值,字段=值.. where 字段=值 and 字段=值;

OR(||)

update 表 set 字段=值,字段=值.. where 字段=值 or 字段=值;

删除

delete from 表名 where 字段=值;

删除表中的所有数据

delete from students;   --不会影响自增

truncate table students;   --自增会归零

InnoDB:自增会从1开始

MyISAM:继续从上一个自增量开始

发布了322 篇原创文章 · 获赞 61 · 访问量 7万+

猜你喜欢

转载自blog.csdn.net/wan_ide/article/details/105372609
今日推荐