+ 3

Bug in SoloLearn Pro SQL Lessons Problem 14.2 ??

Good day I have a question for pro Solo learn Users who took the SQL lessons and attempted the subqueries lesson problem 14.2 I am trying to solve problem 14.2 (Let’s get fit) from the soloLearn subquery challenges where I have to return the foods whose fat percentage is lower than the average fat percentage. I wrote this query: SELECT name, category, price, fatpercentage FROM Food WHERE fatpercentage < (SELECT AVG(fatpercentage) FROM Food) Notice that the exercise specifies that the table name starts with a capital F instead of a lowercase f like all the other table names in the previous exercises. When I run the query, I get an error message that says ERROR: Relation “food” does not exist LINE 1: SELECT name, category, price, fatpercentage FROM Food *(And a cursor pointing to the capital F in Food table name)* I suspect either this is a bug and the table name must me renamed to lowercase “food” internally, or my query is horribly bad. I’ve tried just selecting everything as well from the “Food” table. Even tried changing the F to lowercase (“food”) But seem to get the same message. Am I the only one experiencing this? Or is my query horribly wrong??

7th Jan 2021, 6:30 PM
Jonathan Acevedo
Jonathan Acevedo - avatar
6 Answers
+ 3
SELECT * FROM Foods WHERE fatpercentage < (SELECT AVG(fatpercentage) FROM Foods);
18th Jan 2022, 8:49 PM
OLEH MOROZ
OLEH MOROZ - avatar
+ 1
SELECT *FROM Foods WHERE fatpercentage < (SELECT AVG(fatpercentage) FROM Foods); Try this
25th Jun 2021, 4:49 AM
Akuthota Hemanth
0
I tried SELECT * FROM Food; SELECT * FROM food; SELECT * FROM FOOD; SELECT * FROM `Food`; SELECT * FROM 'Food' ; None of these seem to work, So I guess Food doesn't exist..
9th Jan 2021, 4:51 AM
$hardul B
$hardul B - avatar
0
I guess the problem is you are using the table name "FOOD" and not "FOODS" Now they have changed the name of the table to products SELECT * FROM products WHERE fatpercentage < (SELECT AVG(fatpercentage) FROM products) order by fatpercentage try this
30th Mar 2023, 1:52 PM
Anurag John Phillips
Anurag John Phillips - avatar
0
In today's fast-paced world, finding time to prioritize fitness can be a challenge. However, with the rise of virtual personal trainers, achieving your health and fitness goals has never been more accessible. These digital fitness coaches offer personalized training experiences, bringing the gym directly to you, wherever you may be. https://nystrong.com/
7th Feb 2024, 10:31 AM
williamanderson
- 1
SELECT *FROM Foods WHERE fatpercentage < (SELECT AVG(fatpercentage) FROM Foods); try this one done
16th Apr 2022, 12:55 PM
RATHIS KUMAR R