首页 > 代码库 > SQL_模糊查询

SQL_模糊查询

--‘_‘匹配单个字符--‘%‘匹配多个字符SELECT * FROM Students WHERE Name LIKE 张% --查询以‘张‘开头的记录SELECT * FROM Students WHERE Name LIKE %张 --查询以‘张‘结尾的记录SELECT * FROM Students WHERE Name LIKE 张%三 --查询以‘张‘开头,‘三‘结尾的记录SELECT * FROM Students WHERE Name LIKE 张%[^三] --查询以‘张‘开头,不以‘三‘结尾的记录SELECT * FROM Students WHERE Name LIKE 张_ --查询以‘张‘开头的记录SELECT * FROM Students WHERE Name LIKE 张_三 --查询以‘张‘开头,‘三‘结尾的记录

 

SQL_模糊查询