Question: How much is each OS used professionally and non-professionally?
SQL:
SELECT OperatingSystems.name, COUNT(OperatingSystems.id) * 100.0 / (SELECT COUNT(DISTINCT Response_id) FROM "Response_OpSysPersonalUse"), count2 FROM OperatingSystems JOIN "Response_OpSysPersonalUse" ON OperatingSystems.id = "Response_OpSysPersonalUse"."OperatingSystems_id" JOIN (SELECT "OperatingSystems".name AS name2, COUNT("OperatingSystems".id) * 100.0 / ((SELECT COUNT(DISTINCT Response_id) FROM "Response_OpSysProfessionalUse")) AS count2 FROM "OperatingSystems" JOIN "Response_OpSysProfessionalUse" ON "OperatingSystems".id = "Response_OpSysProfessionalUse"."OperatingSystems_id" GROUP BY "OperatingSystems".id) ON OperatingSystems.name = name2 GROUP BY OperatingSystems.id