- 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.
4 Answers
0
provide your code attempt and accurate informations about the task and the problem you're facing in the description field ^^
0
SELECT name, calories
FROM cakes ORDER BY calories LIMIT 3;
- 1
you've updated your question with the data, but there's no code attempt, nor table name ;P
- 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 ^^