zoukankan      html  css  js  c++  java
  • SQL语句 查询

    模糊查询
    select * from car where name like '%关键字%'

    排序查询
    select * from car order by 列名 desc --递减
    select * from car order by 列名 asc --递增(默认)

    去重查询
    select distinct 列名 from 表名

    select 列名 from 表名 group by 列名

    聚合函数
    select 列名,COUNT(*) from car group by brand    --计数
    select 列名,AVG(oil) from car group by brand       --平均数
    select 列名,max(oil) from car group by brand        --最大值
    select 列名,min(oil) from car group by brand         --最小值
    select 列名,sum(oil) from car group by brand        --求和

    子查询
    select * from 表名 where 列名 in('b001','b002','b003')
    select * from 表名 where 列名 in(
    select 列名 from 表名 where name like '%关键字%')
    select * from 表名 where 列名 between 数值 and 数值

    别名
    select 列名 as 新列名 from 表名

  • 相关阅读:
    去哪儿网门票数据爬虫更新
    每周进度总结12
    每日进度总结20
    每日进度总结19
    每日进度总结18
    每日进度总结17
    每日进度总结16
    每日进度总结15
    每日进度总结14
    每周进度总结11
  • 原文地址:https://www.cnblogs.com/m110/p/7724125.html
Copyright © 2011-2022 走看看