本文介绍了如何为购物车建立数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个迷你购物车.

所以这是我所拥有的例子.因此,如果我需要更改,请纠正我.

正在出售的产品是一种服务.
该服务允许用户查看文档.

我创建了一个表单,用户可以将其归档并上传文档以供审核. -这有效-
我可以创建代码以在允许访问该页面之前检查用户是否购买了.

如何构建我遇到问题的这3或4个表的表.

所以这就是我所做的.

我的表是:用户,角色,User_In_Roles.医生,审阅者,患者,产品,订单详细信息,购物车.

当医生登录用户时,他必须从购物车中购买服务才能提交审核.我需要查看如何连接表格.产品的order_details,购物车应如何连接到患者和医生"表.


医生从产品表中购买服务产品,代码5.点击购物车付款.每次医生提交要检查的患者表格时,将从购买的程序的数量值中扣除.

这是我的表连接:

该产品对医生,订购详情,患者和购物车都有fk.

order_details对患者有影响.

购物车可为患者和产品提供方便.

我的产品表是这个.
ProductId int PK
PatientId int FK
DoctorsId int FK
程序字符串
价格数字

我的订单明细表
OrderDetailsId int PK
PatientId Fk
ProductId FK
数量int
价格数字

我的购物车表是这个
CartId int PK
PatientId Fk
ProductId Fk
计数int


请指导我如何正确连接表.

I need to create a mini shopping cart.

So here is example of what I have. so please correct me if I need to change.

The product that is being sold is a service.
The service allow a user to have document reviewed.

I have created a form that user file out and upload documents for review. -this works-
I can create the code to check if user purchase before allowing access to this page.

how do build the tables this 3 or 4 tables I having problems with.

So here is what I have done.

My tables are:User, Roles, User_In_Roles. Doctors, Reviewers, Patients, Products, Order_Details, Carts.

When doctor log in user he have to purchase service from the cart in order to submit for review. I need to see how to connect the tables. How should products order_details, cart connects to the Patients and Doctors table.


Doctors purchases service product,code 5 from the product table. Click cart to pay. Every time a doctor submits a patients form to be reviewed it will be subtracted from the quantity value from the program he purchase.

This is my table connections:

product has a fk to doctors, order_details, patients and cart.

order_details has a fk to patients.

cart has a fk to patients and product.

My product table is this.
ProductId int PK
PatientsId int FK
DoctorsId int FK
Program string
price numeric

My Order_Details table
OrderDetailsId int PK
PatientsId Fk
ProductId FK
Quantity int
Price numeric

My Cart table is this
CartId int PK
PatientsId Fk
ProductId Fk
Count int


Please direct me on how to properly connect the tables.

推荐答案


这篇关于如何为购物车建立数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 19:45