The easiest way to display decimal output for integer column type is to divide the column or expression by 1.0 in sql query. Here is an example:

select avg(income/1.0),vendor_id from daily_income group by vendor_id

Here “income” is of type “int”. The output includes 6 digits after decimal.

Another example:

select income_real/1.0,income_int/1.0,id from test1 (income_real is of type real,income_int is of type int)

test1 table has two rows as displayed below from above SQL query:

(No column name)    (No column name)    id
1    1.000000    ALI
2.5    2.000000    JOHN

Database table entry for above output is a below:

income_real    income_int    id
1                          1                      ALI
2.5                      2                     JOHN

 

Advertisements