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)
  • 相关阅读:
    第二次冲刺——第5天
    第二次冲刺——第4天
    第二次冲刺——第3天
    第二次冲刺——第2天
    第二次冲刺——第1天
    团队开发——第一次冲刺第8天
    团队开发——第一次冲刺第7天
    团队开发——第一次冲刺第1天
    软件工程课堂练习——找出1-n中1出现的个数
    软件工程——《你的灯亮着吗》读书笔记2
  • 原文地址:https://www.cnblogs.com/agang-php/p/4882894.html
Copyright © 2011-2022 走看看