In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This "mysql how to query and merge" article, the article sample code introduction is very detailed, with a certain reference value, interested friends must refer to, for the "mysql how to query after the merge", the editor sorted out the following knowledge points, please follow the pace of the editor step by step slowly understand, then let us enter the topic.
In mysql, you can use the UNION operator to achieve the effect of merging results after a query. The function of this operator is to join the results of more than two SELECT statements into a result set. The syntax is "SELECT query statement 1 UNION [ALL] SELECT query statement 2".
The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.
How to query and merge with mysql
The MySQL UNION operator is used to join the results of more than two SELECT statements into a result set. Multiple SELECT statements delete duplicate data.
Grammar
MySQL UNION operator syntax format:
SELECT expression1, expression2,... Expression_nFROM tables [WHERE conditions] UNION [ALL | DISTINCT] SELECT expression1, expression2,... Expression_nFROM tables [WHERE conditions]
Parameters.
Expression1, expression2,... Expression_n: the column to retrieve.
Tables: the data table to retrieve.
WHERE conditions: optional, search condition.
DISTINCT: optionally, delete duplicate data in the result set. By default, the UNION operator has removed duplicate data, so the DISTINCT modifier has little effect on the result.
ALL: optional, returns all result sets, including duplicate data.
Examples are as follows:
Query the information of all fruits whose prices are less than 9, query the information of all fruits whose s_id is equal to 101,103, and use UNION to connect the query results. The SQL statement is as follows:
The above is all the contents of the article "how to query and merge mysql". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.