MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/SQL/comments/16n0v86/is_there_something_wrong_with_this_query/k1doss6/?context=3
r/SQL • u/[deleted] • Sep 19 '23
127 comments sorted by
View all comments
261
You need to change the where condition to be LIKE instead of = and '%chocolate%'
29 u/[deleted] Sep 19 '23 Is there any differences if I put it infront or at the end of the string 164 u/centreewards Sep 19 '23 % works as a wildcard character. In front like '%chocolate' would logically read like 'string ends with chocolate'. 'chocolate%' would be 'starts with'. '%chocolate%' would be equivalent to 'contains' -2 u/Joe59788 Sep 20 '23 This is correct.
29
Is there any differences if I put it infront or at the end of the string
164 u/centreewards Sep 19 '23 % works as a wildcard character. In front like '%chocolate' would logically read like 'string ends with chocolate'. 'chocolate%' would be 'starts with'. '%chocolate%' would be equivalent to 'contains' -2 u/Joe59788 Sep 20 '23 This is correct.
164
% works as a wildcard character. In front like '%chocolate' would logically read like 'string ends with chocolate'. 'chocolate%' would be 'starts with'. '%chocolate%' would be equivalent to 'contains'
-2 u/Joe59788 Sep 20 '23 This is correct.
-2
This is correct.
261
u/jlarm Sep 19 '23
You need to change the where condition to be LIKE instead of = and '%chocolate%'