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
difficulty Two mask creation of svg graphics Firs...
Environmental Description: There is a running MyS...
This article example shares the specific code of ...
This article example shares the specific code of ...
Table of contents Vue3 + TypeScript Learning 1. E...
1. Set up HOST on the host Macbook The previous d...
Because colleagues in the company need Nginx log ...
Preface: In MySQL, views are probably one of the ...
First, the HTML code to embed the video in the pag...
Let's take a look at the dynamic splicing of ...
This article example shares the specific code for...
One of the most commonly used and discussed data ...
This article example shares the specific code for...
This article describes how to install and configu...
In this chapter, we will start to operate redis i...