Jump to content

Archived

This topic is now archived and is closed to further replies.

René H4

database query SQL

Recommended Posts

Well, I don't know databases but I am anqiuos to learn..... ūüôā

I need to find in which products the string "boekje.jpg" is used in the products description.

Is this the correct string to enter in MyPHPAdmin:

SELECT * FROM products_description WHERE products_description LIKE 'boekje.jpg';

 

Share this post


Link to post
Share on other sites

I would add a "%" to the beginning and end of what you're searching for....ie.

'%boekje.jpg%'

Dan

Share this post


Link to post
Share on other sites

I haven't tried it but at the bottom of the search results, there is an export button...at least on the version of MyPHPAdmin  that I'm using.

Dan

Share this post


Link to post
Share on other sites

If you are looking for an exact string, you can just use equals. 

SELECT * FROM products_description WHERE products_description = 'boekje.jpg';

You only need to use LIKE if you are looking for a partial string.  E.g.

SELECT * FROM products_description WHERE products_description LIKE '_oekje%.jpg';

Will match any string that has any first character and then oekje followed by any characters and ending with .jpg .  I would not expect that you'd normally want to put a wildcard at the end of .jpg in an image search.  I would think that something like %boekje%.% would be more common (any image with boekje in it, regardless of extension). 

Documentation:  https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html

Regular expressions:  https://dev.mysql.com/doc/refman/8.0/en/regexp.html


Always back up before making changes.

Share this post


Link to post
Share on other sites

×