数据操纵语言DML主要有三种形式:
1) 插入:INSERT

-- 最简单的方法插入数据(values值需和表中字段一一对应)
insert into tanglinux values(1,'tangname','66907360',28);
-- 最规范的方法插入数据(id默认自增)
insert into tanglinux(name,qq,age) values('zhangsan','74171234',18);
-- 查看表数据

2) 更新和删除:UPDATE&DELETE

-- 最简单的方法插入数据(values值需和表中字段一一对应)
insert into tanglinux values(1,'tangname','66907360',28);
-- 最规范的方法插入数据(id默认自增)
insert into tanglinux(name,qq,age) values('zhangsan','74171234',18);
-- 查看表数据
select * from tanglinux;
-- 更新表数据
update tanglinux set qq='12345678' where id=2;
-- 删除表数据
delete from tanglinux where id=2;
-- 将一个超级大的表清空(物理删除属于DDL)
truncate table tanglinux;
-- 将一个表逐行删除(逻辑删除不会降低id自增长的值)
delete from tanglinux;
-- 给每列添加状态(伪删除)
alter table tanglinux add state tinyint not null default 0;
模拟伪删除:

 练习:

[root@instance-r5y0pf5d ~]# mysql -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 97
Server version: 5.7.26-log MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use testku
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from course;
+------+--------+------+
| cno | cname | tno |
+------+--------+------+
| 1001 | linux | 101 |
| 1002 | python | 102 |
| 1003 | mysql | 103 |
+------+--------+------+
3 rows in set (0.00 sec)

mysql> insert into course values(1004,'linux',103);
Query OK, 1 row affected (0.01 sec)

mysql> select * from course;
+------+--------+------+
| cno | cname | tno |
+------+--------+------+
| 1001 | linux | 101 |
| 1002 | python | 102 |
| 1003 | mysql | 103 |
| 1004 | linux | 103 |
+------+--------+------+
4 rows in set (0.00 sec)

mysql> delete from course where cno=1004;
Query OK, 1 row affected (0.03 sec)

mysql>