Computed column for simple multiplication?

后端 未结 3 1068
青春惊慌失措
青春惊慌失措 2020-12-22 07:53

I making a simple inventory application. In a table i have columns Quantity, Price and TotalPrice. Which is better, make TotalPrice a Computed Column as Quantit

3条回答
  •  旧时难觅i
    2020-12-22 08:15

    why store a computed column when you can do the computations in the query?

    SELECT (Quantity * Price) as TotalPrice FROM my_table
    

提交回复
热议问题