zoukankan      html  css  js  c++  java
  • sqlplus 条件查询

    条件查询

    where字句用来过滤查询的数据,它对字面量大小写是敏感

    语法:
    select 列名1,列名2...
    from 表名
    where 筛选的条件;

    1.比较运算符
    >,<,=,<=,>=,!=(^=,<>)


    --查询在41部门的员工名字,工资
    select
    first_name,salary
    from

    s_emp

    where
    dept_id=41
    ;

    --查出工资高于1500的员工的信息;
    select * from s_emp where salary>1500;

    --找出工资大于1200的员工的全名、工资、职位
    select first_name||' '||last_name 全名,salary 工资,title 职位
    from s_emp
    where salary >1200;


    -----------------------------------------------------------------------

    2.逻辑运算符
    and,or

    --查出41部门中工资高于1200的员工名字,工资;
    select first_name, salary ,dept_id
    from s_emp
    where dept_id = 41 and salary > 1200;


    --查出41,50,42部门的员工名字,薪水;
    select first_name,salary from s_emp where dept_id=41 or dept_id=42 or dept_id=50;

    ----------------------------------------------------------------------

    3.其他运算符
    in() 取多个数值,多个值使用逗号隔开
    例:
    deot_id in(41,42,50)相当于dept_id=41 or dept_id=42 or dept_id=50;

    not in()

    between 2 and 6 在指定的范围之内,是全闭空间;相当于>=2 and <=6
    dept_id>2 and dept_id<6 非全闭空间

    is null
    is not null

    模糊查询:like
    通配符:rose
    _通配任意单个字符
    %通配任意多个字符

  • 相关阅读:
    android 2.3 bug android 4.x bug
    设计高性能CSS3动画的几个要素
    开启硬件加速 解决页面闪白 保证动画流畅
    取消input在ios下,输入的时候英文首字母的默认大写 android 上去掉语音输入按钮
    JS中的类型检测
    CSS的一点知识
    HTML Canvas
    HTML DOM Table 对象
    只是有所了解的语言
    骑士巡游问题
  • 原文地址:https://www.cnblogs.com/zhang12354/p/7767395.html
Copyright © 2011-2022 走看看