The document outlines the design and implementation of a MySQL database for a Zomato-like application, including the creation of tables for Users, Restaurants, Menu_Items, Orders, Order_Items, and Reviews. It provides SQL commands for creating the database schema, inserting sample data, and writing queries to retrieve various information such as restaurant ratings, menu items, user orders, reviews, and total earnings. This structured approach facilitates the management of restaurant and user data efficiently.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
134 views4 pages
MySQL Zomato Project
The document outlines the design and implementation of a MySQL database for a Zomato-like application, including the creation of tables for Users, Restaurants, Menu_Items, Orders, Order_Items, and Reviews. It provides SQL commands for creating the database schema, inserting sample data, and writing queries to retrieve various information such as restaurant ratings, menu items, user orders, reviews, and total earnings. This structured approach facilitates the management of restaurant and user data efficiently.
INSERT INTO Reviews (user_id, restaurant_id, rating, comments) VALUES
(1, 1, 5, 'Amazing pizza! Highly recommend.'), (2, 2, 4, 'Great sushi, but a bit pricey.');
Step 4: Writing Queries
1. Get all restaurants and their average rating:
SELECT name, location, AVG(rating) AS average_rating FROM Restaurants JOIN Reviews ON Restaurants.restaurant_id = Reviews.restaurant_id GROUP BY Restaurants.restaurant_id;
2. Find all menu items of a restaurant:
SELECT item_name, price, description
FROM Menu_Items WHERE restaurant_id = 1;
3. Retrieve all orders by a user:
SELECT Orders.order_id, Restaurants.name AS restaurant_name,
Orders.total_price, Orders.status FROM Orders JOIN Restaurants ON Orders.restaurant_id = Restaurants.restaurant_id WHERE Orders.user_id = 1;