SQL. How to divide the values ​​of one column by the values ​​of another in sql to get a new calculated value?

  • Do not believe the division mark, usually depicted as a slash. столбец1 / столбец2 - Mike

1 answer 1

 select t.dividend ,t.divisor ,CAST(t.dividend as FLOAT) / CAST(t.divisor as FLOAT) as result from your_table t 
  • And the ghost to FLOAT type of one of the values ​​does not need to be done if they are both INT? - iluxa1810
  • @ iluxa1810, I agree. Corrected. - Sanek Zhitnik