当前位置:网站首页>Introduction and advanced level of MySQL (12)
Introduction and advanced level of MySQL (12)
2022-07-29 03:09:00 【Xiaoxinai programming】
Exist as a condition at the location of the query condition
adopt = lead ⼊ Of ⼦ Inquire about , Must return a single value . Only match ⼀⾏. The value is ⼀ individual , But it can be combined
If only ⼀⾏⼀ The return value of the column is only ⼀ individual , Then you can. = > < >= <= in not in also ⾏
Eg: Find the same as Tan Ming ⼀ Urban Science ⽣ Information
Eg2: Find all the students with the lowest score ⽣ Information
– Subquery : The query result exists as the comparison value of the search condition
– Inquire about the student information in the same city as Ma Yu
select city from studentinfo where studentname=‘ Ma Yu ’
select * from studentinfo where city=‘ Shangqiu ’
– = matching , You must ensure that the value returned by the sub query is only one row and one column
select * from studentinfo where city=(select city from studentinfo where
studentname=‘ Ma Yu ’)
– > < != in( There can be multiple line ranges ) not IN
– Query the student information with the lowest score
select min(exam) from exam
select * from exam where exam=45
select * from studentinfo where studentid=‘2011001011’
select * from studentinfo where studentid=(
select studentid from exam where exam=(
select min(exam) from exam ) )
IN 、ANY 、ALL Of ⽐ Comparison operator quotation ⼊ On the list of ⼦ Inquire about ( Multiple columns can be returned )
If the return value is multiple ⾏ Under the circumstances : Can't make ⽤=> < these , Sure ⽤in not in >anyall <all These keywords
-- Query the student information with the lowest score : If there is only one person with the lowest score , Then you can. =
-- If there are many people , Must use in
select min(exam) from exam
select * from exam where exam=45
select * from studentinfo where studentid in('2011001011','2011001003')
select * from studentinfo where studentid in(
select studentid from exam where exam=(
select min(exam) from exam
)
)
边栏推荐
- Apache文件管理自学笔记——映射文件夹和基于单ip多域名配置apache虚拟机
- 力扣刷题之分数加减运算(每日一题7/27)
- 瀚高数据库最佳实践配置工具HG_BP日志采集内容
- Mongodb index (3)
- MySQL installation and configuration super detailed tutorial and simple database and table building method
- Incremental real-time disaster recovery notes
- Detailed steps for installing MySQL 8.0 under Linux
- Restfulapi - C - add header username and password authentication
- 《QA离业务代码能有多近?》通过codediff直接暴露缺陷
- Li Shuo, vice president of Baidu: it's a good thing that China's labor costs rise with the support of digital technology
猜你喜欢

微信为之疯狂的Glide使用——之生命周期学习

力扣刷题之数组序号计算(每日一题7/28)

C语言基础知识点汇总

Tp5.0 applet users do not need to log in and directly obtain the user's mobile number.

13_ue4进阶_蒙太奇动画实现一边走一边攻击

Analysis of concepts and terms in data warehouse

盘点国内外项目协同管理软件:SaaS和定制化成趋势

Analyzing the subjective consciousness of emotional resonance between robots and human beings
![[freeswitch development practice] unimrcp compilation and installation](/img/ef/b82326152326293bf98e89da28b887.png)
[freeswitch development practice] unimrcp compilation and installation

算法---粉刷房子(Kotlin)
随机推荐
基于单片机烟雾温湿度甲醛监测设计
Incremental real-time disaster recovery notes
MySQL - the difference between count (field), count (primary key), count (1), count (*)
Shell programming specifications and variables
MYCAT read / write separation configuration
CentOS install mysql8
Jinshan cloud returns to Hong Kong for listing: Hong Kong stock rush of Chinese to B cloud manufacturers
《QA离业务代码能有多近?》通过codediff直接暴露缺陷
服务器运行管理制度
会议OA之反馈功能
MySQL large table joint query optimization, large transaction optimization, avoiding transaction timeout, lock wait timeout and lock table
C陷阱与缺陷 第3章 语义“陷阱” 3.3 作为参数的数组声明
VIM common commands
盘点国内外项目协同管理软件:SaaS和定制化成趋势
Navicat new database
简历竟然敢写精通并发编程,那你说说AQS为什么要用双向链表?
Object转String的几种方法
MySQL operation database data error: fatal error encoded during command execution
13_ue4进阶_蒙太奇动画实现一边走一边攻击
Redis configuration cache expiration listening event trigger