zoukankan      html  css  js  c++  java
  • How to perform a SQL query for fields that are null (or not null)

     

    Okay, maybe this is lame, but when I've been away from writing SQL database queries for a while I can never remember how to search for database table fields that are either NULL, or NOT NULL. I always try to use the = operator or something else.

    So, for you Al, here's how to perform a SQL query and find all records where a field in a database table is NULL:

    SELECT * FROM foo WHERE bar IS NULL;
    

      

    And here's how to perform a SQL query showing all records in a database table where a field is NOT NULL:

    SELECT * FROM foo WHERE bar IS NOT NULL;
    

      

    This works with every database I've tried, including MySQL, Oracle, Postgres, and SQL Server.

  • 相关阅读:
    开发微信App支付
    SAP 数据类型
    SAP RFC函数
    单点登录
    集中式与分布式
    SAP 表类型
    独立软件供应商
    SAP 优缺点
    SAP 使用
    SAP 费用
  • 原文地址:https://www.cnblogs.com/hephec/p/4586890.html
Copyright © 2011-2022 走看看