【发布时间】:2014-05-26 07:58:53
【问题描述】:
我是设计数据库的新手,我的表格包含大量计算数据。
劳动表
table columns | formula
labor_code
job_desc
hourly_wage
daily_wage = hourly_wage * 8
monthly_wage = hourly_wage * 208
benefit_1 = daily * ( 5/12)
benefit_2 = monthly_wage / 12
benefit_3 = there is a range of monthly_wage for a specific value to this
benefit_4 = value given by the user
benefit_5 = value given by the user
total_hourly_rate = hourly_wage + benefit_(1-5)
total_daily_rate = total_hourly_rate * 8
total_monthly_rate = total_hourly_rate * 208
材料表
table columns | formula
material_code
material_desc
brand
unit
base_price = user input
hauling_cost = user input
labor_code
labor_type = its either ful or basic
labor_rate = if labor type == ful ? labor_rate = labor.hourly_wage : labor.total_hourly_rate
total_price = base_price + hauling_cost + labor_rate
鉴于上面的表格,应用程序的未来规格也将包含表格,计算数据将基于上面的值。
我想知道将所有数据(包括计算数据)保存到数据库中的更好方法,还是我应该在检索数据后以编程方式保存预先计算的数据和计算数据(即 total_hourly_rate )?
如果我的问题不清楚,请发表评论,以便我解决。
【问题讨论】:
标签: mysql database-design