单表查询语句
查看所有:select * from teacher
查看特殊的行:select * from teacher where tid=2
查看特殊字段:select tname from teacher
分页查询
select * from score limit 0,5; // limit 起点 个数 --表示查询时显示从第几行(从0开始计数)开始,共显示个数行
Select * from score limit 10,5; // limit 起点 个数 --表示查询时显示从第几行(从10开始计数)开始,共显示个数行
模糊查询
Select * from `student` where sname like '%三';
Select * from `student` where sname like '刘%';
Select * from `student` where sname like '%';
对score表进行升序排序(默认升序):SELECT * FROM `score` ORDER BY score;
对score表进行升序排序:SELECT * FROM `score` ORDER BY score ASC;
对score表进行降序排序:SELECT * FROM `score` ORDER BY score DESC;
查询score表前五名数据:SELECT * FROM `score` ORDER BY score DESC LIMIT 0,5; // limit 起点 个数 --表示查询时显示从第几行(从0开始计数)开始,共显示个数行