美文网首页随笔
一些SQL--过滤数据

一些SQL--过滤数据

作者: testleaf | 来源:发表于2020-03-22 18:45 被阅读0次

    Server version: 5.6.47 MySQL Community Server (GPL)

    1.使用WHERE子句
    SELECT prod_name,prod_price FROM Products WHERE prod_price=3.49;


    2.检查单个值
    SELECT prod_name,prod_price FROM Products WHERE prod_price<10;

    SELECT prod_name,prod_price FROM Products WHERE prod_price<=10;

    3.不匹配检查
    SELECT vend_id,prod_name FROM Products WHERE vend_id<>'DLL01';

    SELECT vend_id,prod_name FROM Products WHERE vend_id!='DLL01';

    4.范围值检查
    SELECT prod_name,prod_price FROM Products WHERE prod_price BETWEEN 5 AND 10;

    5.空值检查
    SELECT prod_name FROM Products WHERE prod_price IS NULL;

    SELECT cust_name FROM Customers WHERE cust_email IS NULL;

    相关文章

      网友评论

        本文标题:一些SQL--过滤数据

        本文链接:https://www.haomeiwen.com/subject/oubvyhtx.html