Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Regular-Lab-Book-Upto 3 RD Experiment

Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

Database Management Systems

22AD2102R

STUDENT ID: ACADEMIC YEAR: 2023-24

STUDENT NAME:
22AD2102R` –Database Management Systems

Table of Contents
1. Installation of PostgreSQL Client & Server .................................................................. 2

2. Installation of TerraER Tool ........................................................................................ 13

3. Entity Relationship (ER) Modeling .................................. Error! Bookmark not defined.

4. Implementation of DDL & DML Commands .............................................................. 30

5. Implementation of Joins: Inner Join, Outer Join, Natural Join ................................ 39

6. Implementation of Nested Sub Queries ........................................................................ 53

7. Implementation of Sub Queries and Views .................................................................. 62

8. Implementation of PL/SQL Programs, Procedures, Functions ................................. 70

9. Implementation of Triggers & Cursors ........................................................................ 76

10. Implementation of Group by & Having Clauses and Set Operations ....................... 82

11. Implementation of Correlated Nested, Views, Indices and DCL Commands .......... 87

12. Implementation of Transaction in SQL Server ........................................................... 94

13. Capstone Project-1 ........................................................................................................ 100


22AD2102R` –Database Management Systems
Our Vision:
• To be a department of international repute through continuous research, innovation and
industry led curriculum.
Our Mission:
• To Impart Quality Education with social consciousness and make them Globally
Competent.
Organization of the STUDENT LAB WORKBOOK
The laboratory framework includes a creative element but shifts the time-intensive aspects outside of
the Two-Hour closed laboratory period. Within this structure, each laboratory includes three parts:
Prelab, In-lab and post-lab.

Pre-Lab

The Prelab exercise is a homework assignment that links the lecture with the laboratory period -
typically takes 2 hours to complete. The goal is to synthesize the information they learn in lecture with
material from their textbook to produce a working piece of software. Prelab Students attending a two-
hour closed laboratory are expected to make a good-faith effort to complete the Prelab exercise before
coming to the lab. Their work need not be perfect, but their effort must be
real(roughly80percentcorrect).

In-Lab

The In-lab section takes place during the actual laboratory period. The First hour of the laboratory
period can be used to resolve any problems the students might have experienced in completing the
Prelab exercises. The intent is to give constructive feedback so that students leave the lab with working
Prelab software - a significant accomplishment on their part. During the second hour, students
complete the In-lab exercise to reinforce the concepts learned in the Prelab. Students leave the lab
having received feedback on their Prelab and In-lab work.

Post-Lab

The last phase of each laboratory is a homework assignment that is done following the laboratory
period. In the Post-lab, students analyse the efficiency or utility of a given system call. Each Post-lab
exercise should take roughly 120minutes to complete.
LAB CONTINUOUS EVALUATION SHEET

Pre-Lab In-Lab Post Lab Viva Total Faculty


Experiment Name (5M) LOGIC (5M) Voce (50M) Signature
S. Date EXECUTION RESULT ANALYSIS
(10M) (10M) (5M) (5M)
No (10M)
Installation of POSTGRESQL client
1 & server
Installation of TERA ER Tool &
2 Case Study-1 & 2
Case Study-3& 4 (convert ER to
3 relation model).
Implementation of DDL & DML
4 Commands
5 Implementation of Joins: Inner Join,
Outer Join, Natural Join
6 Implementation of Nested Sub
Quires
7 Implementation of: Sub Queries and
Views
8 Implementation of PL/SQL
programs, procedures, functions
9 Implementation of Triggers &
Cursors
10 Aggregate Functions, Group by &
Having Clauses and Set Operations
11 Implement Correlated Nested,
Views, Indices and DCL Commands
12 Implementation of Transaction in
SQL Server
13 Capstone Project
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

1. Installation of POSTGRESQL client & server


Pre Lab:

Answer the following question before entering lab. The following pre lab task has to perform at home.

1. What are the characteristics of a Database Management System (DBMS)?

2. What are the advantages of using a DBMS over traditional file systems?

3. What is Database? Discuss the different types of database users and their roles.

4. What are the Roles of Database Administrator?

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 2 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

5. Explain the role of languages, tools, and interfaces in a DBMS.

6. list out some database management system software.

7. Discuss the advantages and disadvantages of using a cloud-based database system.

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 3 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

In Lab:
1. Installation of PostgreSQL

Download PostgreSQL Installer for Windows from URL:(https://www.postgresql.org/download/)

Since version 8.0, PostgreSQL offers an installer for Windows systems that makes the installation process
easier and faster. For development purposes, we will install PostgreSQL version 12 or above version on
Windows 10.

There are three steps to complete the PostgreSQL installation:


1. Download PostgreSQL installer for Windows
2. Install PostgreSQL on Windows 10
3. Verify the installation
1. Download PostgreSQL Installer for Windows

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 4 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

2. Install PostgreSQL on Window step by step


Step 1: - Double click on the installer file, an installation wizard will appear and guide you through
multiple steps where you can choose different options that you would like to have in PostgreSQL.
Step 2: - Click the Next button

Step 3: - Specify installation folder, choose your own or keep the default folder suggested by
PostgreSQL installer and click the Next button

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 5 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

Step 4: - Select software components to install:

✓ The PostgreSQL Server to install the PostgreSQL database server


✓ pgAdmin 4 to install the PostgreSQL database GUI management tool.
✓ Command Line Tools to install command-line tools such as psql, pg_restore, etc. These
tools allow you to interact with the PostgreSQL database server using the command-line
interface.
✓ Stack Builder provides a GUI that allows you to download and install drivers that work with
PostgreSQL.

For the tutorial on this website, you don’t need to install Stack Builder so feel free to uncheck
it and click the Next button to select the data directory:

Step 5: - Select the database directory to store the data or accept the default folder. And click the Next
button to go to the next step:

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 6 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

Step 6: - Enter the password for the database superuser (XXXXXXX)


PostgreSQL runs as a service in the background under a service account named XXXXXXX. If you
already created a service account with the name XXXXXXX, you need to provide the password of that
account in the following window.

After entering the password, you need to retype it to confirm and click the Next button:

Step 7: - Enter a port number on which the PostgreSQL database server will listen. The default port of
PostgreSQL is 5432. You need to make sure that no other applications are using this port.

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 7 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

Step 8: - Choose the default locale used by the PostgreSQL database. If you leave it as default locale,

PostgreSQL will use the operating system locale. After that click the Next button.

Step 9: - The setup wizard will show the summary information of PostgreSQL. You need to review it and
click the Next button if everything is correct. Otherwise, you need to click the Back button to change the
configuration accordingly.

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 8 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

Now, you’re ready to install PostgreSQL on your computer. Click the Next button to begin installing
PostgreSQL.

The installation may take a few minutes to complete.

Step 10: - Click the Finish button to complete the PostgreSQL installation.

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 9 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

3. Verify the Installation

✓ There are several ways to verify the PostgreSQL installation. You can try to connect to the
PostgreSQL database server from any client application e.g., psql and pgAdmin.
✓ The quick way to verify the installation is through the psql program.

First, click the psql application to launch it. The psql command-line program will display.

Second, enter all the necessary information such as the server, database, port, username, and
password. To accept the default, you can press Enter. Note that you should provide the password
that you entered during installing the PostgreSQL.

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 10 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

Third, issue the command SELECT version(); you will see the following output:

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 11 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

Post Lab:

Answer the following question before entering into lab. The following post lab task must perform at
home.
1) Describe the three-level architecture of a DBMS and its components

2) Discuss the concept of data mining and its applications in a DBMS.

3) What are the key differences between a relational and object-oriented DBMS?

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 12 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

2. Installation of TERA ER Tool


Pre Lab:

Answer the following question before entering into lab. The following pre lab task has to perform at
home.
1) What is the purpose of an ER diagram in database design?

2) Explain the main components of an ER diagram.

3) What is an attribute and explain different types of attributes?

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 13 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

4) Describe the difference between entities and attributes in ER modeling.

5) How do you represent one-to-one, one-to-many, and many-to-many relationships in an ER diagram?

6) Explain the difference between a weak relationship and a strong relationship in an ER diagram.

7) Discuss the role of constraints, such as foreign keys and primary keys, in an ER diagram.

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 14 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

In Lab
a. Installation of TERA ER Tool

TerraER is a free open-source learning tool designed to aid students in the creation of entity-relationship
models. Our main goal is to provide students with a tool that reflects exactly the data modelling concepts
learned in the classroom.

Web Site: http://www.terraer.com.br/


Version tested: TerraER 2.02
System requirements: Java 1.5 or higher
License & Pricing: Open-Source GNU Public License, Freeware.

Introduction
Data modelling is one part of the database conceptual design process. The entity-relationship model
(ER model) is a largely used conceptual model proposed by Chen [1]. It defines the entities and the
relationships between these entities. The ER model is simple and easy to understand, making it
intelligible to both database designers and end users
Installation
TerraER is distributed in a single JAR file publicly available for download at our web
site www.terraer.com.br/download_en.html. The JAR file is auto-contained, i.e., it can be placed in any
folder, does not require the installation of additional libraries, and does not change operating system
files (e.g., windows registry). In a nutshell, TerraER requires only a Java Runtime Environment (JRE)
previously installed on the target computer (www.java.com/en/download/index.jsp).

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 15 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

b. COVID-19 Database

Problem Description: COVID-19 is also known as Corona Virus. It was first reported to the World
Health Organization (WHO) on the31st of December, 2019 in Wuhan, China. Mr. John employed the
services of a Data Analyst for the design of a COVID-19 database. Mr. John gave requirements to the
Data Analyst to carry on his work in designing the database. This database system is helpful in finding
out the number of cases in a particular day and in a particular country. It should also give the no. of
persons recovered or died based on the data stored in the database. By analyzing the data, we can find
out the most Covid affected areas over the globe. This system requires a database for storing the details
of all the countries with their details of country code, name, population count and such other details
related to the country. There should be Person database where all the details of the people are stored
who came for taking the test. Initially the status of the person is taken as negative. There is a need of
another database where the affected person’s data is stored. Data is inserted in to this whenever a person
is found covid positive. It should also contain the information about the recovered or death cases.
Include any other entities which are required according to your requirement.
a. What are the main entities that need to be included in the COVID-19 database?
b. What attributes should be associated with the Country entity?
c. What attributes should be associated with the Person entity?
d. Are there any additional entities or relationships that should be included in the database based
on the given requirements?
e. What are the cardinalities between the entities in the database?
f. Are there any specific data constraints or validations that should be considered in the design of
the database?
g. Draw the ER modeling for the above Problem Description.

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 16 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 17 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

c. Andhra Hospital Database:


Problem Description: Andhra Hospitals is a multi-specialty hospital that includes several departments,
rooms, doctors, nurses, compounders, and other staff working in the hospital. Students at KL University
are assigned the task of designing and developing a database for the hospital to maintain the records of
various departments, rooms, and doctors in the hospital using the following information: In hospital,
there are many departments, each department has department name, department location, and facilities
available in that department. Department name will be unique for each department.
Two types of the doctors in the hospital namely, regular doctors and call on doctors. Regular doctors
come to the hospital daily. Calls on doctors are called by the hospital if the concerned doctor is not
available. Each doctor is given an identity number starting with DR (regular doctors) or DC (calls on
doctors) prefixes only. Regular doctors are referred to by their identity number, name, qualification,
address, phone number, salary, date of joining, etc. Calls on doctors have some additional attributes
like fees per call, payment due.
a. What are the main entities that need to be included in the Andhra Hospitals database?
b. What attributes should be associated with the Department entity? Is the department name unique
for each department?
c. What are the specific attributes for regular doctors and call-on doctors in the Doctor entity?
d. How can we represent the relationship between doctors and departments in the database?
e. How can we represent the rooms in the hospital and their association with departments?
f. What attributes should be associated with the Nurse entity?
g. What attributes should be associated with the Compounder entity?
h. How can we represent the association between doctors and nurses in the database?
i. How can we represent the association between doctors and compounders in the database?
j. Are there any additional entities or relationships that should be included in the database based
on the given requirements?
k. Draw the ER modeling for the above Problem Description.

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 18 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 19 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

Post Lab

Answer the following question before entering into lab. The following post lab task has to
perform at home.
a. TechCo Company Database:
Problem Description: A company named "TechCo" wants to design a database to manage their
employee information. The company has multiple departments, each with a unique department ID,
department name, and department location. Each department is managed by an employee who holds
the position of department manager.
The company employs various types of employees, including regular employees, managers, and interns.
Each employee has an employee ID, name, address, phone number, email, date of birth, and salary.
Regular employees have additional attributes such as job title and date of joining. Managers have the
same attributes as regular employees but also have a managerial role within their department.
The company provides various benefits to its employees, such as health insurance, retirement plans,
and paid time off. Each benefit has a unique benefit ID, description, and eligibility criteria.
Employees are assigned to work on different projects. Each project has a unique project ID, name, start
date, and end date. Multiple employees can be assigned to the same project, and an employee can be
assigned to multiple projects simultaneously.
In addition to the above requirements, the company wants to track the skills possessed by each
employee. Skills have a unique skill ID and a skill description. Employees can have multiple skills, and
each skill can be associated with multiple employees.
a. Draw an ER diagram representing the entities, attributes, relationships, and cardinalities based
on the given problem description.

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 20 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 21 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

3. Entity Relationship (ER) Modeling

Pre Lab:
Answer the following question before entering into lab. The following prelab task must perform at
home.
1) What is the purpose of an ER diagram in database design?

2) What is an associative entity in ER modeling, and when is it used?

3) Discuss the concept of specialization and generalization in ER modeling.

4) What is the difference between a weak entity and a strong entity in ER modeling? Provide examples
of each.

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 22 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

5) What is the purpose of a composite attribute, and how is it represented in an ER diagram?

6) How do you handle complex relationships, such as ternary relationships, in an ER diagram?

7) Explain the concept of recursive relationships in ER modeling and provide an example.

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 23 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

In Lab:

1. Railway Reservation System.


Problem Description: A railway company wants to develop a database system to manage their
reservation system. The system should allow passengers to book tickets, check seat availability, and
manage their reservations. The following information is provided to design the database:

• Trains: The railway company operates multiple trains, each identified by a unique train number.
Each train has a name, source station, destination station, and a schedule indicating the departure
and arrival times.
• Stations: The system should store information about various stations on the railway network.
Each station has a unique station code, name, and location.
• Passengers: Passengers can book tickets by providing their personal information. Each
passenger has a unique passenger ID, name, age, gender, contact number, and address.
• Tickets: Tickets are associated with a specific passenger and train journey. Each ticket has a
unique ticket number, train number, passenger ID, journey date, and seat number.
• Seat Availability: The system should keep track of seat availability on each train for a particular
journey date. Each train has a fixed number of seats, and the availability status is updated as
passengers’ book or cancel tickets.
• Ticket Fare: The system should store the fare information for each train journey. The fare can
vary based on factors like class (e.g., general, sleeper, AC), distance, and any discounts or
promotions.
• Payment: The system should support various payment methods for ticket bookings, such as cash,
credit card, or online payment gateways. The payment information should be associated with
the respective ticket.

Design an ER diagram that represents the entities, attributes, relationships, and cardinalities for the
Railway Reservation System. Consider any necessary assumptions and justify them if required.

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 24 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 25 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

2. University Database:
Problem description:

In a university, there are several departments, and each department has a head of department who
belongs to Faculty. Department have a name, phone extension, specific mailing address and Students
that belong to the department. Students can belong to only one Department at a time and Department
can have more than one or no Student. Students and faculty have names and unique identification
numbers, with address, age, gender and otherinformation. Student studies different Courses offered by
university. Faculty teaches these Courses. In each semester one student can take more than one course
and Faculty can teach more than one courses. Faculty memberscan teach in multiple Departments. Each
course can be taught by many faculty members or no one. Faculty members are also working on multiple
research projects. These projects are funded by government and university.One project can have more
than one faculty member and one faculty member can work on more than one project.
• What are the main entities that need to be included in the university database system?
• What are the attributes associated with the Department entity? Are there any unique attributes
or constraints?
• What attributes should be associated with the Faculty entity? How can we represent the
relationship between faculty members and departments?
• What attributes should be associated with the Student entity? How can we represent the
relationship between students and departments?
• How can we represent the relationship between students and courses in the database system?
Can a student take multiple courses in a semester?
• How can we represent the relationship between courses and faculty members? Can a course be
taught by multiple faculty members?
• How can we represent the relationship between faculty members and departments? Can a faculty
member work in multiple departments?
• Design an ER diagram that represents the entities, attributes, relationships, and cardinalities for
the university database system.

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 26 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 27 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

Post Lab

Answer the following question before entering into lab. The following post lab task has to
perform at home.
1. FashionHub Retail Company Database:
Problem description:

A retail company named "FashionHub" wants to design a database to manage their product inventory
and sales. The company sells various fashion items such as clothing, accessories, and footwear. They
have multiple physical stores located in different cities.
The following information is provided to design the database:
• Products: FashionHub sells a wide range of products, including clothing, accessories, and
footwear. Each product has a unique product code, name, brand, price, and quantity in stock.
Additionally, each product belongs to a specific category (e.g., shirts, dresses, bags, shoes).
• Stores: The company operates multiple physical stores in different cities. Each store has a
unique store ID, name, address, and contact information.
• Customers: Customers can create accounts with FashionHub to make purchases. Each customer
has a unique customer ID, name, address, phone number, and email. The company also stores
information about customer preferences and purchase history.
• Sales: FashionHub keeps track of sales transactions made by customers. Each sale has a unique
sale ID, date and time, customer ID, and store ID. It also includes the total amount paid, any
discounts applied, and the payment method used (e.g., cash, credit card).
• Employees: The company employs staff members at each store. Each employee has a unique
employee ID, name, address, phone number, and position (e.g., store manager, sales associate).
Design an ER diagram that represents the entities, attributes, relationships, and cardinalities for the
FashionHub database. Consider any necessary assumptions and justify them if required.

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 28 of 107
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>

Course Title Database Management Systems ACADEMIC YEAR: 2023-24


Course Code(s) 22AD2102R Page 29 of 107

You might also like