Home >Database >Mysql Tutorial >What is the difference between join and where in mysql
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;
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!