I’m new to SQL thus the question. I’m trying to query the following. Given the CITY and COUNTRY tables, query the names of all the continents (COUNTRY.Continent) and their respective average city populations (CITY.Population) rounded down to the nearest integer. The table schemas are City: id, name, countryside, population I’ve written the inner join, but can’t seem to figure out
Tag: rounding
SQL Server: round decimal number and convert to int (within Select)
I am using the following line within a Select which returns a number with decimals, e.g. 33.33333. How can I round this within the Select and convert to integers so that I don’t have decimals, e.g. in the above example it should return 33 ? Answer You can use ROUND function to round the value to integer: This will retain
How can I round a decimal to the nearest even number in SQL?
I need to round a decimal in a sql query on Oracle 10g to the nearest even number. If the number is even, it should be returned. If the number is odd, the next even number should be returned. This is what I want: 8.05 should return 8.06, 3.48 should return 3.48 How can I do this? Thanks, Andrew Answer