Oracle SQL 学习(一)

来源:互联网 发布:软件开发编程 编辑:程序博客网 时间:2024/05/17 06:39

1. LIKE

SQL 可以利用‘LIKE’ 关键字实现模糊查询。在 where 子句中 ,可以对datetime,char,varchar 字段类型的列使用like 子句 。

通配符:

%: 零个或者多个字符。

_ : 单一个任意字符。(下划线)

\ : 特殊字符。

[] : 在某一个范围内的字符,例如 [0-9],[a-z]

[^] : 不再某一个范围内的字符。


当查询内容包含通配符时:

把特殊字符用“[ ]”扩起来,就可以实现正常查询了

function sqlencode(str)
str=replace(str,"[","[[]") '此句一定要在最前
str=replace(str,"_","[_]")
str=replace(str,"%","[%]")
sqlencode=str
end function


From: http://www.51testing.com/html/38/225738-214164.html


2. is null and = null

is null : is to judge aattribute is null or not . it not equal to '0' or "".

= null: is to judge avalue is null or not.






0 0
原创粉丝点击