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

显示表的字符集:show full columns from user;

你可能感兴趣的:(mysql)