not in() 本质是 or datavar not in ( 查询条件 ,null ) 相当于 not ( datavar = 查询条件 or datavar =null)
如果datavar = 查询条件 为 false 那么 not null 返回false;
如果datavar = 查询条件 为 true 那么返回 true ; 只要有null值都 返回false且查不出数据
SQL语句的执行顺序 select Distinct <Top_sepicitioin> <select_list> from left_table <join_type> join right_table ON <on_condiction> where <where_condiction> Group by <group_by_condiction> with {CUGB|ROLLUP} having <having_condiction> order by <order by_list>
ON where Group by having 都可以看做是筛选器 筛选器可以看做是生成另外的表
本文深入解析SQL语句中的not in操作符与null值的交互作用,通过具体示例说明其执行顺序及逻辑,强调在查询条件中处理null值的重要性。同时,提供SQL语句执行流程的全面概述,帮助开发者更高效地进行数据筛选。
376

被折叠的 条评论
为什么被折叠?



