0% found this document useful (0 votes)
20 views2 pages

Creating Tables in MS Access Activity

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

Creating Tables in MS Access Activity

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

TASK 3 – Designing a database for a small Coffee Shop

Let’s design a simple database for a small coffee shop. We'll create four tables: Product, Customer,
Order, and OrderItem. Here’s a basic outline of each table and their relationships.

1. Product Table

This table stores information about the products available in the coffee shop.

 ProductID (Primary Key): A unique identifier for each product


 ProductName: The name of the product
 Description: A description of the product
 Price: The price of the product
 Category: The category of the product

2. Customer Table

This table stores information about the customers of the coffee shop.

 CustomerID (Primary Key): A unique identifier for each customer


 FirstName: The customer's first name
 LastName: The customer's last name
 Email: The customer's email address
 PhoneNumber: The customer's phone number
 Address: The customer's address

3. Order Table

This table records the details of each order placed at the coffee shop.

 OrderID (Primary Key): A unique identifier for each order


 CustomerID (Foreign Key): References CustomerID from the Customer table, indicating who
placed the order
 OrderDate: The date and time when the order was placed
 TotalAmount: The total amount for the order
4. OrderItem Table

This table links products to orders, detailing which products are included in each order.

 OrderItemID (Primary Key): A unique identifier for each order item


 OrderID (Foreign Key): References OrderID from the Order table, linking each item to a
specific order
 ProductID (Foreign Key): References ProductID from the Product table, indicating which
product is being ordered
 Quantity: The number of units of the product ordered
 UnitPrice: The price of the product at the time of the order

Relationships Between Tables

1. Product and OrderItem:


o The OrderItem table has a foreign key ProductID that references ProductID in the
Product table. This relationship indicates which product is included in the order
item. It’s a many-to-one relationship: each order item references a single
product, but a single product can be included in many order items.
2. Order and OrderItem:
o The OrderItem table has a foreign key OrderID that references OrderID in the Order
table. This relationship links each order item to a specific order. It’s a many-to-
one relationship: each order item belongs to a single order, but each order can
have multiple order items.
3. Customer and Order:
o The Order table has a foreign key CustomerID that references CustomerID in the
Customer table. This relationship indicates which customer placed the order. It’s a
one-to-many relationship: each customer can place multiple orders, but each
order is placed by a single customer.

Summary

 Product Table: Contains details about the products offered by the coffee shop.
 Customer Table: Contains details about customers.
 Order Table: Records each order, linking it to a customer.
 OrderItem Table: Manages the relationship between orders and products, detailing
which products are included in each order.

You might also like