分类广告项目规范的数据库设计

时间:2022-10-03 23:25:52

I'm working on a classified ads site with 12 categories. E.g. category vehicles has items cars, bikes, Commercial Vehicles and spare parts. The following is a flow diagram for posting an ad:

我正在开发一个有12个类别的分类广告网站。例如。类别车辆有汽车,自行车,商用车辆和备件。以下是发布广告的流程图:

分类广告项目规范的数据库设计

I need to show the specification in the Form Filled section of the above image to the users in dropdown lists in the form when they are posting an advertisement. The car specification will be its color,engine,fuel type.

我需要在发布广告时向表格中下拉列表中的用户显示上面图像的表单填写部分中的规范。汽车规格将是它的颜色,发动机,燃料类型。

The ERD is below :

ERD如下:

分类广告项目规范的数据库设计

How should this issue be tackled, what are the best practices and is the current design going along the right lines?

如何解决这个问题,最佳做法是什么,目前的设计是否正确?

4 个解决方案

#1


0  

i agree look at EAV models...

我同意看EAV模型......

for some other tables, you have many normalization issues - for example:

对于其他一些表,您有许多规范化问题 - 例如:

  • you should have a separate address table (not part of the ad)
  • 你应该有一个单独的地址表(不是广告的一部分)

  • you should have a picture table (and link those to the ads with another table)
  • 你应该有一个图片表(并用另一个表链接到广告)

  • you should have a person table - and link that to the ad as 'owner'
  • 您应该有一个人员表 - 并将其作为“所有者”链接到广告

  • the idea of 'favorite' should also be in this person->ad relationship table as a role or type column
  • “收藏”的概念也应该在此人 - >广告关系表中作为角色或类型列

#2


2  

On the whole this looks ok. Here are some observations:

总的来说这看起来不错。以下是一些观察:

  1. likes.iker_id should point at users.id? Just trying to understand your model to start.
  2. likes.iker_id应该指向users.id?只是想了解你的模型开始。

  3. I would probably change the pics table to be one pic per row and then add an ordinal for ordering.
  4. 我可能会将pics表更改为每行一张图片,然后添加序号以进行排序。

  5. One question here is how you intend to look at your graph model. As it is, you might have a graph that could be traversed easily to a depth, a couple deep. I assume you are doing this to recommend ads. If so, I think this is sufficient. If not it would be good to further discuss which rdbms you are targetting.
  6. 这里的一个问题是你打算如何看待你的图模型。实际上,您可能有一个图表可以轻松遍历深度,深度。我假设您这样做是为了推荐广告。如果是这样,我认为这就足够了。如果不是,那么进一步讨论你所针对的rdbms会更好。

#3


1  

Hope this helps:
In a simplified case, you will need some extra tables.

分类广告项目规范的数据库设计

希望这会有所帮助:在简化的情况下,您将需要一些额外的表格。

#4


1  

So, you are trying to be able to have different specifications for different items in your categories? Or, in other words, it is like having different attributes for different types of products in an e-commerce website.

那么,您是否尝试为类别中的不同项目设置不同的规格?或者,换句话说,它就像在电子商务网站中具有不同类型产品的不同属性。

If that the problem you are tackling, then you should look into the Entity–Attribute–Value (EAV) model that is how the problem is solved. By the way, one of the most popular open source e-commerce engines uses it as well.

如果您正在处理问题,那么您应该查看问题解决方法的实体 - 属性 - 值(EAV)模型。顺便说一下,最流行的开源电子商务引擎之一也使用它。

分类广告项目规范的数据库设计

#1


0  

i agree look at EAV models...

我同意看EAV模型......

for some other tables, you have many normalization issues - for example:

对于其他一些表,您有许多规范化问题 - 例如:

  • you should have a separate address table (not part of the ad)
  • 你应该有一个单独的地址表(不是广告的一部分)

  • you should have a picture table (and link those to the ads with another table)
  • 你应该有一个图片表(并用另一个表链接到广告)

  • you should have a person table - and link that to the ad as 'owner'
  • 您应该有一个人员表 - 并将其作为“所有者”链接到广告

  • the idea of 'favorite' should also be in this person->ad relationship table as a role or type column
  • “收藏”的概念也应该在此人 - >广告关系表中作为角色或类型列

#2


2  

On the whole this looks ok. Here are some observations:

总的来说这看起来不错。以下是一些观察:

  1. likes.iker_id should point at users.id? Just trying to understand your model to start.
  2. likes.iker_id应该指向users.id?只是想了解你的模型开始。

  3. I would probably change the pics table to be one pic per row and then add an ordinal for ordering.
  4. 我可能会将pics表更改为每行一张图片,然后添加序号以进行排序。

  5. One question here is how you intend to look at your graph model. As it is, you might have a graph that could be traversed easily to a depth, a couple deep. I assume you are doing this to recommend ads. If so, I think this is sufficient. If not it would be good to further discuss which rdbms you are targetting.
  6. 这里的一个问题是你打算如何看待你的图模型。实际上,您可能有一个图表可以轻松遍历深度,深度。我假设您这样做是为了推荐广告。如果是这样,我认为这就足够了。如果不是,那么进一步讨论你所针对的rdbms会更好。

#3


1  

Hope this helps:
In a simplified case, you will need some extra tables.

分类广告项目规范的数据库设计

希望这会有所帮助:在简化的情况下,您将需要一些额外的表格。

#4


1  

So, you are trying to be able to have different specifications for different items in your categories? Or, in other words, it is like having different attributes for different types of products in an e-commerce website.

那么,您是否尝试为类别中的不同项目设置不同的规格?或者,换句话说,它就像在电子商务网站中具有不同类型产品的不同属性。

If that the problem you are tackling, then you should look into the Entity–Attribute–Value (EAV) model that is how the problem is solved. By the way, one of the most popular open source e-commerce engines uses it as well.

如果您正在处理问题,那么您应该查看问题解决方法的实体 - 属性 - 值(EAV)模型。顺便说一下,最流行的开源电子商务引擎之一也使用它。

分类广告项目规范的数据库设计