Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

database query SQL


René H4

Recommended Posts

Posted

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';

 

Posted

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.

Archived

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

×
×
  • Create New...