mysql基本查询:
查询所有: select * from 表名;
创建数据表:(举例)
create table students(
id int unsigned primary key auto_increment not null,
name varchar(20) default '',
age tinyint unsigned default 0,
height decimal(5,2), -- 最大5位数字,其中两位小数
gender enum('男','女','人妖','保密'),
cls_id int unsigned default 0,
isdelete bit default 0
);
准备数据:(往表格插入数据)
insert into students values
(0,'韦少',18,180.00,2,1,0),
(0,'小月月',18,180.00,2,2,1),
(0,'彭于晏',29,185.00,1,1,0),
(0,'刘德华',59,175.00,1,2,1),
查询表格中所有人的名字: select name from students;
distinct:去重 在需查询前加上distinct

查询id>3的:select * from students where id > 3;
模糊查询like
%表示任意多个任意字符
表示一个任意字符
select * from students where name like '周%'
select * from students where name like '周'
范围查询 in :
in表示在一个非连续的集合内:

between ... and ...表示在一个连续的范围内

排序的基本使用:
asc从小到大排列,即升序
desc从大到小排序,即降序
