您如何设计表格以处理即将发生的活动的注册表和价格?
如下表所示:
+-----------------------------+-------------------+----------------+--------------+
| Occupation/Level | Optional Item | Base Price | Early Bird Price |
+-----------------------------+-------------------+------------+------------------+
| Residents | | $1000 | $800 |
+--------------------------------------------------------------+------------------+
| Practitioners | Exam Prep (+$500) | $1500 | $1300 |
+--------------------------------------------------------------+------------------+
| OBYGN Consultant - Friday | | $800 | $900 |
| OBYGN Consultant - Saturday | | $800 | $900 |
| OBYGN Consultant - Sunday | | $600 | $700 |
| OBYGN Consultant - All Days | | $1900 | $2100 |
+-----------------------------+-------------------+------------+------------------+
我的最初想法是使其非常简单,并分别对待每行并存储金额。 OBGYN顾问可以选择的日期只是成为表中的另一行。
+----+---------------------------+----------------+------------------+
| ID | Occupation/Level | Base Price | Early Bird Price |
+----+---------------------------+----------------+------------------+
| 1 | Residents | $1000 | $800 |
| 2 | Practitioners | $1500 | $1300 |
| 4 | OBYGN_Consultant_Friday | $800 | $900 |
| 5 | OBYGN_Consultant_Saturday | $800 | $900 |
| 6 | OBYGN_Consultant_Sunday | $600 | $700 |
| 7 | OBYGN_Consultant_All_Days | $1900 | $2100 |
+----+---------------------------+----------------+------------------+
optional_materials 表将处理所有具有其他选项的课程。
+----+----------+-----------+--------+
| ID | CourseID | Name | Amount |
+----+----------+-----------+--------+
| 1 | 2 | Exam Prep | $500 |
+----+----------+-----------+--------+
看到此设计有任何重大问题,还是看到一种更好的处理方法?
答案 0 :(得分:2)
取决于您将来的灵活性。例如,如果您想明年获得超早鸟价,或者您将支持其他货币,那么我会这样:
+----+----------+---------------------------+------------+-------+----------+
| ID | CourseID | Title | Price Type | Price | Currency |
+----+----------+---------------------------+------------+-------+----------+
| 1 | 1 | Residents | Base | 1000 | Dollar |
| 2 | 1 | Residents | Early | 800 | Dollar |
| 3 | 2 | Practitioners | Base | 1500 | Dollar |
| 4 | 2 | Practitioners | Early | 1300 | Dollar |
| 5 | 4 | OBYGN_Consultant_Friday | Base | 800 | Dollar |
| 6 | 4 | OBYGN_Consultant_Friday | Early | 900 | Dollar |
| 7 | 5 | OBYGN_Consultant_Saturday | Base | 800 | Dollar |
| 8 | 5 | OBYGN_Consultant_Saturday | Early | 900 | Dollar |
| 9 | 6 | OBYGN_Consultant_Sunday | Base | 600 | Dollar |
| 10 | 6 | OBYGN_Consultant_Sunday | Early | 700 | Dollar |
| 11 | 7 | OBYGN_Consultant_All_Days | Base | 1900 | Dollar |
| 12 | 7 | OBYGN_Consultant_All_Days | Early | 2100 | Dollar |
+----+----------+---------------------------+------------+-------+----------+
但是总的来说,您的方法是完全有效的。
还考虑在最后添加“创建”和“编辑”日期字段。使保持数据更改的透明度更加容易(也许您想突出显示仅可用或在过去14天左右的时间里已更改的选项)