oracle not in查不出任何数据问题

not exists能查出数据

 SELECT * FROM students st WHERE  not exists(select 1 from stu_score ss where  st.id=ss.stu_id);

not in查不出任何数据

SELECT * FROM students st WHERE  st.id not in(select  ss.stu.id from stu_score ss );

原因:ss.stu.id包含NULL
修改:SELECT * FROM students st WHERE st.id not in(select ss.stu.id from stu_score ss where ss.stu.id is not null); --能查出数据

参照博文:https://blog.csdn.net/linbrain0000/article/details/34106531

原文地址:https://www.cnblogs.com/xmm2017/p/13943852.html