0
Can't figure out SQL code
I'm having problem completing a pratice SQL code for SQL Intermediate Course it on the 1st unit Lesson 3 at the very end of the lesson. It's like I'm stuck in a loop it tells me to do one thing then I do it and it tells me to try another round and round I go for 2 days now. Any and all he is greatly appreciated SELECT nickname, score FROM Scores WHERE score=( SELECT MAX (score) AS best FROM Scores ) GROUP BY nickname, score ORDER BY score DESC
7 Respuestas
+ 2
Danielle Strahan it is
SELECT nickname, max(score) as best
FROM scores
GROUP By nickname
ORDER By best DESC
You went a tad bit off course with adding the WHERE score=()
Then the GROUP By you added score and the ORDER By is by best not score in DESC ( descending order )
+ 4
Danielle Strahan please show us your attempt and provide details to what is being asked ...
+ 1
show us your attempt
+ 1
Thank you BroFar
+ 1
You're welcome Danielle Strahan
0
SELECT nickname, score
FROM Scores
WHERE score=(
SELECT MAX (score) AS best
FROM Scores )
GROUP BY nickname, score
ORDER BY score DESC
0
El objetivo de tu consulta parece ser obtener los apodos y las puntuaciones más altas de la tabla "Scores". Sin embargo, el uso de `GROUP BY` no es necesario aquí si solo quieres obtener las puntuaciones máximas. Además, la cláusula `WHERE` puede simplificarse. Intenta con esta versión:
```sql
SELECT nickname, score
FROM Scores
WHERE score = (SELECT MAX(score) FROM Scores)
ORDER BY nickname;
```
Esta consulta selecciona los apodos y las puntuaciones de la tabla "Scores" donde la puntuación es igual a la máxima puntuación encontrada en la misma tabla. Luego, ordena los resultados por el apodo.