美文网首页
部分SQL 语法

部分SQL 语法

作者: 忧郁的老王 | 来源:发表于2023-03-19 16:00 被阅读0次
    关键字 释义
    DISTINCT 区分,只列出同一列中的不同项
    ASC 升序排列
    DESC 降序排列
    order by 排序方式(多字段排序,order by 之后的参数,使用 “,” 分割,优先级是按先后顺序而定)
    AND/OR 和与或 (例句 select * from info where score > 10 and score <= 90;)
    嵌套/多条件 例句 :select * from info where score >70 or (score <50 AND score >=30)
    in 关键字,表示从指定范围中筛选 例句 select a , b from t where a in (select distinct a from t )
    limit 限制输出行数 例如 select * from info limit 3;
    join INNER JOIN 可以省略掉INNER直接写成JOIN,基本用法:select <字段名a> from <表名1> join <表名2> on 表名2.字段名 = 表名1.字段名b
    using USING等价于join操作中的ON (1.查询必须是等值连接。2.等值连接中的列必须具有相同的名称和数据类型)

    相关文章

      网友评论

          本文标题:部分SQL 语法

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