The difference between mysql scalar quantum query and non-method subquery
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!