Can someone tell me the correct query for this problem using MIN | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can someone tell me the correct query for this problem using MIN

Football is the most popular sport in the world! Look at the following table named league. Database Table Picture - https://api.sololearn.com/DownloadFile?id=4550 Write a query to output all teams which conceded the least number of goals in the league ordered by scored goals in descending order. My Code - SELECT * FROM league WHERE conceded_goals = 2 ORDER BY scored_goals DESC;

17th Jul 2021, 3:14 PM
Yash Sawant
3 Answers
+ 4
your query looks like it would work. i usually use * for my initial query and as i get closer to the query i like, i replace * with the actual fields, even if i am querying all the columns (personal preference). my take would look something like this: select team ,scored_goals ,conceded_goals from league where conceded_goals=(select min(conceded_goals) from league) order by scored_goals desc;
17th Jul 2021, 3:34 PM
you are smart. you are brave.
you are smart. you are brave. - avatar
+ 2
Thanks Andrew Choi, I was a bit confused with the where query, thanks for explaining it!
17th Jul 2021, 3:59 PM
Yash Sawant
0
Yash Sawant , happy to assist.
17th Jul 2021, 7:32 PM
you are smart. you are brave.
you are smart. you are brave. - avatar