Home >Database >Mysql Tutorial >What is the difference between mysql full join and oracle full join query

What is the difference between mysql full join and oracle full join query

WBOY
WBOYforward
2023-06-03 22:49:021145browse

The difference between mysql full join query and oracle full join query

Oracle’s full join query can directly use full on, but there is no full join in mysql. Mysql uses union to implement full join

oracle's full connection

select * from a full join b on a.id = b.id

mysql's full connection

select * from a left join b on a.id = b.id
union
select * from a right join b on a.id = b.id
  • Note: mysql uses left connection and right connection to query separately Extract the data on the left and right sides

  • Then use union to merge (remove duplicate data on both sides)

Full connection means querying both The union of the query results of two tables

What is the difference between mysql full join and oracle full join query

Inner join or equivalent join is to query the intersection of two tables

What is the difference between mysql full join and oracle full join query

  • Left (outer) connection

What is the difference between mysql full join and oracle full join query

  • ##Right (outer) connection

What is the difference between mysql full join and oracle full join query

Full connection problem in oracle

Data in the database:

What is the difference between mysql full join and oracle full join query

Full join:

Full outer join returns all rows in the left and right tables.

When a row has no matching row in another table, the select list column of the other table contains null values.

If there are matching rows between tables, the entire result set row contains the data values ​​of the base table.

select * from book as a full outer join stu as b on a.sutid = b.stuid

Result:

What is the difference between mysql full join and oracle full join query

The above is the detailed content of What is the difference between mysql full join and oracle full join query. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete