-- 查询男生和女生各多少人
SELECT sex,COUNT(*) FROM t_student GROUP BY sex;



-- 查询男生和女生分别占总人数的比例
SELECT
	sex,
	COUNT(*),
	CONCAT(ROUND(COUNT(*) * 100.0 / (SELECT COUNT(*) FROM tb_student), 2), '%') AS percentage 
FROM
	t_student 
GROUP BY
	sex;
	

-- 查询每门课程下的学生总人数
SELECT
	c.c_name,
	COUNT(*) AS student_number
FROM
	stu_cou sc
	INNER JOIN t_course c ON sc.c_id = c.c_id 
GROUP BY
	c.c_name