亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

數(shù)據(jù)庫常用語句

Original 2019-02-17 21:04:19 273
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 '用戶狀態(tài)' ,
  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,'梅超風(fēng)','zsf@qq.com',sha('123456'),88,1,0,1550405626);
insert  into `test` values (null,'梅超風(fēng)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; 修改條件,最好能準(zhǔn)確些。。 性別等于0,修改的數(shù)據(jù)會很多。 delete from `test` where `name` = '天山童姥' limit 1; 刪除的條件,也最好準(zhǔn)確些,如果有兩個天山童姥,你根本不知道刪除的是哪個。 繼續(xù)加油。

Release Notes

Popular Entries