查询指定列 select sno,sname,ssex from student;
查询所有列 select * from student;
使用计算 select sno,cno,grade*0.6 from sc;
使用列别名 select sno,cno,grade*0.6 as 期末成绩 from sc;
去掉重复 select distinct sno from sc;
排序 select * from student order by sage ;
select * from student order by sage desc; 二、 条件查询
比较运算符 > < = >= <= <> select * from student where ssex <> ‘男’;select * from student where sage >= 20; 2. 逻辑运算符 and or not select * from student where sage >= 20 and ssex = ‘男’;
select * from student where sage >= 20 or ssex = ‘男’; 3. 区间运算符 select sno,cno,grade from sc where grade between 60 and 90;
select sno,cno,grade from sc where grade not between 60 and 90; 4. 模糊查询 like 通配符: % _ select * from student where sname like ‘张%’;
select * from student where sname like ‘张_’;
select * from student where sname like ‘张__’;
select * from course where cname like ‘%数据%’;