Intern Day33

  1. count() 是个聚合函数。 作用:求表的所有记录数

  2. select * from 表名 :查询表的所有记录(返回记录)

  3. select count(*) from 表名: 查询表的所有记录数

  4. selecr ... as ... 一般重命名列名或表名。比如:select a as b,c as d = 选择 a 作为 b , c 作为 d

  5. order by

    select * from student order by age asc # 按年龄升序排序;asc可以省略默认升序
    select * from student order by age desc # 按年龄降序排序
    
  6. UNION:合并多个查询结果

    select 列名 from 表名1
    UNION
    select 列名 from 表名2;
    
  7. 如果在一个数组列中想查询包含有某个字符串的时就不能用like了,这个时候用 @> 来查找数组列中某个元素是否包含。

  8. EXISTSIN

原文地址:https://www.cnblogs.com/OFSHK/p/14567047.html