如何在mysql中为采购订单创建数据库请给我一些好的结构 [英] How to create databse for purchase order in mysql please give me some good structure

查看:338
本文介绍了如何在mysql中为采购订单创建数据库请给我一些好的结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何将外键存储在order_item表中,以便识别它所属的订单和估计/发票/购买订单。



< b>我尝试了什么:



表名:订单与(联系,估计,发票,发货)表有关。

列名:contact_id(外键(指联系表的id列))。

列名:estimate_id(外键(指估计表的id列))。 />
列名:invoice_id(外键(指发票表的id列))。

列名:shipment_id(外键(指货件表的id列) )。



tablename:purchaseorder(这与订单表有一对多的关系)

列名:order_id(外键(指的是)订单表的id列))。

列名:contact_id(外键(指联系表的id列))。

解方案
的答案在于与所述用户的要求。分析需求,识别实体,数据属性并建立关系。根据分析,为您的应用程序设计数据库方案。了解:

1. 数据库设计简介 [ ^ ]

2. 数据库规范化中的1NF,2NF,3NF和BCNF DBMS教程| Studytonight [ ^ ]

i want to know how should i store the foreign key in order_item table so that it identifies the order and estimate/invoice/purchaseorder it belongs too.

What I have tried:

table name: order relates to (contact, estimate, invoice, shipment) tables.
column name: contact_id (foreign key(referring to id column of the contact table)).
column name: estimate_id (foreign key(referring to id column of the estimate table)).
column name: invoice_id (foreign key(referring to id column of the invoice table)).
column name: shipment_id (foreign key(referring to id column of the shipment table)).

tablename: purchaseorder (this have one to many relationship with order table)
column name: order_id (foreign key(referring to id column of the order table)).
column name: contact_id (foreign key(referring to id column of the contact table)).

解决方案

The answers lie with the user requirements. Analyse the requirements, identify the entities, their data attributes, and establish their relationships. Based on the analysis, design the database scheme for your application. Learn:
1. Introduction to database design[^]
2. 1NF, 2NF, 3NF and BCNF in Database Normalization | DBMS Tutorial | Studytonight[^]


这篇关于如何在mysql中为采购订单创建数据库请给我一些好的结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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