1 show tables; 2 desc book; 3 select * from book; 4 alter table book add sscore tinyint unsigned default 60; 5 insert into book values (null,'李四','98'),(null,'王','10'),(null,'王五','20'); 6 insert into book values (null,'李','98'),(null,'李二','10'),(null,'李三','20'); 7 /*修改表里面的列的数据*/ 8 update book set bookname='王老王' ,sscore=100 where bookname='王五'; 9 update book set bookname='java开发',sscore=1 where bookid=1; 10 /*删除所有的数据,id接着删除之前的往下排 11 没有条件则是删除所有 12 */ 13 delete from book where 1=1; 14 delete from book ; 15 /*删除所有的数据,id从1开始,删除时不记日志,不能触发 16 删除器,无条件删除所有的数据,素对快 17 */ 18 truncate book; 19 select * from book; 20 /*工具表,可以直接计算*/ 21 select 1+1,2*3,5545+23525 from dual; 22 /*修改数据信息*/ 23 update book set bookname='li',sscore='100' where bookid=2; 24 /*所有人的年龄加5分*/ 25 update book set sscore=sscore+5 where 1=1; 26 /*所有李开头的有2个字段的都加上10分*/ 27 update book set sscore=sscore+10 where bookname regexp '^李.+$'; 28 /*正则表达式删除修改数据 .表示一个任意符号,+表示(1,)最少一个,*/ 29 delete from book where bookname regexp '^王.+$'; 30 /*删除bookname 里面包含s的*/ 31 delete from book where bookname regexp 's'; 32 /* *号表示(0,)0个或者多个 李开头的*/ 33 delete from book where bookname regexp'^李.*'; 34 /*只要包含王或者赵的都删除*/ 35 delete from book where bookname regexp '赵|王';