zoukankan      html  css  js  c++  java
  • MySQL 随记

    SQL语句规范
    语句结束符:g
    帮助:help h
    清除当前输入:c
    修改提示符:登录:--prompt


    mysql判断字段是否非空
    select * 表名 where 字段名 is null  <=>null
    select * 表名 where 字段名 is null

    having的用法
    having字句可以让我们筛选成组后的各种数据,where字句在聚合前先筛选记录,
    也就是说作用在group by和having字句前。而 having子句在聚合后对组记录进行筛选。
    我的理解就是真实表中没有此数据,这些数据是通过一些函数生存。

    select max(sal+0),min(sal+0) from emp;
    对varchars类型使用max 和min 时,所得结果不对,要转换下
    select A.c_id,student.name from (select count(corse_id) as c_id,student_id from score group by student_id) as A left join student on student.sid=A.student_id having A.c_id =2;

  • 相关阅读:
    newman
    集合自动化
    56. Merge Intervals
    55. Jump Game
    48. Rotate Image
    34. Search for a Range
    33. Search in Rotated Sorted Array
    16. 3Sum Closest
    15. 3Sum
    11. Container With Most Water
  • 原文地址:https://www.cnblogs.com/3ddan/p/10361584.html
Copyright © 2011-2022 走看看