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

15th Sep 2024, 2:42 PM
Danielle Strahan
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 )
15th Sep 2024, 8:26 PM
BroFar
BroFar - avatar
+ 4
Danielle Strahan please show us your attempt and provide details to what is being asked ...
15th Sep 2024, 4:19 PM
BroFar
BroFar - avatar
+ 1
show us your attempt
15th Sep 2024, 4:19 PM
Mihaly Nyilas
Mihaly Nyilas - avatar
+ 1
Thank you BroFar
15th Sep 2024, 11:41 PM
Danielle Strahan
+ 1
You're welcome Danielle Strahan
15th Sep 2024, 11:52 PM
BroFar
BroFar - avatar
0
SELECT nickname, score FROM Scores WHERE score=( SELECT MAX (score) AS best FROM Scores ) GROUP BY nickname, score ORDER BY score DESC
15th Sep 2024, 8:00 PM
Danielle Strahan
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.
15th Sep 2024, 9:01 PM
Facundo Areo Sanchez
Facundo Areo Sanchez - avatar