Question: / * The schema includes tables for users, user sessions, categories, cuisines, fooditems, restaurants, menus, menuitems, shopping carts, cart items, shipping details, orders and orderitems.
The schema includes tables for users, user sessions, categories, cuisines, fooditems,
restaurants, menus, menuitems, shopping carts, cart items, shipping details, orders and orderitems.
The user table stores information about registered users like username, fullname, emailId, phoneNo and password.
The usersession table is used to manage user sessions and stores information like userId and sessionToken.
The category table stores information about categories like category name, description and image url.
The cuisine table stores information about cuisines like cuisine name, description and image url.
The restaurant table stores information about restaurants like restaurant name, address, contact and image url.
The fooditem table stores information about fooditems like fooditem name, description, categoryId, cuisineId, isVeg and image url.
The menu table stores information about food menu like restaurantId of the restaurant offering the particular menu.
The menuitem table stores information about fooditems for a menu like menuId, fooditemId and fooditemPrice for the particular fooditem.
The cart table stores information about shopping carts created by users like userId, restaurantId, orderTotalPrice.
The cartitems table stores information about the fooditems added to each cart like cartId, fooditemId, fooditemPrice and UnitsInCart.
The shippingDetails table stores information about the shipping address, email, and phone number.
The order table stores information about each order, including the user who placed the order, the shipping details, the order total price, the restaurant from where the order fooditems are ordered and the order status.
Finally, the orderitems table stores information about the fooditems ordered in each order like orderId, fooditemId, fooditemPrice and UnitsPurchased.
Each table also includes some additional columns, such as createdTs and updatedTs, which are used to store timestamps of when each record was created and last updated.
Additionally, each table has an isActive column, which is used to mark records as inactive rather than deleting them outright.
This allows for data to be retained for future reference without cluttering the database with unnecessary data.
Create database command
CREATE DATABASE foodorderapp;
Select the newly created database
USE foodorderapp;
Create table command for user table
CREATE TABLE user
id int NOT NULL,
userName varchar NOT NULL,
fullName varchar NOT NULL,
emailId varchar NOT NULL,
phoneNo int NOT NULL,
password varchar NOT NULL,
isActive int NOT NULL DEFAULT
createdTs datetime NOT NULL DEFAULT CURRENTTIMESTAMP,
updatedTs datetime NOT NULL DEFAULT CURRENTTIMESTAMP,
PRIMARY KEY id
ENGINEInnoDB DEFAULT CHARSETutfmb COLLATEutfmbaici;
Create table command for usersession table
CREATE TABLE usersession
id int NOT NULL,
userId int NOT NULL,
sessionToken varchar NOT NULL,
isActive int NOT NULL DEFAULT
createdTs datetime NOT NULL DEFAULT CURRENTTIMESTAMP,
updatedTs datetime NOT NULL DEFAULT CURRENTTIMESTAMP,
PRIMARY KEY id
ENGINEInnoDB DEFAULT CHARSETutfmb COLLATEutfmbaici;
Create table command for category table
CREATE TABLE category
id int NOT NULL,
name varchar NOT NULL,
description varchar NOT NULL,
image varchar NOT NULL,
isActive int NOT NULL DEFAULT
createdTs datetime NOT NULL DEFAULT CURRENTTIMESTAMP,
updatedTs datetime NOT NULL DEFAULT CURRENTTIMESTAMP,
PRIMARY KEY id
ENGINEInnoDB DEFAULT CHARSETutfmb COLLATEutfmbaici;
Q Create table command for cuisine table
Q Create table command for restaurant table
Q Create table command for fooditem table
Q Create table command for menu table
Q Create table command for menuitems table
Q Create table command for cart table
Q Create table command for cartitems table
Q Create table command for shippingDetails table
Q Create table command for order table
Q Create table command for orderitems table
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
