zoukankan      html  css  js  c++  java
  • 数据库

    mysql> SELECT * FROM tcount_tbl 
        -> WHERE tutorial_count IS NULL;
    +-----------------+----------------+
    | tutorial_author | tutorial_count |
    +-----------------+----------------+
    | mahnaz          |           NULL |
    | Jen             |           NULL |
    +-----------------+----------------+
    2 rows in set (0.00 sec)
    mysql> SELECT * from tcount_tbl 
        -> WHERE tutorial_count IS NOT NULL;
    +-----------------+----------------+
    | tutorial_author | tutorial_count |
    +-----------------+----------------+
    | mahran          |             20 |
    | Gill            |             20 |
    +-----------------+----------------+
    2 rows in set (0.00 sec)

    查找数据表中 tutorial_count 列是否为 NULL,必须使用IS NULL和IS NOT NULL,如下实例:







    实例

    以下展示了使用MySQL 临时表的简单实例,以下的SQL代码可以适用于PHP脚本的mysql_query()函数。

    mysql> CREATE TEMPORARY TABLE SalesSummary (
        -> product_name VARCHAR(50) NOT NULL
        -> , total_sales DECIMAL(12,2) NOT NULL DEFAULT 0.00
        -> , avg_unit_price DECIMAL(7,2) NOT NULL DEFAULT 0.00
        -> , total_units_sold INT UNSIGNED NOT NULL DEFAULT 0
    );
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> INSERT INTO SalesSummary
        -> (product_name, total_sales, avg_unit_price, total_units_sold)
        -> VALUES
        -> ('cucumber', 100.25, 90, 2);
    
    mysql> SELECT * FROM SalesSummary;
    +--------------+-------------+----------------+------------------+
    | product_name | total_sales | avg_unit_price | total_units_sold |
    +--------------+-------------+----------------+------------------+
    | cucumber     |      100.25 |          90.00 |                2 |
    +--------------+-------------+----------------+------------------+
    1 row in set (0.00 sec)
  • 相关阅读:
    彻底屏蔽淘宝网、易趣
    日期处理string 与 DateTime相互转化
    手机进水!!!!!!!!!
    解决VS.net "Automation 服务器不能创建对象"
    综艺大哥大
    计算当前日期是任意时间段内第几周的函数
    吉祥三宝>馒头无极版
    如何在ASP.NET中使用JavaScript脚本
    IDEA工具开发一些辅助功能设置
    Linux命令行模式下挂载U盘与光驱
  • 原文地址:https://www.cnblogs.com/agang-php/p/4882894.html
Copyright © 2011-2022 走看看