- 1
Please anyone help me out to solve the below SQL query!!!
Write a query to output all teams which conceded the least number of goals in the league ordered by scored goals in descending order.
7 Réponses
+ 16
try this
SELECT * FROM league
WHERE conceded_goals = (SELECT MIN(conceded_goals) FROM league)
ORDER BY scored_goals DESC;
+ 2
SELECT teamname,country
FROM teams
WHERE country IN('Germany','England','Spain')
0
I get various non-descript errors on this one too. I can't figure our where my problem is. Any clues?
select team, scored_goals, (Min(conceded_goals)) from league
Order by scored_goals;
Returns the following error: ERROR: column "league.team" must appear in the GROUP BY clause or be used in an aggregate function
0
I feel SoloLearn does not do a good job conveying how to string all these phrases together. Especially as a first timer with no previous experience it can be very difficult to get a grasp on something if it is not being conveyed clearly. There seems to be a lot of assumption that being told the bare minimum will suffice but it is quite the contrary for a new student to SQL. Earlier sections were easy but I do not recall being taught how to string everything together after each section. Wish this app was more intuitive for newbies..
- 1
SELECT * FROM league
WHERE conceded_goals = (SELECT MIN(conceded_goals) FROM league)
ORDER BY scored_goals DESC;
- 3
Post your code first
- 5
Select team, scored_goals,min(conceded_goals) as as conceded_goals from league
ORDER by scored_goals DESC;