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)

  • 相关阅读:
    005 HTML+CSS(Class027
    004 HTML+CSS(Class024
    003 HTML+CSS(Class011
    002HTML+CSS(class007-010)
    001HTML+CSS(class001-006)
    021 vue路由vue-router
    020 Vue 脚手架CLI的使用
    019 Vue webpack的使用
    018 vue的watch属性
    017 vue的插槽的使用
  • 原文地址:https://www.cnblogs.com/Whitehat/p/8257215.html
Copyright © 2011-2022 走看看