In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Subquery subquery with IN keyword
The comparison operator applies only if the result column returned by the subquery contains a value. If the result set returned by a subquery is a list of values, the comparison operator must be replaced by the IN operator.
The IN operator can detect whether a specific value exists in the result set and execute an external query if the test is successful.
Example 1:
View the score information corresponding to the qualified contents of the score field in the info table
SELECT * from info where score in (SELECT score FROM infos)
Query results:
Example 2:
View the same celebrity information in infos table and info table
SELECT * from info where name in (SELECT name FROM infos)
Query results:
Subquery with comparison operator
Subqueries can use comparison operators. These comparison operators include =,! =, >, > =, ANY (SELECT age from infos)
Query results:
Subquery with ALL keyword
The ALL keyword indicates that all conditions are met. When using the ALL keyword, the outer query statement can be executed only if all the results returned by the inner query statement are satisfied.
Example:
SELECT * from info where age < all (SELECT age from infos)
Query results:
Merge query
To merge query results is to merge the query results of multiple SELECT statements together. Merge query results using the UNION and UNION ALL keywords.
Example 1:
SELECT score from info UNION SELECT score from infos
Query results:
Example 2:
SELECT score from info UNION SELECT name from infos
Query results:
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.