当前位置:网站首页>Daily sql-statistics of the number of professionals (including the number of professionals is 0)
Daily sql-statistics of the number of professionals (including the number of professionals is 0)
2022-08-11 07:15:00 【Eating too much sugar will not gain weight】
Daily sql-count the number of professionals (including 0 professionals)
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;
边栏推荐
猜你喜欢
随机推荐
华为防火墙-6
maxwell 概念
Eight-legged text jvm
Eight-legged text of mysql
皮质-皮质网络的多尺度交流
《猪猪1984》NFT 作品集将上线 The Sandbox 市场平台
Especially the redis
Coordinate system in navigation and positioning
Find the shops that have sold more than 1,000 yuan per day for more than 30 consecutive days in the past six months
The ramdisk practice 1: the root file system integrated into the kernel
一种用于EEG超扫描研究的分析流程
矩阵分析——Jordan标准形
LabelEncoder和LabelBinarizer的区别
iptables 使用脚本来管理规则
Conference OA Project My Conference
MySQL之CRUD
1688商品详情接口
Implement general-purpose, high-performance sorting and quicksort optimizations
每日sql-员工奖金过滤和回答率排序第一
Redis + lua implements distributed interface current limiting implementation scheme









