zoukankan      html  css  js  c++  java
  • Sql 复习(2)

    Sql 中 不等于 可以用 以下方式表示:

    select * from [TableName] where not id = 1; (注意不能写成 select * from [TableName] where id not = 1;)

    select * from [TableName] where id != 1;

    select * from [TableName] where id <> 1;(最常用)

    通配符:

    %表示匹配0个,1个或多个字符。

    select * from [TableName] where address like '%' 不会检索出address值为null的行。

    _表示只匹配一个字符,不能多也不能少。

    集合通配符[]:(貌似只有微软的数据库支持,以下是Sqlserver中的例子,Access的写法不太一样)

    找出所有名字以G或X开头的用户。

    select * from Users where name like '[GX]%'

    否定上面的语句有三种写法:

    1. select * from Users where name like '[^GX]%'

    2. select * from Users where name not like '[GX]%'

    3. select * from Users where not name like '[GX]%'(这个是not的通用语法,表示否定后面的这条语句)

    注意:不要过度使用通配符,如果能用其他操作符的能达到相同目的,请使用其他操作符。

    如果确实需要使用通配符,也尽量不要把它们用在搜索的开始处,因为这样搜索是最慢的。

  • 相关阅读:
    判断是否是微信浏览器
    弹性盒模型
    一个发光的搜索边框(纯CSS3)
    小练习
    js控制div是否显示
    遮罩弹窗
    布局
    CSS构造表单
    CSS 滤镜(IE浏览器专属其他浏览器不支持)
    Css中光标,DHTML,缩放的使用
  • 原文地址:https://www.cnblogs.com/grady1028/p/10658853.html
Copyright © 2011-2022 走看看