Question: How many German developers have which employment status in percent?
SQL:
SELECT Employment.name, COUNT(Response_Employment.Response_id) * 100.0 / (SELECT COUNT(DISTINCT Response_Employment.Response_id) FROM Response_Employment JOIN Responses ON Responses.id = Response_Employment.Response_id WHERE Responses.Country = 'Germany') FROM Response_Employment JOIN Employment ON Employment.id = Response_Employment.Employment_id JOIN Responses ON Responses.id = Response_Employment.Response_id WHERE Responses.Country = 'Germany' GROUP BY Employment.id
SELECT Employment.Name, COUNT(*) * 100.0 / (SELECT COUNT(*) FROM Responses WHERE Country = 'Germany') AS Percentage FROM Responses JOIN Response_Employment ON Responses.id = Response_Employment.Response_id JOIN Employment ON Response_Employment.Employment_id = Employment.id WHERE Responses.Country = 'Germany' GROUP BY Employment.Name