得到3个人从sql有更高的价值

table name: dataclass

i have a table look like at the top. i want to show the 3 students that have higher value, i have tried command

$higher= mysqli_query($connection, "SELECT * from dataclass ORDER BY score ASC LIMIT 3");

but the result is only show 3 with random score,

could you help me?

You need to sort the results from highest to lowest, but you are doing the opposite as for now.

Change your code to:

$higher= mysqli_query($connection, "SELECT * from dataclass ORDER BY score DESC LIMIT 3");

Note that DESC means you are sorting from highest to lowest. Also make sure you column "score" is of a type INT, FLOAT or DOUBLE!

Use Desc

SELECT * from dataclass ORDER BY score DESC LIMIT 3

this one if you have a data with same name and you need it dictincly with no duplicate.

select * from dataclass  group by name ORDER BY score desc limit 3