Question 7 New York Restaraunts

Why do I need to use “like” in the statement:

WHERE name like ‘%meatball%’;

I thought that the % on both ends of meatball alread accomplished that task for me?

The ‘%___ %’ finds that value in any position.

Ex:

WHERE name LIKE 'J%' will find any values that start with “J”

WHERE name LIKE '%J' will find any values that end with J.

etc.
https://www.tutorialspoint.com/sql/sql-like-clause.htm

1 Like

im more concerned about using the like statement why cant i write WHERE name is ‘%meatball%’?

Did you try it? What happened?

What lesson is this? is there a link?

This is interesting reading:
https://stackoverflow.com/questions/3353084/sql-efficiency-vs-in-vs-like-vs-matches#3353097