3 ms·
Does it? Under SQL standard or what engine? At least Postgres raises when dividing by zero.
by kaoD 2y ago
Does it? Under SQL standard or what engine? At least Postgres raises when dividing by zero.
- alganet 2y agoYou're right about division by zero. From SQL92: 4) The dyadic arithmetic operators <plus sign>, <minus sign>, <as- terisk>, and <solidus> (+, -, *, and /, respectively) specify addition, subtraction, multiplication, and division, respec- tively. If the value of a divisor is zero, then an exception condition is raised: data exception-division by zero. However, the "any operation involving NULL yields NULL" is standard: 1) If the value of any <numeric primary> simply contained in a <numeric value expression> is the null value, then the result of the <numeric value expression> is the null value. https://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt https://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt So, dividing by NULL is allowed and yields NULL. Dividing by zero yielding NULL is non-standard (I used it though).