Write a query to sort the cakes by calorie and select the first 3 cakes from the list to offer the customer. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Write a query to sort the cakes by calorie and select the first 3 cakes from the list to offer the customer.

Apple cake =100,banana cake = 200 ,pound cake =180 ,sponge cake = 100 ,genoise cake =360 ,chiffon cake=250,Opera cake = 290 and cheesecake = 370. This are the calerious .You all have to find out the least calorie cake showing on the the top of table then the calorie little higher than it in a ascending order.Use Order By and Limit keywords for it.

9th Jul 2021, 4:56 AM
Abhijeet Mandal
Abhijeet Mandal - avatar
4 Answers
0
provide your code attempt and accurate informations about the task and the problem you're facing in the description field ^^
9th Jul 2021, 4:58 AM
visph
visph - avatar
0
SELECT name, calories FROM cakes ORDER BY calories LIMIT 3;
5th Oct 2021, 12:55 PM
Fatemeh Afsahhosseini
Fatemeh Afsahhosseini - avatar
- 1
you've updated your question with the data, but there's no code attempt, nor table name ;P
9th Jul 2021, 6:06 AM
visph
visph - avatar
- 2
you must write a SQL query such as: SELECT column_name(s) FROM table_name ORDER BY column_name LIMIT 3 for column_name(s) you can select all by using * or provide column names comma separated if you want only some, and use table name instead of table_name... review your lesson(s), if needed ^^
9th Jul 2021, 6:15 AM
visph
visph - avatar