经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » 数据库/运维 » Oracle » 查看文章
oracle学习笔记(五) SQL操作符 - Stars-one
来源:cnblogs  作者:Stars-one  时间:2019/4/23 8:45:17  对本文有异议

SQL操作符

算术操作符:+加,-减,*乘,/除

比较操作符:

  • <,>,=,!=,<>,<=,>=
    常用的判断,<>和!=相同
  • between $lower_val$ and $hight_val$
    between .. and.. 包括两端
  1. --查询20<=age<=21的学生数据
  2. select * from student where age between 20 and 21
  • not between $lower_val$ and $hight_val$
    与上面相反
  • in(值列表), not in(值列表)
  1. --查询年龄是2021的学生数据
  2. select * from student where age in (20,21)
  • is null, IS NOT NULL
    是否为空
  • like, not like
    匹配 ( 通配 )操作符:
    • % 匹配任意多个字符;
    • _ 匹配任意单个字符;
    • 可以使用escape '$'指定转义字符,默认是""
  1. --姓氏为张的学生,张二,张三,张四五都符合条件
  2. select * from student where name like '张%';
  3. --名字含有三的
  4. select * from student where name like '%三%';
  5. --姓氏为张,名字只有两个字的学生
  6. select * from student where name like '张_';
  7. --名字中包含%号的
  8. select * from student where name like '%\%%' escape '\' ;

逻辑操作符: AND, OR, NOT

与,或

连接操作符: ||

  1. -- 查询student表中你的numname列,并把这两列显示出来
  2. select num||,||name from student

集合(查询的结果集)操作符

下一章《高级查询》再讲
a)UNION 联合,将两个查询结果拼起来
b)UNION ALL 联合所有,多出现重复行
c)INTERSECT 交集
d)MINUS 减集

原文链接:http://www.cnblogs.com/kexing/p/10751163.html

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号