欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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 '张__';
相关标签: LIKE