What is the multi-table joint query statement in mysql

The multi-table joint query statement in mysql is: [select statement 1 union [union option] select statement 2 union [union option] select statement n]. The result of multi-table joint query is to combine the query results of multiple select statements. 【Related learning recommendation: mysql tutorial(video)】 Mysql multi-table joint query statement is: The joint query result is to combine the query results of multiple select statements together. You can use the union and union all keywords to merge. Basic syntax: select statement 1 union [union option] select statement 2 union [union option] select statement n The union option has two options: all (repeat and output); distinct (deduplication , completely repeated, will be deduplicated by default) The fields of the two tables should be the same. Example: select id,addrid from addr union all select id,addrid from student The meaning of joint query 1. Query the same table, but the requirements are different 2. Multi-table query: The structure of multiple tables is exactly the same, and the saved data (structure) is also the same Use of joint query order by In joint query: order by can only use one last, Parentheses are required for query statements. Example: —(mistake) select * from student where sex=”man”…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索