0
Sql like operator
Please kindly help me to solve query with Like operator. In the case of extraction of compounds noun with the like operator, how should I write the code? For instance, I want to select any words with chocolate from the table, chocolate pudding, flourless chocolate cake and easy chocolate covered Oreos, etc...
22 Answers
+ 8
select * from desserts where name like '%Chocolate%';
try this it will work.
+ 6
Use LIKE in the WHERE clause of the SELECT query. Your query would resemble the following pattern:
SELECT description FROM recipes WHERE description LIKE '%chocolate%';
The percent % symbol is a wildcard metacharacter that tells LIKE to match any character or characters before and after 'chocolate'.
+ 5
%Chocolate%
+ 4
Irshad shaikh ,
read both posts done by Brian.
+ 3
Esther YU ,
i assume that you are talking about the sololearn in-lesson code coach in sql tutorial. in this case you need to spell it like this: '... %Chocolate%', since the names of the deserts in the table starts with an uppercase letter...
+ 1
Thank you for the advice! I could solve the query😊
+ 1
Esther YU '%chocolate' matches all strings that end with 'chocolate'. In this exercise you also need to match strings that have 'chocolate' at the beginning and the middle. So use the wildcard (%) at both ends.
+ 1
It works when i put this
select * from desserts
where name LIKE '%c%';
Which i think is incorrect? Since we’re told to ONLY get results with chocolate and there are two other items on the table containing the letter ‘c’ which do not contain chocolate… is this one bugged??
+ 1
select name,price from desserts where name LIKE '%Chocolate%';
you have to specify the column name instant of *
+ 1
select name,price from desserts where name like '%chocolate%';
try this I get Answer
0
in SQL tutorial,can anybody help me to correct this query
You are having dinner at a restaurant and decide to order a chocolate dessert.
Here is the desserts menu:
Write a query to output only chocolate desserts.
SELECT * FROM desserts where name LIKE 'Chocolate';
error i am getting is No input
0
select * from desserts
where name like '%chocolate%';
I tried this but still showing as error. What is incorrect here?
0
Josh Playing Games Sololearn's DB engine is configured to be case sensitive. Chocolate needs to be capitalized.
0
select * FROM desserts
WHERE name LIKE '%Chocolate
0
select name, price from desserts
where name LIKE '%Chocolate%';
0
SELECT * FROM desserts
WHERE name LIKE '%Chocolate%';
0
Dont forget to write chocolate with upper C
SELECT * FROM desserts
where name like '%Chocolate%';
0
SELECT name,price
FROM desserts
WHERE name LIKE 'chocolate%'
0
Select name, price
From desserts
where name like '%chocolate%'
- 1
🤔 are you saying you want to extract noun from a sentence using sql like operator 🙀