Question: Which percentage of respondents have visited which Stack Overflow site?
SQL:
SELECT NEWSOSites.name, COUNT(*) * 100.0 / (SELECT COUNT(DISTINCT Response_id) FROM Response_NEWSOSites) FROM NEWSOSites JOIN Response_NEWSOSites ON Response_NEWSOSites.NEWSOSites_id = NEWSOSites.id GROUP BY NEWSOSites.id
SELECT NEWSOSites.Name, COUNT(*) * 100.0 / (SELECT COUNT(*) FROM Responses) AS Percentage FROM Response_NEWSOSites JOIN NEWSOSites ON Response_NEWSOSites.NEWSOSites_id = NEWSOSites.id GROUP BY NEWSOSites.Name