Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The assignment is designed to be done on your own. The assignment must be your own work, not copied from others or any other course,
The assignment is designed to be done on your own. The assignment must be your own work, not copied from others or any other
course, textbook, or website. If plagiarism is detected, appropriate consequences will follow. Please refer to Policy ST: Student
academic integrity.
Objective:
Design databases to meet user needs
Problem Specifications
For this assignment, you will be developing a database to support an online food ordering service. The core tables will encompass
user management, restaurant data, menu items, order processing, and payment handling. The database will consist of six
fundamental tables: users, restaurants, menu items, orders, and payments.
Users userID firstname, lastname, email, password, phone, address
Restaurant resturantID name, address, phone, email, rating
MenuItem itemID resturantID, name, description, price, category
Orders orderID userID, resturantID, totalPrice, orderDate, deliveryDate
OrderItem orderItemID orderID, itemID, quantity, price
Payment paymentID orederID, userID, amount, paymentmethod, paymentDate
Download the FoodDB.accdb from the Moodle course website. Change the name by starting with your first name and then the database
name. Modify the file name, to begin with your first name and then the database name. For instance, if your first name is John, the
database should be named JohnFoodDB.accdb. Then, Fulfill the requirements for each table, as indicated below. points
Users Table
Column Name Data Type Constraint NULL value
userID Autonumber Primary Key No
firstname Char No
lastname Char No
email Char Unique No
password Char No
phone Char No
address Char
Restaurant Table
Column Name Data Type Constraint NULL value
resturantID Autonumber Primary Key No
name Char No
address Char No
phone Char No
email Char Unique No
rating Numeric Two decimal places
MenuItem Table
Column Name Data Type Constraint NULL value
itemID Autonumber Primary Key No
resturantID Number Foreign Key No
name Char No
description Long Text
price Currency Two decimal places No
category Char
Orders Table
Column Name Data Type Constraint NULL value
orderID Autonumber Primary Key No
userID Number Foreign Key No
resturantID Number Foreign Key No
totalPrice Currency Two decimal places No
orderDate DateTime Default Current Date
deliveryDate DateTime
OrderItem Table
Column Name Data Type Constraint NULL value
orderItemID Autonumber Primary Key No
orderID Number Foreign Key No
itemID Number Foreign Key No
quantity Number integer No
price Currency Two decimal places No
Payment Table
Column Name Data Type Constraint NULL value
paymentID Autonumber Primary Key No
orederID Number Foreign Key No
userID Number Foreign Key No
paymentmethod Char No
paymentDate Date No
The data that has been inserted into the first five tables using INSERT SQL statements is shown below.
remember that MS ACCESS can insert one record at a time.
Users Table
Restaurant Table
MenuItem Table
Orders Table
OrederItem Table
Payment Table
Create the following relationships based on Figure Force update of the foreign key points
Figure tables relationships
Create the following queries. Save each query in different file using the format the firsttwolettersofyour name Query#
where # is the question letter. For example, if your name is John then the A query will be saved using JoQueryA
points
A Display all users' first and last names with phone numbers from the USER table. Sort the result by the user's first name in
descending order.
B Display all the restaurant IDs from the ORDERS table without duplication with a total price of less than $
C Retrieve the first and last names of users from the USERS table, displaying them in a single column along with their email.
Ensure there is a space between the first and last names.
D Display the order ID and the time in minutes needed to deliver each order from ORDERS table.
E List all the users first and last names with phone number start with
F Show all the first and last names of the users who made an order from a restaurant name entered while running this
statement Use implicit join to get full credits
G Show each order with a description of the order item and the quantity.
H Display restaurant name with the total number of items sold.
I Retrieve all the orders with their items names which paid by credit card user INNER JOIN to get full credits
J Display all the orders, items in each order and category. Sort result based on category.
K Retrieve the total price paid by each user for all of their orders, along with their first and last names.
L Retrieve first name, last name and phone number from USER table for users with first name beginning with the letter J or
M and the phone number end by Display the result ordered by user id
Using SQL state
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started