Medium · Formula 1 · Tables: circuits, races
Across the full dataset, count distinct circuits that have hosted a recorded race and the number of race rows in each non-NULL country. Keep countries with at least three such circuits. Circuits without race rows do not count. Return columns country, circuits, races, in that order. Order by circuits descending, then races descending, then country ascending. All source columns have TEXT affinity: cast numeric inputs before numeric comparisons or calculations. Counts and calculated numeric outputs must be numbers, not text.