Answers for "SQL Integer devision"

SQL
1

SQL Integer devision

-- When performing division operations on integer values, 
-- the results will always be integers and the results 
-- may not always be what you expect.

SELECT 1 / 2; --> Result: 0
SELECT 1.0 / 2; --> Result: 0.5
SELECT CAST(1 AS REAL) / 2; --> Result: 0.5
SELECT 17 / 5; --> Result: 3
SELECT 17 % 5; --> Result: 2

-- Remember, these are integers and so the result will 
-- be an integer and 1.0 is not an integer.
Posted by: Guest on November-24-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language