1. What is a subquery?When one query is part of another query, we call the inner query a subquery and the outer query the main query. 2. Where can subqueries appear?select ..(select). from ..(select). where ..(select). As can be seen from the above, subqueries often appear in three places: select can be followed by a subquery; from can be followed by a subquery; where can be followed by a subquery; we refer to them here as: 3. Where subqueryExercise: Find information about employees who earn above the average salary. 4. Use a subquery after from. (Too important)Exercise 1: Find the salary grade for the average salary in each department. The results are as follows: Exercise 2: Find the average salary level for each employee The results are as follows: Note: There are few scenarios where subqueries are used after select, so they will not be described here. If you feel it is necessary, you can go and check it out yourself. The above is the detailed content of the MySQL tutorial subquery example. For more information about MySQL subqueries, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: Simple tips to increase web page loading speed
>>: HTML simple shopping quantity applet
Table of contents 1. Hash table principle 2. The ...
I just saw a post titled "Flow Theory and Des...
The <a> tag is mainly used to define links ...
This article shares the specific code of JavaScri...
Table of contents 1. Shared and Exclusive Locks 2...
Negative distance refers to empathy. Preface (rai...
As shown below: XML/HTML CodeCopy content to clip...
Create a new server.js yarn init -y yarn add expr...
Encryption and decryption are an important means ...
1 Requirements Overview The data of multiple tabl...
Recently, I encountered a requirement to display ...
If you use docker for large-scale development but...
Table of contents Tutorial Series 1. Backup strat...
I reinstalled VMware and Ubuntu, but the command ...
The warning points in this article have nothing t...