Entities Structures in SQL Format
-- Create User TableCREATE TABLE Users ( UserID SERIAL PRIMARY KEY, Username VARCHAR(255), Email VARCHAR(255), PasswordHash VARCHAR(255), Address VARCHAR(255), Preferences TEXT);-- Create Restaurant TableCREATE TABLE Restaurants ( RestaurantID SERIAL PRIMARY KEY, Name VARCHAR(255), Address VARCHAR(255), Cuisine VARCHAR(255), Rating DECIMAL(3, 2), OperatingHours VARCHAR(255));-- Create Menu TableCREATE TABLE Menu ( MenuID SERIAL PRIMARY KEY, RestaurantID INT NOT NULL, ItemName VARCHAR(255), Description TEXT, Price DECIMAL(10, 2), Category VARCHAR(255), FOREIGN KEY (RestaurantID) REFERENCES Restaurants(RestaurantID));-- Create Order TableCREATE TABLE Orders ( OrderID SERIAL PRIMARY KEY, UserID INT NOT NULL, RestaurantID INT NOT NULL, OrderTime TIMESTAMP DEFAULT CURRENT_TIMESTAMP, TotalAmount DECIMAL(10, 2), OrderStatus VARCHAR(255), FOREIGN KEY (UserID) REFERENCES Users(UserID), FOREIGN KEY (RestaurantID) REFERENCES Restaurants(RestaurantID));-- Create OrderItem TableCREATE TABLE OrderItems ( OrderItemID SERIAL PRIMARY KEY, OrderID INT NOT NULL, MenuID INT NOT NULL, Quantity INT, FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), FOREIGN KEY (MenuID) REFERENCES Menu(MenuID));-- Create Review TableCREATE TABLE Reviews ( ReviewID SERIAL PRIMARY KEY, UserID INT NOT NULL, RestaurantID INT NOT NULL, Rating DECIMAL(2, 1), Comment TEXT, ReviewDate TIMESTAMP DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (UserID) REFERENCES Users(UserID), FOREIGN KEY (RestaurantID) REFERENCES Restaurants(RestaurantID));...
Contact Us