当前位置:网站首页>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
边栏推荐
- 「PHP基础知识」输出圆周率的近似值
- Chapter 09_ Use of performance analysis tools
- [open the door to the new world] see how the old bird of testing plays API testing between applause
- Feedback function of conference OA
- Unity 之游戏特效
- C陷阱与缺陷 第2章 语法“陷阱” 2.6 “悬挂”else引发的问题
- 扫雷简单版
- MYSQL入门与进阶(十一)
- C陷阱与缺陷 第3章 语义“陷阱” 3.9 整数溢出
- cuda-gdb提示:/tmp/tmpxft_***.cudafe1.stub.c: No such file or directory.
猜你喜欢
IDEA安装后无法启动
Shell programming specifications and variables
MySQL compound query (important)
[robot learning] matlab kinematics and ADMAS dynamics analysis of manipulator gripper
万字详解 Google Play 上架应用标准包格式 AAB
第09章_性能分析工具的使用
MySql的安装配置超详细教程与简单的建库建表方法
C语言程序设计 | 交换二进制数奇偶位(宏实现)
Wechat's crazy use of glide - life cycle learning
VASP calculation task error: M_ divide:can not subdivide 8 nodes by 6
随机推荐
Unity 之游戏特效
Jinshan cloud returns to Hong Kong for listing: Hong Kong stock rush of Chinese to B cloud manufacturers
R language error: compilation failed for package '****‘
融云实时社区解决方案
【FreeSwitch开发实践】UniMRCP编译与安装
Incremental real-time disaster recovery notes
Detailed steps for installing MySQL 8.0 under Linux
STC单片机驱动1.8‘TFT SPI屏幕演示示例(含资料包)
Inventory of domestic and foreign project collaborative management software: SAAS and customization become a trend
C陷阱与缺陷 第3章 语义“陷阱” 3.1 指针与数组
MySQL 操作数据库数据报错:Fatal error encountered during command execution
[QNX hypervisor 2.2 user manual]9.11 RAM (under update)
Multi table (Association) query of SQL query data
vasp计算任务报错:M_divide:can not subdivide 8 nodes by 6
Analyzing the subjective consciousness of emotional resonance between robots and human beings
Flask的创建的流程day05-06之创建项目
Interpreting AI robots' pet raising and leading fashion trends
Mongodb index (3)
MYSQL入门与进阶(十四)
2. Nodejs -- path (\dirname, \filname), URL URL, querystring module, mime module, various paths (relative paths), web page loading (interview questions *)