题解 | #检索产品名称和描述(二)#

检索产品名称和描述(二)

https://www.nowcoder.com/practice/669913837a7648f9aa0caaf6a88c834f

# 本题的思路与上题恰恰相反,因此解题的思路几乎一样,同样可以采用三种方式
# 1.locate函数:Locate(str,sub) > 0,表示sub字符串包含str字符串;Locate(str,sub) = 0,表示sub字符串不包含str字符串。
select prod_name,prod_desc from Products
where locate("toy",prod_desc) = 0
order by prod_name asc
# 2.instr(filed,str)函数:返回str子字符串在filed字符串的第一次出现位置
select prod_name,prod_desc from Products
where instr(prod_desc,"toy") = 0
order by prod_name asc
# 3.not like
select prod_name,prod_desc from Products
where prod_desc not like "%toy%"
order by prod_name asc
# 本题中各函数的参考内容如下:



全部评论

相关推荐

点赞 评论 收藏
分享
03-10 10:57
已编辑
门头沟学院 推荐算法
夜夜还好:我们学校说为了学生就业,更新了课程,我今天大二,上学期在学jsp,html,这学期上来工程实践,要求用springboot+vue,说什么这些技术要我们提前自己准备,要不你把学费还我吧,我给b站充个会员,人家教的比你多
点赞 评论 收藏
分享
评论
128
6
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务