我不知道如何为商店设计mysql数据库。
这个场景是针对一个出售导游的网站。
每一次旅行都可以是私人的,半私人的,也可以是集体的。每人的价格每种旅游类型都有变化。但对于私人旅行团,每人的价格也因人数而异。然而,它因不同的旅游金额而有所不同。如何创建“旅游/产品”记录?
例如,假设:
梵蒂冈之旅(旅游有各种数据-名称、描述、会面地点、持续时间等)。半私人旅游每人50欧元。团体赛每人45欧元。私人旅游费用(1至2人140欧元),3人180欧元,4人200欧元,5人225欧元,6人240欧元,或7人以上,每人43欧元。然而,对于竞技场巡回赛(旅游有相同的数据位-名称,描述,会面点,持续时间等),半私人费用每人40。每人25英镑。私人旅游费用(1至2人100欧元),3人135欧元,4人160欧元,5人175欧元,6人180欧元,或7人以上,每人25欧元。
如何构造数据库中的数据-2个表?3个表?
完全迷茫..。
谢谢
汤姆
发布于 2014-07-24 11:47:25
据我从你的帖子中了解到,价格的变化取决于三种不同的因素:
由于在任何给定的选项中,每个人都没有确切的(固定)价格,所以我会采用三表法。
图中详细介绍了迪卡拉姆,并在下列假设下工作:
- A tour can have multiple price options (1 to many relationship)
- An price option can have just one single tour type (1 to 1 relationship)
如何对此进行编码:
- **Create a new tour:** a function which inserts in to the database a new entry in the tour table.
- **Get the id of the recently created tour:** if there is only one person adding information at any given time, then there is a good bet to write a function that returns the id of the latest added tour.
- **Add pricing options based on the id\_tour:** insert a new price option based on the id\_tour variable. Remember to assign a tour\_type from one of the already predefined categories.
需要研究的其他事情:Dynamic Forms --当您不知道管理员可能想为特定的旅游添加多少价格选项时,它们将帮助您。
https://stackoverflow.com/questions/24906690
复制相似问题