-- 使用 like 关键字select t_employee.ename from t_employee where t_employee.ename like"%AM%";-- 使用 REGEXP 通配符select t_employee.ename from t_employee where t_employee.ename REGEXP "AM";
第4题 - 查询出名字以“JA”字符串开头的员工
-- 使用 like 关键字select t_employee.ename from t_employee where t_employee.ename like"JA%";-- 使用 REGEXP 通配符select t_employee.ename from t_employee where t_employee.ename REGEXP "^JA";
第5题 - 查询出名字以“ES”字符串结尾的员工
% 表示任意字符,0个或多个
$ 表示以…结尾
-- 使用 like 关键字select t_employee.ename from t_employee where t_employee.ename like"%ES";-- 使用 REGEXP 通配符select t_employee.ename from t_employee where t_employee.ename regexp "ES$";
第6题 - 查询出名字中不包含“SMI”字符串中任意字符的员工
select ename from t_employee where ename regexp '^[^SMI]+$';
第7题 - 查询出名字中以“SMI”字符串开头的员工,其中的M字符可以出现1~3次
-- 使用 REGEXP 通配符select ename from t_employee where ename REGEXP "^SM{1,3}I";