修改表记录
1、修改表中id为2行的值
mysql> update test set name='jerry' where id=2;
2、修改test表为其增加一个age列,默认值为20
mysql> alter table test
-> add age int(3) not null default 20;
3、改表中两个值用or连接
mysql> update test set age=20 where id=5 or id=7;
4、在同一个条件下修改多个值,同时改name和age
mysql> update test
-> set name='tom',
-> age=23
-> where id=6;
5、修改多个表,同时修改两个表中的id为8的name
mysql> update test,demo1
-> set test.name='秦建兴',demo1.name='秦建兴'
-> where test.id=8 and test.id=demo1.id;
6、删除记录
mysql> delete from test where id=10; //回收
Truncate table 表名 //彻底删除,删除数据不可恢复
补充:replace删除了一个数据并送入表中一个数据 //安全性相对较低
mysql> replace into test(id,name,age) values(1,'王五',24);