SQL15、查看学校名称中含有北京的用户
思路:使用WHERE
关键字添加限定条件,并且用正则表达式匹配数据
代码解释:从表user_profile
中取出列device_id
、age
、university
,并限定数据来自学校名称中含有北京的用户
SELECT
device_id,
age,
university
FROM
user_profile
WHERE
university REGEXP '北京'
思路:使用WHERE
关键字添加限定条件,并且用正则表达式匹配数据
代码解释:从表user_profile
中取出列device_id
、age
、university
,并限定数据来自学校名称中含有北京的用户
SELECT
device_id,
age,
university
FROM
user_profile
WHERE
university REGEXP '北京'