How many unique primary activity id are in the establishment table for each state?
SELECT state, COUNT(DISTINCT primary_economic_activity_id) FROM establishment GROUP BY state;
AC, 3; AL, 13; AM, 9; AP, 5; BA, 36; CE, 20; DF, 15; ES, 21; EX, 3; GO, 28; MA, 21; MG, 75; MS, 10; MT, 17; PA, 21; PB, 15; PE, 20; PI, 5; PR, 55; RJ, 62; RN, 7; RO, 8; RR, 1; RS, 48; SC, 37; SE, 10; SP, 149; TO, 6