Why are the output different in SQL Server and the same in Oracle?

Why is the output below the two queries different in SQL Server and the same in Oracle?

SELECT 20.0/-2.0/5

SELECT 20/(-2.0)/5
+5
source share
1 answer

I do not agree with your statement that the conclusion should be the same.
If you ask me what the result will be 20 / -2 / 5, I will answer you that it can output -2 or -50, depending on the implementation details.

Oracle, , , , '*' '/' '+' '-', . , - "*" "/" . -2, , , .

SQL Server ,

, .

, :

20/2/5 = (20/2)/5 = 2

20/-2/5 = 20/(-2/5) = -50

20/(-2)/5 = (20/-2)/5 = -2

, , .

, Undefined, .
.

+4

All Articles