How to conditionally handle division by zero with MySQL

前端 未结 7 833
春和景丽
春和景丽 2020-12-28 16:01

In MySQL, this query might throw a division by zero error:

SELECT ROUND(noOfBoys / noOfGirls) AS ration
FROM student;

If noOfGirls

7条回答
提交回复
热议问题