当前位置:网站首页>每日sql-统计各个专业人数(包括专业人数为0的)
每日sql-统计各个专业人数(包括专业人数为0的)
2022-08-11 05:36:00 【吃再多糖也不长胖】
每日sql-统计各个专业人数(包括专业人数为0的)
DDL
CREATE TABLE IF NOT EXISTS student (student_id INT,student_name VARCHAR(45), gender VARCHAR(6), dept_id INT);CREATE TABLE IF NOT EXISTS department (dept_id INT, dept_name VARCHAR(255));insert into student (student_id, student_name, gender, dept_id) values (1, 'Jack', 'M', 1);insert into student (student_id, student_name, gender, dept_id) values (2, 'Jane', 'F', 1);insert into student (student_id, student_name, gender, dept_id) values (3, 'Mark', 'M', 2);insert into department (dept_id, dept_name) values (1, 'Engineering');insert into department (dept_id, dept_name) values (2, 'Science');insert into department (dept_id, dept_name) values (3, 'Law');
sql
select t2.dept_name,count(t1.student_id) as student_number from student t1 right join department t2 on t1.dept_id = t2.dept_id group by t2.dept_name;
边栏推荐
- arcmap下的多进程脚本
- vi display line number in buildroot embedded file system
- OA Project Pending Meeting & History Meeting & All Meetings
- Raspberry Pi set static IP address
- HCIP MGRE\OSPF Comprehensive Experiment
- grep、sed、awk
- 华为防火墙-1-安全区域
- 自定义MVC增删改查
- My approval of OA project (inquiry & meeting signature)
- xx is not recognized as internal or external command
猜你喜欢
随机推荐
亚马逊API接口大全
淘宝sku API 接口(PHP示例)
从mask-rcnn到shp
导航定位中的坐标系
mmdetection的安装和训练、测试didi数据集的步骤(含结果)
My approval of OA project (inquiry & meeting signature)
使用Keras构建GAN,以Mnist为例
抖音API接口
FusionCompute8.0.0实验(1)CNA及VRM安装
HCIP--交换基础
矩阵分析——Jordan标准形
推荐一个好用的IDEA插件---Translation—中英互译
Local yum source build
xx is not recognized as internal or external command
Eight-legged text jvm
FusionCompute8.0.0 实验(2)虚拟机创建
iptables 流量统计
HCIP实验(pap、chap、HDLC、MGRE、RIP)
MySQL之函数
arcgis填坑_1