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:繼續從上一個自增量開始