第六章:过滤数据

这是《MySQL必知必会》的学习笔记,也是mysql的基础知识,以备以后方便查阅

  • MySQL数据库安装和练习数据导入,参考这篇ubuntu18安装mysql和导入练习数据

  • 使用过滤条件,where查询字句,MySQL执行匹配时候不区分大小写

    select prod_name, prod_price from products where prod_name='fuses';
    
  • where子句操作符

    • = 等于
    • != <> 不等于
    • < 小于
    • <= 小于等于
    • > 大于
    • >= 大于等于
    • BETWEEN 在指定的值之间,这里两个边界值都包含
    select prod_name, prod_price from products where prod_price=2.50;
    select prod_name, prod_price from products where prod_price<=10;
    select prod_name, prod_price from products where prod_price!=10;
    select prod_name, prod_price from products where prod_price between 5 and 10;
    
  • NULL 无值,它和字段包含0,空字符串或者仅包含空格不同

    select cust_id, cust_email  from customers where cust_email is null;
    
posted @ 2020-08-09 21:44  iread9527  阅读(81)  评论(0编辑  收藏  举报