+ 3
SQL Chocolate project ISSUE 15.2
Hello, First of all I am trying to complete this in the web browser(PC) and spoiler but I typed: SELECT * FROM desserts WHERE name LIKE "%chocolate"; and it throws up an error: " ERROR: column "%Chocolate" does not exist LINE 2: WHERE name LIKE "%Chocolate"; " so I look at the answer and the only difference is that the example uses '' instead of "" so when I switch to that it doesn't work, but it does give the column names just no values inside
9 Réponses
+ 2
-- Try it
SELECT * FROM desserts
WHERE name LIKE '%Chocolate%';
+ 2
-- In MySQL
desc desserts;
-- or
SHOW COLUMNS FROM desserts;
-- Those describe statements above show the columns in the table and all their attributes
+ 1
I did try your second reply and it didn't query anything earlier when I wrote the post. only returned the attribute names.
however, some reason it works now...#computers
0
Write a query to output the name and year columns of all of the films which were produced by marvel studios in 2010 or later ,sorted by the 'year' column in ascending order
0
SELECT * FROM Desserts
WHERE name LIKE '%Chocolate%'
Sql is case sensitive so please aware with chocolate and Chocolate
0
tyring 3 days the chocolate project, but the code has shown an error. at the end, I find the solution. First, i will show the wrong Code is
SELECT dessert_name, price
FROM desserts
WHERE dessert_name LIKE '%chocolate%';
This code is totally wrong.
The correct code is
SELECT name, price FROM desserts
WHERE name LIKE '%chocolate%';
please make sure the SQL case is sensitive; see the question, then give the output
0
The answer is :
/*
select the dessert name and price
where the name contains 'chocolate'
*/
SELECT name, price
FROM desserts
WHERE name LIKE 'chocolate%';
0
SELECT name, price FROM desserts
WHERE name LIKE '%chocolate%';
0
This thing is still a mess sometimes its working and sometimes is not wth? After couples times of trying the same code it finally accepted
CODE:
SELECT name, price FROM desserts
WHERE name LIKE '%chocolate%'