Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The difference between mysql scalar quantum query and non-method subquery

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains the difference between mysql scalar quantum query and non-method query. The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow Xiaobian's train of thought to study and learn the difference between mysql scalar quantum query and non-method query.

# after where or having:

# Cash disk programming Q

# scalar quantum query (single-line subquery)

# column subquery (multi-row subquery)

# Row subquery (multiple rows and multiple columns)

Features: subqueries are placed in parentheses, generally on the right side of the condition, and scalar quantum queries are generally equipped with single-line operators.

One-line operator: > =

Column subqueries: generally used with multi-line operators

Multiline operators: in, any, some, all

# scalar quantum query

# case: employee information whose salary is higher than that of ABEL

SELECT *

FROM employees

WHERE salary > (

SELECT salary

FROM employees

WHERE last_name='Abel'

);

# case: return the name, job_id and salary of the employee whose job_id is the same as employee 141and whose salary is more than employee 143s

SELECT

Last_name,job_id,salary

FROM employees

WHERE job_id= (

SELECT job_id

FROM employees

WHERE employee_id=141

)

AND salary > (

SELECT salary

FROM employees

WHERE employee_id=143

);

# case: returns the last_name, job_id and salary of the employee with the lowest salary

SELECT last_name,job_id,salary

FROM employees

WHERE salary= (

SELECT MIN (salary)

FROM employees

);

# case: query the id and its minimum wage of departments whose minimum wage is greater than Department 50

SELECT department_id,MIN (salary)

FROM employees

GROUP BY department_id

HAVING MIN (salary) > (

SELECT MIN (salary)

FROM employees

WHERE department_id=50

);

Thank you for your reading, the above is the content of "the difference between mysql standard quantum query and non-method sub-query". After the study of this article, I believe you have a deeper understanding of the difference between mysql standard quantum query and non-method sub-query, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report