Home > Database > Mysql Tutorial > What is the difference between join and where in mysql

What is the difference between join and where in mysql

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2023-05-30 15:04:06
forward
1409 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:
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
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template