您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

oracle中between的用法是什么

2024/12/3 2:38:12发布23次查看
在oracle中,between运算符用于选择值在一个范围内的行数据,当使用between运算符为语句返回的行形成搜索条件时,只返回其值在指定范围内的行,语法为“expression [not] between low and high”。
本教程操作环境:windows10系统、oracle 11g版、dell g3电脑。
oracle中between的用法是什么between运算符允许指定要测试的范围。当使用between运算符为语句返回的行形成搜索条件时,只返回其值在指定范围内的行。
以下说明between运算符的语法:
expression [ not ] between low and high
在上面的语法中,
low 和high - low和hight指定要测试的范围的下限值和上限值。low和hight值可以是文字或表达式。
expression - 是low和hight定义的范围内测试的表达式。 为了能够比较,expression,low和hight的数据类型必须是相同的。
and - and运算符充当占位符来分隔low和hight的值。
如果表达式(expression)的值大于或等于low的值,小于或等于hight的值,则between运算符返回true。
value >= low and value <= high
not between运算符否定between运算符的结果。
oracle between示例
下面来看看使用oracle between运算符的一些示例。
1. oracle between数值示例
请参阅中的以下products表:
以下语句返回标准成本在500到600之间的所有产品:
select product_name, standard_costfrom productswhere standard_cost between 500 and 600order by standard_cost;
在此示例中,我们将标准成本(standard_cost)列中的值与500(含)到600(含)之间的范围进行比较。该查询仅返回标准成本在以下范围之间的产品:
要查询标准成本不在500和600之间的产品,请按如下方式将not运算符添加到上述查询中:
select product_name, standard_costfrom productswhere standard_cost not between 500 and 600order by product_name;
执行上面查询语句,得到以下结果 -
推荐教程:《oracle视频教程》
以上就是oracle中between的用法是什么的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product