Like 模糊查詢
占位符
% 替代一個或多個字符
_ 僅替代一個字符
[charlist] 字符列中的任何單一字符
[^charlist] 或者 [!charlist] 不在字符列中的任何單一字符
(1)查詢 用戶名以‘S’開頭的員工信息
Select * from emp where ename like 'S%'
(2)查詢 用戶名以‘S’結尾的員工信息
Select * from emp where ename like '%S'
(3)查詢用戶名第二個字母是‘A’的員工信息
select * from emp where ename like '_A%'
(4)查詢用戶名第三個字母是‘A’的員工信息
select * from emp where ename like '__A%'
(5)查詢用戶名中包含 ‘A’ 的員工信息
select * from emp where ename like '%A%'
(6)查詢用戶名中不包含 ‘A’ 的員工信息
select * from emp where ename not like '%A%'
(7)從 "Persons" 表中選取居住的城市以 "A" 或 "L" 或 "N" 開頭的人:
SELECT * FROM Persons WHERE City LIKE '[ALN]%'
(8)從 "Persons" 表中選取居住的城市不以 "A" 或 "L" 或 "N" 開頭的人:
SELECT * FROM Persons WHERE City LIKE '[!ALN]%'