zoukankan      html  css  js  c++  java
  • 简单查询笔记

    1。普通查询
    select* from Info# 查询所有内容
    select Code, Name from Info #查询某几列
    2。条件查询
    select*from Info where code='p001';#条件查询
    
    select*from Info where Nation='n001' and Sex=true;#条件之间并的关系
    
    select*from Info where Sex=false or Nation='n002' #条件之间或者的关系
    
    3.模糊查询
    
     select*from ChinaStates where AreaName Like '中%'#查询以中开头的
    
      select*from ChinaStates where AreaName Like '%城%'#查询包含城的信息
     
     
    select*from ChinaStates where AreaName Like'_城%' #查询城在第二个位置出现的数据
      
    4.排序查询
     
    select*from Car order by Code desc #desc降序 asc升序
    
    select*from Car order by Brand
    
    select*from Car order by Brand, Powers #按照两个列排序
    
    5.统计查询(聚合函数)
    
    select count(*)from Car  #查询总条数 括号里可以加code 耗时少
    
    
    select max(Price) from Car#查询最大值
     
    
    select min(Price) from Car #查询最小值
    
    
    
    select avg(Price) from Car  #查询平均值
    
    
    
    select sum(Price) from Car  #查询总和
    
    select max(price),min(price),avg(price) from car #如果要一起查的话只有这样
     
    6.分组查询
     
    
    select  price,count(*), max(price) from fruit group by price #根据系列分组查看每组的数据条数
    
    
    select *from Car group by Brand having count(*)>2 #查询分组之后数据条数大于2的
    
    
    7.分页查询
    select *from Car limit 0,5  #跳过几条数据取几条数据 
     
    
    8.去重查询
    
    select distinct oil from car
  • 相关阅读:
    Cocos Creator代码编辑环境配置
    CocosCreator编辑器界面
    Colored Sticks (并查集+Trie + 欧拉路)
    子序列 NYOJ (尺取法+队列+hash) (尺取法+离散化)
    相同的雪花 Hash
    F
    逆序数
    士兵杀敌5 前缀数组
    Color the ball 线段树 区间更新但点查询
    士兵杀敌(二) 线段树
  • 原文地址:https://www.cnblogs.com/crazy-zw/p/5290015.html
Copyright © 2011-2022 走看看