, >=, <, <= , <>] are used in combination to mean equal to, greater than, greater than or equal to, less than, less than or equal to, and not equal to."> What is the usage of all in mysql-Mysql Tutorial-php.cn

What is the usage of all in mysql

coldplay.xixi
Release: 2020-10-23 16:14:51
Original
6726 people have browsed it

Usage of all in mysql: 1. all means "for all values in the column returned by the subquery, if the comparison result is true, then return true"; 2. all can be used with [=, >, >=, <, <=, <>] are used in combination to mean equal to, greater than, greater than or equal to, less than, less than or equal to, and not equal to, respectively.

What is the usage of all in mysql

Usage of all in mysql:

I have been practicing multi-table queries of MYSQL recently, basically every I always write a query statement at least twice: once for join connection and once for subquery. Let’s compare the working methods and efficiency of MYSQL under different query methods. There are keywords such as any, all, and some in the subquery.

The any,all keywords must be used together with a comparison operator. The any keyword can be understood as "for any value in the column returned by the subquery, if the comparison result is true, then return true". all means "for all values in the column returned by the subquery, if the comparison result is true, then return true"

any can be used with =, >, >=, <, <= , <> are used in combination to represent data equal to, greater than, greater than or equal to, less than, less than or equal to, or not equal to any one of them.

all can be used in combination with =, >, >=, <, <=, <> to mean equal to, greater than, greater than or equal to, less than, less than or equal to, and not equal to, respectively. all the data in it.

For example:

select s1 from t1 where s1 > any (select s1 from t2);

Assume that s1 after any returns three values, then In fact, it is equivalent to

select s1 from t1 where s1 > result1 or s1 > result2 or s2 > result3

And the usage of all is equivalent to buffering the 'or' of the above statement 'and'

Speaking of this, you may already know that any and or are often used to compare two tables. When you don't know the specific value behind where, you can use any and all to help you determine.

More related free learning recommendations:mysql tutorial(Video)

The above is the detailed content of What is the usage of all in mysql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!