0% found this document useful (0 votes)
24 views8 pages

230 Assignment

The document outlines the design of three management systems: Library, Hospital, and Online Restaurant Reservation. Each system includes entities with their attributes, primary keys, and relationships between them. Additionally, it discusses normalization forms for database design, ensuring data integrity and efficiency.

Uploaded by

vrindavksraj
Copyright
© © All Rights Reserved
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% found this document useful (0 votes)
24 views8 pages

230 Assignment

The document outlines the design of three management systems: Library, Hospital, and Online Restaurant Reservation. Each system includes entities with their attributes, primary keys, and relationships between them. Additionally, it discusses normalization forms for database design, ensuring data integrity and efficiency.

Uploaded by

vrindavksraj
Copyright
© © All Rights Reserved
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
You are on page 1/ 8

Assignment – 1

COMP 230

Vrinda Sharma
300216393

Question 1: Library Management System


1. Books:
BookId is the Primary Key to uniquely identify each book.

Attribute Data Type Constraints


BookId VARCHAR PRIMARY KEY
Title VARCHAR NOT NULL
Author VARCHAR NOT NULL
Publisher VARCHAR NOT NULL
ISBN VARCHAR NOT NULL

2. Members:

MemberId is the Primary Key for unique identification.

Attributes Data Type Constraints


MemberId VARCHAR PRIMARY KEY
Name VARCHAR NOT NULL
Address TEXT NOT NULL
Phone VARCHAR NOT NULL

3. Borrowing:

TransactionId is the Primary Key. And, BookId and MemberId act as


Foreign Keys, referencing Books and Members, respectively.

Attributes Data Type Constraints


TransactionI
VARCHAR PRIMARY KEY
d

BookId VARCHAR FOREIGN KEY

MemberId VARCHAR FOREIGN KEY

BorrowDate DATE NOT NULL


ReturnDate DATE NULL

Assumptions:

1. BookId and MemberId can be stored as VARCHAR for alphanumeric IDs.

2. ISBN is unique for every book, so it has a unique constraint.


3. Phone numbers are stored as VARCHAR to support different formats.

4. ReturnDate can be NULL, as a book may not have been returned yet.

Question 2: Hospital Management System

Entities and Attributes:

1. Patients

o Patient ID (p_ID) – A unique identifier for each patient.

o Name (p_name) – The full name of the patient.

o Insurance ID – The patient’s insurance details for billing and


coverage.

o Admission Date (date_check_in) – The date the patient was


admitted to the hospital.

o Check-out Date (date_check_out) – The date the patient was


discharged.
2. Doctors

o Doctor ID (d_ID) – A unique identifier for each doctor.

o Name (d_name) – The full name of the doctor.

o Specialization – The field of expertise (e.g., Cardiology,


Neurology).

3. Tests

o Test ID (t_ID) – A unique identifier for each test.

o Test Name (test_name) – The type of test performed (e.g.,


Blood Test, MRI).

o Date (date) – The date when the test was conducted.

o Time (time) – The time when the test was conducted.

o Result (result) – The outcome of the test.

Question 3: Normalized Forms

Unnormalized table

For a table to be in First Normal Form (1NF), it must meet two conditions:
atomicity, where each cell contains a single, indivisible value, and
uniqueness of rows, ensuring that each row has a distinct identifier—both of
which are satisfied in this case. However, to qualify for Second Normal Form
(2NF), the table must first be in 1NF and must not have any partial
dependencies, meaning no non-key attribute should depend on only a part of
a composite primary key. Given that the primary key in this table is (p_ID,
t_ID), we need to check if any non-key attribute is dependent on just one of
these columns rather than the entire composite key. If no such dependency
exists, the table already conforms to 2NF.

3NF
Question 4: Online Restaurant Reservation System
Entities and Their Attributes

1. Customer

 Attributes: CustomerId (PK), Name, Phone, Email, Address

 Represents the customers who make reservations. CustomerId is the


Primary Key (PK).

2. Reservation

 Attributes: ReservationId (PK), CustomerId (FK), DateTime, Number of


Guests

 Represents table reservations made by customers. CustomerId is a


Foreign Key (FK) linking to the Customer table.

3. Table

 Attributes: TableId (PK), Capacity, Location

 Represents tables in the restaurant. The Capacity attribute indicates


the number of people a table can accommodate.

4. Manager
 Attributes: ManagerId (PK), Name, Contact

 Represents the restaurant manager responsible for managing tables


and reservations.

5. Waiter

 Attributes: WaiterId (PK), Name, Contact

 Represents the waiters serving customers.

6. Order

 Attributes: OrderId (PK), ReservationId (FK), Total Items

 Represents orders placed by customers during their reservation. Linked


to Reservation because an order is associated with a specific
reservation.

7. Item

 Attributes: ItemId (PK), Name, Price, Description

 Represents food items available for ordering. Each order consists of


multiple items.

8. Bill

 Attributes: BillId (PK), OrderId (FK), Total Amount

 Represents the bill for a customer’s order. Linked to Order to track


payments.

Relationships

1. Customer to Reservation (1:M)

 A customer can make multiple reservations, but each reservation


belongs to only one customer.

2. Reservation to Table (M:N)

 A reservation can include multiple tables, and a table can be booked in


multiple reservations.

3. Reservation to Order (1:1)


 Each reservation generates one order, and each order is linked to one
reservation.

4. Order to Item (M:N)

 An order can contain multiple items, and an item can be included in


multiple orders.

5. Order to Bill (1:1)

 Each order has exactly one bill, and each bill belongs to only one order.

6. Manager to Table (1:M)

 A manager can oversee multiple tables, but each table is assigned to


only one manager.

7. Waiter to Order (1:M)

 A waiter can serve multiple orders, but each order is served by one
waiter.

You might also like