多餐厅在线订购系统 [英] multi restaurant online ordering system

查看:101
本文介绍了多餐厅在线订购系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为餐馆制作在线食品订购系统。基本上餐馆会上传他们的菜单供客户从任何地方订购他们想要的食物。



现在我的问题是如何为多个订单创建和实现数据库模型。 />


例如:



泰勒(客户)此订单包含四种食品。如何将此订单保存在一行中,并提及泰勒



来自餐厅的披萨20.00 -

汉堡18.00来自餐厅-2

来自餐厅的百事可乐3.00

沙拉酱20.来自餐厅-3

I am working on an online food ordering system for restaurants. Basically restaurants will upload their menus for customers to order food they desire from anywhere.

Now my problem is how to create and implement a database model for multiple orders.

Example:

Taylor(customer) makes this order comprising four food items. How will this order be saved in one row with a reference to Taylor

Pizza 20.00 from restaurant-1
burger 18.00 from restaurant-2
Pepsi 3.00 from restaurant-1
salad sauce 20. from restaurant-3

推荐答案

-First of所有你必须为食物创建yable(菜单项)

- 然后你必须为restuarants创建表

- 你可以插入到客户表中只是一个< b>菜单项和餐厅





喜欢这样的


custID |名称|联系|项目| Resturant



1 | Nirav | 73838032188 | 1(比萨的ID | 2(餐厅的ID)
-First of all you have to create yable for Food(Menu Items)
-Then You have to create Table for restuarants
-Now you can insert into customer tables just ID of a Menu Items And Restaurants


Like THAT

custID | Name | Contact | Item | Resturant

1 | Nirav | 73838032188 | 1(ID of Pizza | 2 (ID of Restuarant)


你没有。甚至不考虑使用一行 - 它赢了;工作得很好,因为你不知道客户可能会订购多少件商品。



假设您说没人会订购超过40件商品。当他们这样做时会发生什么?

那么,如果泰勒还在下一张桌子上为他的母亲订购了什么呢?

相反,请使用多个数据库表。

一张表持有关于客户的信息,并有一个主键,即客户ID - 这可以包括密码哈希,用户名和他在哪里。

第二个持有客户订单 - 这有一个主要的密钥是订单号,是作为客户的外键,以及发布时的日期时间,如果需要,可以完成,付费和总计列(您可能会这样做)

第三个表包含他可以订购的物品:主键是一个ItemID,它还保存价格, d你可以提供的号码(所以你可以在厨房耗尽时删除物品)

第四张表中包含订单详情:主键是一个OrderItemID(但这只是一个唯一值表),带有Orders表的外键,Items表和订购的商品数量栏。



听起来很复杂?是的,有点 - 但是它很多,比只用一张桌子更加简单,相信我!



用铅笔在纸上试试 - 你我会明白我的意思!
You don't. Don't even think about using one row - it won;t work well, because you have no idea how many items any customer might order.

Suppose you say "nobody is going to order more than 40 items". What happens when they do?
And, what if Taylor also puts in an order for his mother, at the next table?
Instead, use a number of database tables.
One table holds info on the customer, and has a primary key which is the customer ID - this can include the password hash, the user name, and where he is.
A second holds customer orders - this had a primary key which is the order number, and a foreign key which is the customer, and a datetime which is when it was placed, and "completed", "paid" and "total" columns if you need them (and you probably do)
A third table holds the items he can order: primary key is an ItemID, it also holds the price, and the number you can serve (so you can remove items when the kitchen "runs out")
A fourth table holds order details: Primary key is an OrderItemID (but this is just a unique value to the table), with foreign keys to the Orders table, Items table and a "number of items ordered" column.

Sounds complicated? Yes, a bit - but it's a lot, lot simpler than trying to faff about with just one table, trust me!

Try it on paper with a pencil - you'll see what I mean!


这篇关于多餐厅在线订购系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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