MYSQL笔记

use usermanager;
select * from user;
alter table user character set gbk;
alter table user change column uname username varchar(20);
show create table user;

创建表:

CREATE TABLE user(
uid int(7) NOT NULL auto_increment unique,
uname varchar(20) character set utf8 default NULL,
GENDER smallint(1) default NULL ,
LEVEL smallint(6) NOT NULL,
PRIMARY KEY (uid)
);


插入数据:

insert into user value(1000,"superadmin",1,0);
insert into user(uname,GENDER,LEVEL) value("xiu",1,1);
查询数据:

select * from user limit 4,5;(实现分页效果)
select * from user order by chinese desc limit2,4;

设置查询结果控制台的显示字符集:

set character_set_results=utf8;

修改列属性:
alter table user add column password varchar(30) NOT NULL default "123";
alter table user modify uname nvarchar(20);

显示
show variables like ‘%char%‘;

where uid=? and password=?

分页:pageNow pageSize pageCount rowCount

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。