DML:增删改表中的数据

 1 DESC stu;
 2 
 3 INSERT INTO stu(id,NAME,age) VALUES(1,'张无忌',18);
 4 
 5 SELECT *FROM stu;
 6 
 7 INSERT INTO stu VALUES(2,'赵敏',17,NULL,NULL,NULL);
 8 
 9 INSERT INTO stu VALUES(3,'张三丰',99,99,'1999-05-01',NULL);
10 
11 DELETE FROM stu WHERE id=1;
12 
13 DELETE FROM stu;
14 
15 TRUNCATE TABLE stu;  -- 删除表,然后再创建一个一模一样的空表
16 
17 UPDATE stu SET age=20;
18 
19 UPDATE stu SET age=117 WHERE id=3;
20 
21 UPDATE stu SET age=18,score=100 WHERE id=2;

 

上一篇:7 DML语言(增删改)


下一篇:数据库-Mysql基础(第2节)