ORACLE之LIKE
程序员文章站
2022-06-02 20:08:00
...
模糊查询-like
格式:
SELECT Columns_1,Columns_2,Columns_n FROM TABLE WHERE Columns_3 LIKE ' '
示例:
- 包含“国”
SELECT USER_ID,USER_CODE,USER_NAME FROM XY_USER WHERE USER_NAME LIKE '%国%';
- “张”开头
SELECT USER_ID,USER_CODE,USER_NAME FROM XY_USER WHERE USER_NAME LIKE '张%';
- “国”在中间
SELECT USER_ID,USER_CODE,USER_NAME FROM XY_USER WHERE USER_NAME LIKE '%国_';
- “国”结尾
SELECT USER_ID,USER_CODE,USER_NAME FROM XY_USER WHERE USER_NAME LIKE '%国';
- “张”开头 两个字
SELECT USER_ID,USER_CODE,USER_NAME FROM XY_USER WHERE USER_NAME LIKE '张_';
- “张”开头 三个字
SELECT USER_ID,USER_CODE,USER_NAME FROM XY_USER WHERE USER_NAME LIKE '张__';
上一篇: oracle like %% 用法
下一篇: 快速乘/规避溢出