zoukankan      html  css  js  c++  java
  • mysql3

    简单查询

    1.最简单查询(查所有数据)
    select * from info

    2.查询指定列
    select code,name from info

    3.修改结果集的列名
    select code as '代号',name as '姓名' from info

    4.条件查询
    select * from info where code='p003'

    5.多条件查询
    查询info表中code为p003或者nation为n001的所有数据
    select * from info where code='p003' or nation='n001'
    查询info表中code为p004并且nation为n001的数据
    select * from info where code='p004' and nation='n001'

    6.范围查询

    Select * from car where price>=40 or price<=60

    Select * from car where price between 40 and 60

     

    7.离散查询

    Select * from car where price=10 or price=20 or price=30 or price=40 or price=50 or price=60

     

    Select * from car where price in(10,20,30,40,50,60)

     

    8.模糊查询

    Select * from car where name like ‘%奥迪%

     

    Select * from car where name like ‘_%’           任意一个字符

    9.排序查询

     

    Select * from car order by price asc                asc升序排列

     

    Select * from car order by brand price desc          desc按价格降序排列

    10.去重查询

    Select distinct brand from car

     

    11.分页查询

    一页显示十条 当前是第三页

    Select * from chinastates limite 20,10

     

    12.聚合函数(统计函数)

    Select count(arecode) from chinastates #查询数据总条数

    Select sum(price)from car           #求和

    Select avg(price)from car            #求平均

    Select max(price)from car           #求最大值

    Select min(price)from car           #求最小值

    13.分组查询

    查询汽车表中每个系列下有多少个汽车

    select brand count(*)  from car group by brand

     

     

  • 相关阅读:
    SAS-决策树模型
    sas 9.4 sid 64bit 到期时间210804 带有EM
    PROC IMPORT 选项
    删除文件夹下各级子目录中的.svn文件
    SAS PROC PRINT 常用选项和语句说明
    SAS 评分卡开发模型变量统计及输出
    Symbol类型是不可枚举的
    将类设置为等于其他类/函数构造函数
    js原生方法promise的实现
    或与非优先级
  • 原文地址:https://www.cnblogs.com/qdlj/p/6188098.html
Copyright © 2011-2022 走看看