zoukankan      html  css  js  c++  java
  • 数据库查询

    use mydb

    select *from Category where Parent='013' or parent='011' or Parent='012'

    --in 代表在某些参数范围之内的都符合条件,相当于多个or

    select *from Category where Parent in('013','011','012')

    --not 起修饰作用,取反

    select *from Category where Parent not in ('013','011','012')

    --between and 表示在某范围之内,相当于>= <=

    select *from Category where Ids>500 and Ids<505

    select *from Category where Ids between 500 and 505

    --模糊查询,行业里带国家两个字的 like

    select *from Category where Name like'%国家%'

    select *from Category where Name like'国家%'

    select *from Category where Name like'%机构%'

    --查询某一列里带国家两个字用'%国家%'

    --查询某一列里带国家两个字开头的'国家%"

    --查询某一列里以国家结尾'%国家'

    --不带某个字的not like

    select *from Category where Name not like '%国家%'

    --查询某一列,用列名代替*

    select code ,name from Category where Ids >5 and Ids <10

    select code from Category where Ids >5 and Ids <10

    select Ids from Category where Ids in (6,7,8,9)

    select *from Category where Ids>all

    (

    select Ids from Category where Ids in (6,7,8,9)

    )

    select *from Category where Ids>all

    (

    select Ids from Category where Ids>1190 and Ids <1195

    )

    --查询一列当作参数使用

    -->any大于查询出来的任何一个(最小数)

    -->all大于查询出来的所有的(最大数)

  • 相关阅读:
    2020 8 17 每日总结
    2020 8 9 每周总结
    2020 8 15 每日总结
    2020 8 13 每日总结
    2020 8 16 每日总结
    2020 811 每日总结
    2020 8 14 每日总结
    图的储存 各种方式的优缺点
    主席树 可持久化线段树基础知识入门详解
    NOIP复赛涉及面最广的知识点简述
  • 原文地址:https://www.cnblogs.com/yangyue/p/4120178.html
Copyright © 2011-2022 走看看