当前位置:网站首页>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
)
)
边栏推荐
- Analysis of Project-based Learning Creativity in steam Education
- 2022-07-28 顾宇佳 学习笔记
- Typescript学习(一)
- C traps and defects Chapter 3 semantic "traps" 3.9 integer overflow
- C陷阱与缺陷 第3章 语义“陷阱” 3.7 求值顺序
- Tp5.0 applet users do not need to log in and directly obtain the user's mobile number.
- IDEA安装后无法启动
- MYSQL入门与进阶(十四)
- C语言小项目 -- 通讯录(静态版+动态版+文件版)
- Unity game special effects
猜你喜欢
【FreeSwitch开发实践】UniMRCP编译与安装
[freeswitch development practice] unimrcp compilation and installation
Shell编程规范与变量
2022-07-28 顾宇佳 学习笔记
Li Shuo, vice president of Baidu: it's a good thing that China's labor costs rise with the support of digital technology
融云实时社区解决方案
【FreeSwitch开发实践】media bug获取通话语音流
3D高级渲染器:Artlantis studio 2021.2中文版
Look at robot education and lead the mainstream of quality education
Unity game special effects
随机推荐
MySQL operation database data error: fatal error encoded during command execution
第09章_性能分析工具的使用
What if MySQL forgets the password
Verilog:阻塞赋值和非阻塞赋值
Li Shuo, vice president of Baidu: it's a good thing that China's labor costs rise with the support of digital technology
[QNX Hypervisor 2.2用户手册]9.11 ram(更新中)
C traps and defects Chapter 3 semantic "traps" 3.4 avoid "couple method"
美联储再加息,75基点 鲍威尔“放鸽”,美股狂欢
Multi table (Association) query of SQL query data
01-SDRAM:初始化模块的代码
Shell script summary
Interpreting AI robots' pet raising and leading fashion trends
C陷阱与缺陷 第3章 语义“陷阱” 3.6 边界计算与不对称边界
MySQL - the difference between count (field), count (primary key), count (1), count (*)
Summary of common hooks
Navicat new database
MYSQL入门与进阶(十一)
盘点国内外项目协同管理软件:SaaS和定制化成趋势
Watermelon book learning Chapter 6 -- SVM
MySql的安装配置超详细教程与简单的建库建表方法