MySQL like
模糊查询
查询emp表中姓名中以“li”开头的员工,显示员工姓名、薪资:
mysql
select ename, salary sal
from emp where ename like 'li%';
1
2
2
查询emp表中姓名中包含“li”的员工,显示员工姓名、薪资:
mysql
select ename, salary sal
from emp where ename like '%li%';
1
2
2
查询emp表中姓名以“li”结尾的员工,显示员工姓名、薪资:
mysql
select ename, salary sal
from emp
where ename like '%li';
1
2
3
2
3