select null from table,exists和not exists 关键字的理解和使用场合

关键字exists 和not exists AND select null from table

  • select null from table。

这句sql语句的作用:查询表中的数据,如果有则返回为NULL ,就是把select * from table 中的所有信息替换成NULL ,理解一下就比较简单了。

图解
select null from table,exists和not exists 关键字的理解和使用场合
select null from table,exists和not exists 关键字的理解和使用场合

  • exists 关键字

exists 这个关键字返回的为boolean 类型的,并不是一些数据关联,如果条件成立。就返回为true ,表明这个条件成立,否则 false .

图解
select null from table,exists和not exists 关键字的理解和使用场合
select null from table,exists和not exists 关键字的理解和使用场合
总结

select null from table 就是把符合查询条件的数据所显示的数据替换成NULL。exists 就是如果存在数,就是true ,不存在就为false 。