当前位置:网站首页>Introduction and advanced level of MySQL (11)
Introduction and advanced level of MySQL (11)
2022-07-29 03:09:00 【Xiaoxinai programming】
Query result set as ⼀ Virtual tables directly participate in the query
Eg: Query the learning of each class ⽣ Number , And sort in reverse order according to the number
Eg2: List the men in each class ⽣⼥⽣⽐ example
/* Subquery :
Query nesting
- Query results are used directly as virtual tables
- The query result is used as the value of the judgment condition
- The query result is used as the value of the assignment update set a= value ? You can also use subquery
Subquery :
The location of the queried table
Query condition location
delete Search condition location of
update The location of the search condition
update set The position of assignment can also
insert The position of writing value can also be used */
-- The query result is used as a table , Alias is required
17 -- Query the number of students in each class , Sort by flashback
18 select a.classname,count(b.studentid)
19 from class a
20 left join studentinfo b on a.classid=b.classid
21 group by a.classid,a.classname
22 order by count(b.studentid) desc
234 select * from(
25 select a.classname,count(b.studentid) as stucount
26 from class a
27 left join studentinfo b on a.classid=b.classid
28 group by a.classid,a.classname
29 )a
30 order by a.stucount desc
312 -- List the proportion of boys and girls in each class
33 select nvcount/nancount,a.classid from(
34 select count(*) as nvcount,gender,classid
35 from studentinfo
36 where gender=' Woman '
37 group by classid
38 )a
39 left join(
40 select count(*) as nancount,gender,classid
41 from studentinfo
42 where gender=' male '
43 group by classid
44 )b on a.classid=b.classid
边栏推荐
- MySQL operation database data error: fatal error encoded during command execution
- 《QA离业务代码能有多近?》QA对业务代码进行可测性改造
- Hangao database best practice configuration tool Hg_ BP log collection content
- Verilog: blocking assignment and non blocking assignment
- navicat新建数据库
- C陷阱与缺陷 第3章 语义“陷阱” 3.9 整数溢出
- MySQL忘记密码怎么办
- Li Shuo, vice president of Baidu: it's a good thing that China's labor costs rise with the support of digital technology
- mycat读写分离配置
- Tp5.0 applet users do not need to log in and directly obtain the user's mobile number.
猜你喜欢
![[robot learning] matlab kinematics and ADMAS dynamics analysis of manipulator gripper](/img/e1/a67048ea69bfe6064651d459311a88.png)
[robot learning] matlab kinematics and ADMAS dynamics analysis of manipulator gripper

【FreeSwitch开发实践】media bug获取通话语音流

数字图像处理 第10章——图像分割

Unity game special effects

HTB-Blocky

What is SOA (Service Oriented Architecture)?
![[freeswitch development practice] media bug obtains call voice flow](/img/14/9a359403606c312b30733d4a015fa5.png)
[freeswitch development practice] media bug obtains call voice flow

【C】数组

Apache文件管理自学笔记——映射文件夹和基于单ip多域名配置apache虚拟机

力扣刷题之数组序号计算(每日一题7/28)
随机推荐
C traps and defects Chapter 3 semantic "traps" 3.4 avoid "couple method"
【机器人学习】机械臂抓手matlab运动学与admas动力学分析
《QA离业务代码能有多近?》QA对业务代码进行可测性改造
Wechat's crazy use of glide - life cycle learning
Inventory of domestic and foreign project collaborative management software: SAAS and customization become a trend
C陷阱与缺陷 第3章 语义“陷阱” 3.7 求值顺序
服务器运行管理制度
Codeworks 5 questions per day (average 1500) - day 25
Redis配置缓存过期监听事件触发
cuda-gdb提示:/tmp/tmpxft_***.cudafe1.stub.c: No such file or directory.
Unity 之游戏特效
What if MySQL forgets the password
微信为之疯狂的Glide使用——之生命周期学习
The basic concept of the origin and connotation of maker Education
Verilog:阻塞赋值和非阻塞赋值
力扣刷题之分数加减运算(每日一题7/27)
C和指针 第3章 语义“陷阱” 3.5 空指针并非字符串
VASP calculation task error: M_ divide:can not subdivide 8 nodes by 6
MySQL - the difference between count (field), count (primary key), count (1), count (*)
MySQL operation database data error: fatal error encoded during command execution