为购物车应用程序设计数据库? [英] design a database for a shopping-cart application?

查看:371
本文介绍了为购物车应用程序设计数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从来没有从头开始设计数据库/数据模型/模式,特别是对于web应用程序。
在最近的一些工作面试中,我被要求为购物车应用程序设计数据库。现在我正在开发一个移动购物应用程序(零售,使用phonegap)与后端,需要存储和处理产品和订单信息。这个问题的规模是如此巨大,我不知道从哪里开始。我希望得到一些建议 -


  1. 我应该如何处理这样的问题(购物车应用程序数据库)?

  2. 我应该在什么样的优化/效率模式中记住这一点?设计这样的DB?

  3. 我应该如何识别问题空间(产品,订单等)中的实体?我应该如何得出他们之间的关系?

  4. 当面试官问这样一个问题,他究竟是在寻找什么?是有什么我应该/不应该说?

我还应该澄清 -


  1. 是的,我是一个noob,我的动机是学习数据库设计和准备即将到来的工作面试。我已经阅读了DBMS书,他们详细描述了个别的概念,但我不知道如何把这些东西放在一起,开始设计一个数据库。

  2. 我看到了其他线程的数据库设计。作者已经倾向于拥有一些关于如何解决问题的知识。我想了解这样做的方法。

  3. 链接到外部资源,评论,建议和任何会使我在正确的轨道,非常感谢。

数据库中可以有五个表:


CATEGORY 此表存储有关您的商店和类别层次结构的产品类别的信息。
此表存储的父字段父类别的ID。


PRODUCT :您商店的所有产品都存储在此表格中。此表格有一个外键categoryID,用于标识产品所属类别的ID。


ORDER 此表格存储有关您的


ORDERED_SHOPPING_CART 表与PRODUCT和ORDER表紧密相关;

SPECIAL_OFFER 表包含产品列表,这些列表在主页上显示为特殊优惠

>

I have never designed a database/data-model/schema from scratch, especially for a web-application. In some recent job interviews, i was asked to 'design' a database for a shopping cart application. Now i am working on a mobile shopping application (retail, uses phonegap) with a backend that needs to store and process product and order info. The scale of this problem is so huge, i don't know where to start. I was hoping for some advise on -

  1. How should I approach such a problem (shopping cart application DB) ? where should i start ?
  2. Are there any common mistakes/pitfalls that i should avoid ?
  3. What optimization/efficiency paradigms should i keep in mind when designing such a DB ?
  4. How should i go about identifying entities in the problem space (products, orders, etc)? how should i derive the relationships between them ?
  5. When a interviewer asks such a question, what exactly is he looking for ? is there something i should/should not say ?

I should also clarify that -

  1. Yes, I am a noob, and my motives are to learn database design AND prepare for upcoming job interviews. I have read DBMS books where they describe individual concepts in detail, but i have no clue how to put those things together and start designing a database.
  2. I have seen other threads on database design. The authors already tend to posses some knowledge on how to break the problem down. i would like to understand the methodology behind doing that.
  3. Links to outside resources, comments, suggestions and anything that will put me on the right track is much appreciated. I hope this thread serves as a learning experience for myself and others.

解决方案

There can be five tables in database:

CATEGORY this table stores information about products categories of your store and categories hierarchy.
parent field of this table stores ID of the parent category.

PRODUCT all products of your store are stored in this table. This table has a foreign key categoryID which identifies ID of the category to which a product belongs.

ORDER this table stores information about all orders made by visitors of your store.

ORDERED_SHOPPING_CART table is tightly connected with PRODUCT and ORDER tables; stores information on customers' orders content.

SPECIAL_OFFER table contains a list of products, which are shown on home page as special offers

这篇关于为购物车应用程序设计数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆