I\'m trying to understand what this query does exactly:
SELECT DISTINCT `state`, `state_name` FROM `geo` ORDER BY `state_name` ASC
All I\'m
DISTINCT will return only distinct rows, so:
Is my query checking both columns for uniqueness or just state?
Both columns
You could also switch to GROUP BY instead.
SELECT `state`, `state_name` FROM `geo` group by 'state', 'state_name' ORDER BY `state_name` ASC
It's checking for unique combinations of state and state_name. Distinct operates on all columns included in your select list.
To only include unique state values, just select distinct state