zoukankan      html  css  js  c++  java
  • 查询

    查询

    简单查询:


    1.查询所有数据
    select * from info


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


    3.给列指定名称
    select code as '代号',name as '姓名' from info


    4.条件查询
    select * from info where code='p001'
    select * from info where code='p001' and nation='n001'


    5.模糊查询
    select * from car where name like '%奥迪%'


    6.排序查询
    select * from car order by price asc,oil desc


    7.去重查询
    select distinct brand from car


    8.分页查询
    select * from car limit 5,5


    9.统计查询(聚合函数)
    数据条数
    select count(code) from car
    取最大值
    select max(price) from car
    取最小值
    select min(price) from car
    取平均值
    select avg(price) from car


    10.分组查询
    select brand,count(*) from car group by brand
    select brand from car group by brand having count(*)>=3


    11.范围查询
    select * from car where price>=40 and price<=60
    select * from car where price between 40 and 60


    12.离散查询
    select * from car where price in(10,20,30,40,50,60)
    select * from car where price not in(10,20,30,40,50,60)

  • 相关阅读:
    jTopo——js库
    node.js
    php 入门笔记
    D3 入门笔记
    webpack笔记
    React.js
    Grunt等前端自动化构建工具
    vue3.0的新特性
    electron-builder 打包流程
    vue里面如何下载图片,如何下载文件
  • 原文地址:https://www.cnblogs.com/Whitehat/p/8257215.html
Copyright © 2011-2022 走看看