How does mysql query for unique and minimum values?

for example, table a has the following structure:
id score
1 1
2 1
3 2
4 4

I want to query score first unique (do not repeat), (then) and minimum, and the correct result returned id should be 3

so how to write the sql statement? Ask the great god for advice.

May.08,2021

SELECT id, score from table GROUP BY score HAVING COUNT (score) = 1 ORDER BY score LIMIT 1


SELECT id FROM table where score = (select score from table GROUP BY score HAVING COUNT (score) = 1 ORDER BY score LIMIT 1)

Menu