当前位置:Gxlcms > 数据库问题 > mysql查询语句

mysql查询语句

时间:2021-07-01 10:21:17 帮助过:12人阅读

-- 查询姓"杨"名字两个字的学生姓名和性别(模糊)
select stuname, stusex from tb_student where stuname like ‘杨_‘;

-- 查询姓"杨"名字三个字的学生姓名和性别(模糊)
select stuname, stusex from tb_student where stuname like ‘杨__‘;

-- 查询没有录入家庭住址的学生姓名(空值)
select stuname from tb_student where stuaddr is null;

-- 查询课程编号为1111的课程的平均成绩(筛选和聚合函数)
select avg(score) from tb_record where cid=1111;

-- 查询每个学生的学号和平均成绩(分组和聚合函数)
select sid as 学号, avg(score) as 平均分 from tb_record group by sid;
 
 

mysql查询语句

标签:bsp   ase   模糊   uname   姓名   group   select   条件   end   

人气教程排行