所以我正在启动 SQL 并且我有以下查询
Select * from Material where theme = 'math' or name = 'math';
据我所知,这为我提供了在主题或名称上实际具有确切字符串“math”的值。如果我想要该值,即“数学”也作为属性主题或名称的子字符串,我该如何放置。
最佳答案
最简单的方法是使用 LIKE
运算符进行通配符匹配:
WHERE theme LIKE '%math%' // math appears anywhere in the string
WHERE theme LIKE 'math%' // math appears at the START of the string
WHERE theme LIKE '%math' // math appears at the END of the string
关于mysql - SQL 查询中的子字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23703705/