Home > Database > Mysql Tutorial > body text

What is the difference between join and where in mysql

WBOY
Release: 2023-05-30 15:04:06
forward
1324 people have browsed it

1. Join connects data that meets the on condition to a new table.

2. where first connects the two tables to a new table through the Cartesian product, then determines the conditions and forms the data that meets the conditions into a table.

Example

select m.menu_id,m.sort_id,s.sort_id,s.sort_name from menu m join sort s on m.sort_id=s.sort_id and m.sort_id=2;
select m.menu_id,m.sort_id,s.sort_id,s.sort_name from menu m join sort s on m.sort_id=s.sort_id where m.sort_id=2;
select m.menu_id,m.sort_id,s.sort_id,s.sort_name from menu m inner join sort s on m.sort_id=s.sort_id and m.sort_id=2;
select m.menu_id,m.sort_id,s.sort_id,s.sort_name from menu m inner join sort s on m.sort_id=s.sort_id where m.sort_id=2;
Copy after login

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

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template