MYSQL 中IN的实例优化

1.select * from film where film_id in ( select film_id from film.actor where actor_id = 1);
因为in后面的数据多了的话,会很影响效率
in() 加子查询改进
优化修改:
2.select film.* from film inner join film_actor using(film_id) where actor_id = 1;
3.select * from film where exists (select * from film_actor where actor_id = 1 and film_actor.film_id = film.film_id);

你可能感兴趣的:(MYSQL 中IN的实例优化)