SQL LIKE 操作符用来对数据表进行模糊查询。
SQL LIKE 操作符语法
SELECT Columns FROM 表名 WHERE ColumnName LIKE pattern
模糊查询通常使用 通配符。
SQL LIKE 范例
数据表: Employees
| EmployeeId | FirstName | LastName | Department | Salary |
|---|---|---|---|---|
| 203 | Mazojys | Fxoj | Finance | 78000 |
| 204 | Jozzh | Lnanyo | Finance | 45800 |
| 205 | Syllauu | Dfaafk | Finance | 57000 |
| 206 | Gecrrcc | Srlkrt | Finance | 62000 |
| 302 | Jssme | Bdnaa | Development | 75000 |
| 303 | Dnnaao | Errllov | Development | 55000 |
| 304 | Tyoysww | Osk | Development | 49000 |
Example 1
我们想选择所有FirstName从字母”J”开始的职员(Employee):
SELECT * FROM Employees WHERE FirstName like 'J%'
结果会类似于:
| EmployeeId | FirstName | LastName | Department | Salary |
|---|---|---|---|---|
| 204 | Jozzh | Lnanyo | Finance | 45800 |
| 302 | Jssme | Bdnaa | Development | 75000 |

Interesting. I’m only recently learning SQL so thanks for this
Great post and blog both… I just searching for these SQL Queries and got it here…Many Thanks for sharing this.. keep it up…
It is really great tutorial. could plz tell or give exaple of join with like function