abstract:show databases; use php_edu; set names utf8; show tabels; desc test; create table test ( id int primary key not null a
show databases; use php_edu; set names utf8; show tabels; desc test; create table test ( id int primary key not null auto_increment COMMENT '用户主键' , name varchar(30) COMMENT '用户名称' , email varchar(40) COMMENT '用户邮箱', pass varchar(40) COMMENT '用户密码', age int(3) COMMENT '用户年龄', sex int(1) COMMENT '用户性别', status int(1) COMMENT '用户状态' , create_time int(20) , UNIQUE KEY `name` (`name`) )ENGINE = InnoDB DEFAULT CHARSET=utf8; insert into `test` values (null,'张三分','zsf@qq.com',sha('123456'),88,0,0,1550405626); insert into `test` values (null,'张三分111','zsf@qq.com',sha('123456'),88,0,0,1550405626); insert into `test` values (null,'梅超风','zsf@qq.com',sha('123456'),88,1,0,1550405626); insert into `test` values (null,'梅超风1111','zsf@qq.com',sha('123456'),88,1,0,1550405626); select * from `test`; select count(*) as res from `test`; select name,sex from `test` where `sex` = '1'; select concat(name,sex) as list from `test` where `sex` = 0 limit 1; select concat_ws('---',name,sex) as list from `test` where `sex` = 0 ; update `test` SET `name` = '欧阳克' WHERE `sex`=0; update `test` SET `name` = '天山童姥' WHERE `sex`=1 limit 1; delete from `test` where `id` = 2 ; delete from `test` where `name` = '天山童姥' limit 1; insert into `test` values (null,'朱元璋111','zsf@qq.com',sha('123456'),88,0,0,1550405626), (null,'陈友谅456','zsf@qq.com',sha('123456'),88,0,0,1550405626); alter table `test` drop `id`; alter table `test` add `id` mediumint(5) primary key not null auto_increment first; select * from `test` where `id` >=0;
Correcting teacher:查无此人Correction time:2019-02-18 09:29:50
Teacher's summary:update `test` SET `name` = '欧阳克' WHERE `sex`=0; 修改条件,最好能准确些。。 性别等于0,修改的数据会很多。
delete from `test` where `name` = '天山童姥' limit 1; 删除的条件,也最好准确些,如果有两个天山童姥,你根本不知道删除的是哪个。
继续加油。