MySQL-multi-table query-summary 1

Table of contents

inner join

outer join

subqueries (nested queries)


inner join

  • The inner join query is the intersection part between tables
  • implicit inner join
    • select field list from table 1, table 2 where condition....;
  • Show Inner Links
    • select field list from table 1 [ inner ] join table 2 on condition....;

outer join

  • Left outer join (general use)
    • select field list from table 1 left join table 2 on condition...;
  • right outer join
    • select field list from table 1 right join table 2 on condition...;

subqueries (nested queries)

  • scalar subqueries
    • The result returned by the subquery is a single value
  • column query
    • The result returned by the subquery is one column but can be multiple rows
  • row subquery
    • The result returned by the subquery is one row but can be multiple columns
  • table subquery
    • The result returned by the subquery is multiple rows and multiple columns (usually as a temporary table)
  • ps: Since the use of subqueries will query the data in the table multiple times, the query efficiency is not high, try to use join queries instead of subqueries

Guess you like

Origin blog.csdn.net/weixin_64939936/article/details/131874115