I'm creating an academic system that consists of a virtual restaurant menu type, so I've created three tables in the database:
Menu Items Table:
CREATE TABLE ITEMS(
ID INT PRIMARY KEY NOT NULL,
NOME VARCHAR(20) NOT NULL,
DESCRICAO VARCHAR(20),
PRECO FLOAT NOT NULL
)
Order Table:
CREATE TABLE PEDIDO(
NUMERO INT PRIMARY KEY NOT NULL,
MESA INT NOT NU NULL,
VALORTOTAL FLOAT
)
Table where I register the Order Items, where:
ID_PEDIDO = FK de Pedido, ID_ITEM = FK de Item
CREATE TABLE ITEM_PEDIDO(
ID INT PRIMARY KEY NOT NULL,
ID_PEDIDO INT NOT NULL,
ID_ITEM INT NOT NULL,
QTD_ITEM INT
)
My question is:
In the system, you can choose an item or more for your request , as well as the quantity of this item. At the end of the order, you must return the total price of the order.
So, should I leave QTD_ITEM in the REQUIREMENTS table? As for the PRICE, should I leave it in the ITEM table or do I also include it in the ITEM_PEDIDO table?