2023-04-19
温故知新
00

目录

简介
Not in
须知:本文不定期更新

简介

常见的SQL语句优化记录。

Not in

  • MySQL

模拟需求:查询没有班级的学生(可能在数据量)

一般语句:

sql
select id from user_table where not in (select user_id from class_table);

优化语句

sql
select a.id from user_table a left join class_table b on a.id - b.user_id where b.user_id is not null;

须知:本文不定期更新

如果对你有用的话,可以打赏哦
打赏
ali pay
wechat pay

本文作者:DingDangDog

本文链接:

版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!