Question: What is the percentage distribution on how the respondents learn to code?
SQL:
SELECT LearningToCodeMethods.name, COUNT(LearningToCodeMethods.id) * 100.0 / (SELECT COUNT(DISTINCT Response_id) FROM Response_LearningToCodeMethods) FROM LearningToCodeMethods JOIN Response_LearningToCodeMethods ON LearningToCodeMethods.id = Response_LearningToCodeMethods.LearningToCodeMethods_id GROUP BY LearningToCodeMethods.id
SELECT LearningToCodeMethods.Name, COUNT(*) * 100.0 / (SELECT COUNT(*) FROM Responses) AS Percentage FROM Response_LearningToCodeMethods JOIN LearningToCodeMethods ON Response_LearningToCodeMethods.LearningToCodeMethods_id = LearningToCodeMethods.id GROUP BY LearningToCodeMethods.Name