Professional Documents
Culture Documents
A Complete Database Design For Shopping Mall
A Complete Database Design For Shopping Mall
A Complete Database Design For Shopping Mall
DBMS
MALL PROJECT
REPORT
DATABASE BCS-2020
A DBMS Project
Submitted By
Baddam Ramesh Reddy, 2020BCS-019
Bhanu Jatin Singh Bainsala, 2020BCS-020
Gandla Askhith, 2020BCS-030
Harshit Agarwal, 2020BCS-037
J J Loknath, 2020BCS-041
Laukik Shah, 2020BCS-050
(Bachelors of Technology in Computer Science)
Through
Atal Bihari Vajpayee
Indian Institute of Information Technology
And Management (ABV-IIITM), Gwalior
ABV-IIITM, GWALIOR |2
ABSTRACT
INDEX
Abstract ............................................................................................................................... 2
Index .................................................................................................................................... 3
1 Introduction .................................................................................................................. 4
The Idea ................................................................................................................ 4
Why we chose this topic? .................................................................................... 4
Project Introduction .............................................................................................. 5
2 METHODOLOGY ........................................................................................................... 6
3 Brainstorming................................................................................................................ 8
The Sections .......................................................................................................... 8
4 ER Diagram................................................................................................................. 17
5 Normalisation ............................................................................................................. 19
6 Implementation ......................................................................................................... 34
Dummy Data ...................................................................................................... 34
Relational Algebra ............................................................................................. 39
SQL ....................................................................................................................... 44
7 Our Learnings ............................................................................................................. 49
8 REFERENCES................................................................................................................ 50
ABV-IIITM, GWALIOR |4
1 INTRODUCTION
The Idea
Shopping malls are one of the favourite shopping places for most of us. They provide
many items or sometimes- all from clothing, footwear to electronics and gaming in
one place—no wonder why some like to spend a whole day there. The concept of
'Shopping mall' has no bounds. They can be from the small number of shops that can
be counted on fingers to so large that it takes a day to visit all the shops. Such large
shopping malls also provide some shared facilities, such as a food court, leisure area,
lawn to sit on or sitting areas for the consumers to spend time and eat something
during shopping so that they do not leave the mall if they are hungry. Obviously, they
earn a high return on these investments.
Managing such large malls is a difficult task. You must have proper systems in place
designed and explicitly altered for your case. These systems involve security, parking
management, IT systems such as CCTV surveillance and common area WIFI and many
more. These include one common task- Database Management. To have a proper
record of all the things and their management, it is essential to have a good database
in place.
Thinking of the designing of databases, there are many topics that can be opted for.
However, the shopping mall database is one of the most complex databases. It
involves many entities whose role is repeated often. For example, an organisation,
Reliance Industries, owns two brands Jio, a telecommunication company and Fresh
Mart, a retail mart chain, both of which have a shop in the mall. Mall also takes IT
services from a subsidiary of Reliance. In this case, there is a possibility of data
redundancy of data of Reliance Industries. It is a challenging task to design a perfect
data model for all needs of the mall. We wanted to do something challenging, out of
the way, which would require a deeper understanding of the concepts and total
dedication. This topic is also fascinating compared to the other 'traditional' database
models that are typically chosen.
ABV-IIITM, GWALIOR |5
Another perspective is the expandability of the project. A shopping mall can range
from just a small collection of shops to an integrated lifestyle mall which includes but
is not limited to the integrated food court, common areas and events in the mall. We
can design features as 'add on' to the work we have already done, such as a library
to spend some time and expand the project as much as desired.
By choosing the topic, we knew that we would acquire more knowledge about
designing databases and their implementation than what we would have acquired
from some other database systems such as a library. We would also be able to
understand the work of the data model designers and appreciate it.
Project Introduction
In the project, we have designed the complete database for the shopping mall,
which may be implemented in real life. The path starts from the virtual visits to the mall
and brainstorming to the demonstration of our model through SQL and Relational
Algebra queries. It also includes normalising the relations involved and mapping entity
and relationship sets into ER diagram. This report explains all the steps and their
outcome in detail.
ABV-IIITM, GWALIOR |6
2 METHODOLOGY
After having an overview of the topic, it was time to dive into it and begin with the
actual work. We began with surfing the web for a better understanding of the topic.
This was a very crucial part of the project. The first problem we faced was that the
malls were closed due to the pandemic, and we could not have an actual visit. To
overcome this, we browsed through the websites of various shopping malls and had
a walk-through of the virtual malls of the internet, observing each little detail and
noting it down. It required us to view the processes and management part of the mall
from the manager's perspective and appreciate their work. We also recalled our
previous visits to the mall.
As we shaped our basic idea and understanding of the mall and its management, we
began to list down the various departments or the sections and their responsibilities
before going to the data model designing. We identified all the entities related to the
mall and how they were related. We made business decisions such as the attributes
to include. The best evidence of this would be the inclusion of records of visitors and
their groups. This includes but not limited to families and friends. Maintaining a record
of groups of visitors was not a necessary part of the management and operations of
the mall, but it would provide valuable business data and analytics which could be
used for business expansion and deciding marketing tactics.
Coming to the data model was the most challenging part of the project. It tested our
understanding of various concepts of the theory. We were required to structure the
data correctly so that there will not be any redundancy and null values. Avoiding
redundancy and null values were the main guidelines for structuring the data model.
For example, a person or an organisation can be related to the mall in different ways.
In such cases, it would have happened that the person has an entry in both the
relations causing data redundancy. For that, we designed the system of recognised
persons and organisations. It would act in a way similar to Aadhaar Card acts for the
Indian citizens. It is used to identify the same person in various places by various
departments and systems. We designed the data model in such a way that its real-
life commercial implementation would be possible without much changes.
Once the data model was done, the task was to identify the entity and relationship
sets and map them into the ER diagram. It also included the identification of
cardinality constraints and the nature of the entity sets. We used the online tool,
draw.io, for designing the ER diagram collaboratively. As our data model is vast, we
ABV-IIITM, GWALIOR |7
could not include all the entity and relationship sets in the ER diagram. We have used
the standard notations taught in the course for the ER diagrams to avoid confusions.
Coming to normalisation, we identified the primary keys and all the functional
dependencies for every relation. Then we analysed and decomposed the table step
by step to the Boyce–Codd Normal Form (BCNF).
The next task was the actual implementational and demonstration of our data model.
For this, we designed some Relational Algebra and SQL queries, showcasing the
actual usage and capability of our data model. The required dummy data was
generated in MS Excel, and some were also obtained through online resources. Then
it was then uploaded to the RelaX - relational algebra calculator, the platform we
used to run the queries. Results can be found in the implementation section.
ABV-IIITM, GWALIOR |8
3 BRAINSTORMING
This section of the report includes the relations that we come up with after the
brainstorming, grouped into sections, for proper organisation of the database. Each
section explains the logic behind the designing of relations and rules for the relations
that it includes.
The Sections
● Person Details
RP Details (RPID, Name, Gender, Address (Line1, Line 2, City, State, PIN), Date of
Birth, domicile state, Phone Number, Email id)
● Person Docs
RP Docs (RPID, Aadhaar, Pan)
● Organisation Details
RO Details (ROID, Registered Name, RO Type, Registration Address (Line1, Line 2,
City, State, PIN), Date of Registration, Phone Number, Email id)
● Organisation Docs
RO Docs (ROID, RegistrationID, GSTN)
● Employee Details
Employee Details (EmployeeID, Category, SupervisorEmployeeID, Type (Direct/
Contracted), DoJ, Salary, RPID)
● Employee Docs
Employee Docs (EmployeeID, BAccountID, Police Verification Certificate, UAN)
● Operator
Operator Details (OperatorID, ROID/RPID)
● Representative
Representative Details (RepresentativeID, RPID)
1. Each property owner and the operator must have a representative. They can
be owner/ operator himself
2. Property operation can only be done by a single operator or organisation. For
partners, they need to form organisation
3. Making total stake percent 100 is not a problem of redundancy or null values.
It is the problem of data validity which is to be solved by other systems.
4. Adding OwnershipType (Single Owner, Partner, Organisation) attribute in
property details increases data redundancy.
5. All Ownership Types (Single Owner/Partner/Organisation) share common
attribute OwnerID. Similarly, all Operator types (Owner/Leased) share
common attribute OperatorID. This is done to avoid splitting a single table into
two.
6. Consider: one owner can own multiple properties, may have the same or
different Representative. Similarly, one operator can operate multiple
properties, may have the same or different Representative.
7. For the Property Owned by table, the primary key would be K (PropertyID,
OwnerID). We would consider DateOfStakeTrxn as the date of the last stake
transaction i.e., buy or sell.
8. Properties operated by the owner also can have two different
representatives- one from the role of owner and one from the role of
operator.
9. One property can have multiple owners, but can only be operated by a
single operator.
10. For the property operated by the owner, we can set its rent and tenure to 0.
● Property Details
Property Details (PropertyID, Property Number, Floor, Area, Description)
1. Every visitor will have VisitorGrpID, which would help us to maintain and
identify the groups of visitors.
2. Visitor is not a recognised person.
3. Group can be of a single person.
4. There is no necessity of forming groups, but it provides much valuable
analytical information.
● Parking Slot
Parking Slot (ParkingID, SectionID, Type (Two/Four-wheeler))
● Visitor Vehicle
Vehicle (VehicleNumber, ParkingID, InTime, OutTime, VisitorID, INTrxnID)
● RP Vehicle
RP Vehicle (VehicleNumber, ParkingID, InTime, OutTime, RPID)
● Visitor
Visitor (VisitorID, VisitorGrpID, Name, Age, BodyTemp, PhoneNumber, InTime,
OutTime)
3.1.7 Assets:
● Assets
Assets (AssetID, AssetGrpID, Location)
● Asset Group
Asset Group (AssetGrpID, InvoiceNo, AssetType, Description)
A B V - I I I T M , G W A L I O R | 12
1. Every shop will have a unique ShopID (Primary Key), We divide shops into their
respective categories like electronics, groceries etc.
2. Shop Owner/ operator will have to maintain employee details in mall's system
3. Same brand can have products in different categories. Different brands can
be owned by the same company.
4. Shop Commodity maintains the list of product categories that a particular
shop sells with BrandID and PriceRange.
● Shop Commodity
Shop Commodity (ShopID, Category, SubCategory, BrandID, PriceRange)
● Shop Details
Shop Details (ShopID, PropertyID, Revenue, MonthlyMaintenance,
RevenueSharingPercentage, DWaterMeterID, NWaterMeterID, ElectricityMeterID)
● Brand Info
Brand Details (BrandID, BrandName, ROIDofBrandOwner)
● Shop Employees
Shop Employees (ShopID, ShopEmployeeID)
1. Manager with no further managers will have their own Eid as Supervisor Eid -
to avoid null values
2. No separate departments
3. Category- Cleaner, Sales man etc
3.1.12 Finance
o Reference Number- For cash it will be generated by system, for bank transfer,
it would be TransferID, for cheque- ChequeID
o Modes of payouts: bank transfer- IMPS, NEFT, RTGS, cheque
o Mode of payments: bank transfer- IMPS, NEFT, RTGS, cheque, cash (only for
parking charges)
7. For the tables Cheque Details, Transfer Details and Bank Accounts, IDs are
created instead of using Cheque Number, UTN and Account Number for
security purposes.
● Payment Receipts
Payment Receipt (ReceiptID, PaymentFrom, Payment For, INTrxnID, Description)
● Payouts
Payouts (InvoiceID, PayoutFor, OUTTrxnID, Description)
● Salary Payout
SPayout (SPayoutID, EmployeeID, ForMonth, OUTTrxnDetails)
● Cheque Details
Cheque (ChequeID, ChequeNumber, BAccountID)
● Transfer Details
Bank Transfer (TransferID, Mode, FromBAccountID, ToBAccountID, UTN)
● Bank Accounts
Bank Account (BAccountID, BankName, AccountNumber, IFSC)
o "Contract Period" is the time period during which the respective organisation
can put up any desired advertisement if they follow the contract rules and
regulation
3. Only Operators or brands can advertise on the advertisement boards of mall-
Indicated by advertiser type
● Advertisement Boards
Board (BoardID, Type, Location, Size)
● Advertiser
Advertiser (AdvID, Type, BrandID/OperatorID)
● Advertisement
Advertisement (AdvertisementID, AdvertiserID, BoardID, Contract Period
(StartDate, EndDate), Fees, Description)
● Services
Service (ServiceID, ServiceFor, ProviderID, Description, Contract Period (StartDate,
EndDate))
4 ER DIAGRAM
5 NORMALISATION
Normalisation is the most crucial part in data bae design. It helps remove
redundancies and anomalies in the database that may have caused problems if kept
unresolved. The process of normalisation to the BCNF form includes various steps such
as listing all the functional dependencies and their analysis. Following is the analysis of
all the relations with functional dependencies and their step-by-step decomposition
to the Boyce–Codd normal form a.k.a. BCNF.
Normalisation
● Person Details
RP Details (RPID, Name, Gender, Address (Line1, Line 2, City, State, PIN), Date of
Birth, domicile state, Phone Number, Email id)
▪ Functional Dependencies:
RPID → Name, Gender, Line1, Line 2, City, State, PIN, Date of Birth, domicile
state, Phone Number, Email id
PIN → City, State
City → State
▪ Functional Dependencies:
RPID → Name, Gender, Line1, Line 2, City, State, PIN, Date of Birth, domicile
state, Phone Number, Email id
PIN → City, State
City → State
A B V - I I I T M , G W A L I O R | 20
● Person Docs
RP Docs (RPID, Aadhaar, Pan)
▪ Functional Dependencies:
RPID → Aadhaar, Pan
▪ Analysis:
RP Docs entity set is dependent on RPDetails for its existence and connected
as well via linking attribute RPID. By reviewing FDs it is clear that the table is in
BCNF form so no further normalisation required.
● Organisation Details
RO Details (ROID, Registered Name, RO Type, Registration Address (Line1, Line 2,
City, State, PIN), Date of Registration, Phone Number, Email id)
• Functional Dependencies:
ROID → Registered Name, RO Type, Registration Address (Line1, Line 2, City,
State, PIN), Date of Registration, Phone Number, Email id
PIN → City, State
City → State
• Functional Dependencies:
RPID → ROID, Registered Name, RO Type, Registration Address (Line1, Line
2, PIN), Date of Registration, Phone Number, Email id
PIN → City, State
City → State
A B V - I I I T M , G W A L I O R | 21
● Organisation Docs
RO Docs (ROID, RegistrationID, GSTN)
▪ Functional Dependencies:
ROID → RegistrationID, GSTN
▪ Analysis:
RO Docs entity set is dependent on RODetails for its existence and connected
as well via linking attribute RPID. By reviewing FDs, it is clear that the relation is
in BCNF form so no further normalisation required.
● Employee Details
Employee Details (EmployeeID, Category, SupervisorEmployeeID, Type (Direct/
Contracted), DoJ, Salary, RPID)
▪ Functional Dependencies:
EmployeeID → Category, SupervisorEmployeeID, Type (Direct/
Contracted), DoJ, Salary, RPID
▪ Analysis:
Employee Details entity set is related with entity sets Employee
Docs, ShopEmployees, ShopEmployee Details, SPayout via linking
attribute EmployeeID and by checking FDs we can determine
that attribute is atomic, no partial and trivial dependency is there. LHS of FDs
are prime attributes so it is already in BCNF form so no further normalisation
required.
● Employee Docs
Employee Docs (EmployeeID, BAccountID, Police Verification Certificate, UAN)
▪ Functional Dependencies:
EmployeeID →BAccountID, Police Verification Certificate, UAN
▪ Analysis:
Employee Docs entity set is dependent on Employee Details for its existence
and as well as connected via linking attribute EmployeeID. Now the table is in
BCNF as LHS of all FDs are key.
A B V - I I I T M , G W A L I O R | 22
● Owner
Owner Details (OwnerID, ROID/RPID)
▪ Functional Dependencies:
OwnerID →ROID/RPID
▪ Analysis:
Owner Details entity sets is related with entity sets Property Owned By via linking
attribute OwnerID. There is no partial dependency, trivial dependency and LHS
of all the FDs are key so the table is in BCNF.
● Operator
Operator Details (OperatorID, ROID/RPID)
▪ Functional Dependencies
OperatorID →ROID
▪ Analysis:
Operator Details entity sets is related with entity sets Property Owned
By, Property Operated By, Promotional Temporary shops, Advertiser via linking
attribute OperatorID. By reviewing FDs, we can say that all
attributes are atomic, no Partial dependency, no trivial dependency so table
is already in 3NF. LHS of all the FDs are key hence it is in BCNF.
● Representative
Representative Details (RepresentativeID, RPID)
▪ Functional Dependencies
RepresentativeID → RPID
▪ Analysis:
Representative Details entity sets is related with entity sets Property Owned By,
Property Operated By, Promotional Temporary shops, Advertiser, Provider via
linking attribute RepresentativeID. By reviewing FDs, we can say that all
attributes are atomic, no Partial dependency, no trivial dependency so table
is already in 3NF. LHS of all the FDs are key hence it is in BCNF.
● Property Details
Property Details (PropertyID, Property Number, Floor, Area, Description)
▪ Functional Dependencies:
PropertyID →Property Number, Floor, Area, Description
A B V - I I I T M , G W A L I O R | 23
▪ Analysis:
Property Details entity sets is related with entity sets Property Owned By,
Property Operated By, Shop Details via linking attribute PropertyID. By
reviewing FDs, we can say that all attributes are atomic, no Partial
dependency, no trivial dependency so table is already in 3NF. LHS of all the FDs
are key hence it is in BCNF.
▪ Functional Dependencies:
PropertyID, OwnerID →DateOfStakeTrxn, Stake %, RepresentativeID
▪ Analysis:
Property Owned by entity sets is related with entity sets
Property Details, Owner Details, Property Operated By, Operator
Details, Representative Details via linking attribute PropertyID, OwnerID. By
reviewing FDs, we can say that all attributes are atomic, no Partial
dependency, no trivial dependency so table is already in 3NF. LHS of all the FDs
are key hence it is in BCNF.
▪ Functional Dependencies:
PropertyID →OperatorID, OperatorType, DateForm, RepresentativeID, Rent,
tenure
▪ Analysis:
Property Operated By entity sets are related with entity sets Property Owned
By, Property Details, Operator Details, Representative Details via linking
attribute PropertyID. By reviewing FDs, we can say that all attributes are
atomic, no Partial dependency, no trivial dependency so table is already in
3NF. LHS of all the FDs are key hence it is in BCNF.
● Parking Slot
Parking Slot (ParkingID, SectionID, Type (Two/Four-wheeler))
▪ Functional dependencies:
A B V - I I I T M , G W A L I O R | 24
▪ Analysis:
All the attributes of the table are atomic, and the only
functional dependency exists is of the primary key. Additionally, primary key is
also atomic. Also, there is no transitive dependency involving non-
prime attributes so it's in 3NF. And, LHS is candidate key Hence the table is in
BCNF.
● Visitor Vehicle
Vehicle (VehicleNumber, ParkingID, InTime, OutTime, VisitorID, INTrxnID)
▪ Functional dependencies:
VehicleNumber, InTime → Intime, ParkingID, OutTIme, VisitorID, INTrxnID.
▪ Analysis:
All the attributes of table are atomic, as well as there is no partial dependency.
Hence the table is in 2NF. And, there does not exists any transitive dependency
involving non-prime attributes, so the it is in 3NF. Further, all
the dependencies have prime attributes on their LHS. Hence the tables are
now converted to BCNF
● RP Vehicle
RP Vehicle (VehicleNumber, ParkingID, InTime, OutTime, RPID)
▪ Functional dependencies:
VehicleNumber, InTime → Intime, ParkingID, OutTime, RPID.
▪ Analysis:
All the attributes of the table are atomic, and the only
functional dependency exists is of the primary key. Additionally, primary key is
also atomic. Also, there is no transitive dependency involving non-
prime attributes so it's in 3NF. And, LHS is candidate key Hence the table is in
BCNF. Here RP vehicle entity set is only for the Representative persons who
working in mall. And here vehicle Number, InTime is the candidate key
which uniquely identify all the attributes.
● Visitor
Visitor (VisitorID, VisitorGrpID, Name, Age, BodyTemp, PhoneNumber, InTime,
OutTime)
▪ Functional dependencies:
A B V - I I I T M , G W A L I O R | 25
▪ Analysis:
All the attributes of the table are atomic, and the only
functional dependency exists is of the primary key. Additionally, primary key is
also atomic and here only VisitorID is the primary key. Also, there is
no transitive dependency involving non-prime attributes so it's in 3NF. And, LHS
is candidate key Hence the table is in BCNF.
5.1.7 Assets:
● Assets
Assets (AssetID, AssetGrpID, Location)
▪ Functional dependencies:
AssetID → AssetGroupID, Location
▪ Analysis:
All the attributes of table are atomic, as well as there is no partial dependency.
Hence the table is in 2NF. It is already in 3NF as there is no transitive depending
involving non- prime attributes. Therefore, the table BCNF.
● Asset Group
Asset Group (AssetGrpID, InvoiceNo, AssetType, Description)
▪ Functional dependencies:
AssetGrpID → InvoiceNo, AssetType, Description
▪ Analysis:
All the attributes of the table are atomic, and the only
functional dependency exists is of the primary key. Additionally, primary key is
also atomic. Also, there is no transitive dependency involving non-
prime attributes so it's in 3NF. And, LHS is candidate key Hence the table is in
BCNF.
● Shop Commodity
Shop Commodity (ShopID, Category, Subcategory, BrandID, PriceRange)
▪ Functional Dependencies:
ShopID, BrandID, Category, Subcategory → PriceRange
▪ Analysis:
A B V - I I I T M , G W A L I O R | 26
This entity set is related to entity set Shop Details, via linking attribute 'ShopID'.
Further, As the entity is dependent on entity set 'Shop Details' for existence, it is
weak entity set. And all the attributes are atomic and there is no partial
dependency so it is 2NF and LHS attributes is the candidate key involving prime
attributes and there is no transitive dependency in the non-prime attributes so
it is 3NF and BCNF.
● Shop Details
Shop Details (ShopID, PropertyID, Revenue, MonthlyMaintenance,
RevenueSharingPercentage, DWaterMeterID, NWaterMeterID, ElectricityMeterID)
▪ Functional Dependencies:
ShopID → PropertyID, Revenue, MonthlyMaintenance, RevenueSharingPerce
ntage, DWaterMeterID, NWaterMeterID, ElectricityMeterID
▪ Analysis:
The shop details entity set has strong entity set which will determine shop
commodity entity set which is weak entity set. Without ShopID there is no shop
commodity entity set. Here ShopID is the candidate key. All the attributes of the
table are atomic, and the only functional dependency exists is of the primary
key. Additionally, primary key is also atomic and here only VisitorID is the
primary key. Also, there is no transitive dependency involving non-
prime attributes so it's in 3NF. And, LHS is candidate key Hence the table is in
BCNF.
● Brand Info
Brand Details (BrandID, BrandName, ROIDofBrandOwner)
▪ Functional Dependencies:
BrandID → BrandName, ROIDofBrandOwner
▪ Analysis:
The entity set Brand details will all the brands which are going to sell their items
through the mall. Here BrandID is the candidate key which will determine all
the attributes. All the attributes of the table are atomic, and the only
functional dependency exists is of the primary key. Additionally, primary key is
also atomic and here only VisitorID is the primary key. Also, there is
no transitive dependency involving non-prime attributes so it's in 3NF. And, LHS
is candidate key Hence the table is in BCNF.
A B V - I I I T M , G W A L I O R | 27
● Shop Employees
Shop Employees (ShopID, ShopEmployeeID)
▪ Functional Dependencies:
ShopEmployeeID → ShopID
▪ Functional Dependencies:
ShopEmployeeID → Category, SupervisorEmployeeID, Type
(Direct/Contracted), DoJ, RPID
▪ Functional Dependencies:
ElectricityMeterID → Last Reading, This Reading, Consumer Number
A B V - I I I T M , G W A L I O R | 28
▪ Functional Dependencies:
DWaterMeterID → Last Reading, This Reading
▪ Functional dependencies:
NWaterMeterID → Last Reading, This Reading
5.1.12 Finance
● Payment Receipts
Payment Receipt (ReceiptID, PaymentFrom, Payment For, INTrxnID, Description)
A B V - I I I T M , G W A L I O R | 29
▪ Functional Dependencies:
ReceiptID → PaymentFrom, PaymentFor, INTrxnID, Description
▪ Analysis:
All the attributes of table are atomic, as well as there is no partial dependency.
Hence the table is in 2NF. And, there does not exists any transitive dependency
involving non-prime attributes, so the it is in 3NF. There are no trouble-
causing dependencies in this entity set. Further, all the dependencies have
prime attributes on their LHS. Hence the tables are now converted to BCNF
● Payouts
Payouts (InvoiceID, PayoutFor, OUTTrxnID, Description)
▪ Functional Dependencies:
InvoiceID → PayoutFor, OUTTrxn, Description
▪ Analysis:
All the attributes of table are atomic, as well as there is no partial dependency.
Hence the table is in 2NF. And, there does not exists any transitive dependency
involving non-prime attributes, so the it is in 3NF. There are no trouble-
causing dependencies in this entity set. Further, all the dependencies have
prime attributes on their LHS. Hence the tables are now converted to BCNF.
● Salary Payout
SPayout (SPayoutID, EmployeeID, ForMonth, OUTTrxnDetails)
▪ Functional Dependencies:
SPayoutID → EmployeeID, ForMonth, OUTTrxnDetails
▪ Analysis:
SPayout entity set will list Finance which were using in the mall. SPayoutID is
unique so it is the candidate key in the entity set. By looking into the functional
dependencies, the entity set is in BCNF so it doesn't require additional
normalisation.
▪ Functional Dependencies:
INTrxnID → Amount, ModeOfPayment, DateTime, ReferenceNumber
▪ Analysis:
All the attributes of table are atomic, as well as there is no partial dependency.
Hence the table is in 2NF. And, there does not exists any transitive dependency
A B V - I I I T M , G W A L I O R | 30
▪ Functional Dependencies:
OUTTrxnID → Amount, ModeOfPayout, DateTime, ReferenceNumber
▪ Analysis:
OUTTrxnDetails entity set will list Finance which were using in the
mall. OUTTrxnID is unique so it is the candidate key in the entity set. By looking
into the functional dependencies, the entity set is in BCNF so it doesn't require
additional normalisation.
● Cheque Details
Cheque (ChequeID, ChequeNumber, BAccountID)
▪ Functional Dependencies:
ChequeID → ChequeNumber, BAccountID
▪ Analysis:
All the attributes of table are atomic, as well as there is no partial dependency.
Hence the table is in 2NF. And, there does not exists any transitive dependency
involving non-prime attributes, so the it is in 3NF. There are no trouble-
causing dependencies in this entity set. Further, all the dependencies have
prime attributes on their LHS. Hence the tables are now converted to BCNF
● Transfer Details
Bank Transfer (TransferID, Mode, FromBAccountID, ToBAccountID, UTN)
▪ Functional Dependencies:
TransferID → Mode, FromBAccountID, ToBAccountID, UTN
▪ Analysis:
Bank Transfer entity set will list Drinking Water details which were using in the
mall. TransferID is unique so it is the candidate key in the entity set. By looking
into the functional dependencies, the entity set is in BCNF so it doesn't require
additional normalisation.
A B V - I I I T M , G W A L I O R | 31
● Bank Accounts
Bank Account (BAccountID, BankName, AccountNumber, IFSC)
▪ Functional Dependencies:
BAccountID → AccountNumber, BankName, AccountNumber, IFSC
IFSC→ Bank Name
▪ Analysis:
Bank Accounts entity set lists all the bank accounts which are being used in the
mall. BAccountID is unique so it is the candidate key in the entity set. By looking
into the functional dependencies, we can see that there is transitive functional
dependency
IFSC→ Bank Name
▪ Functional Dependencies:
BAccountID → AccountNumber, BankName, AccountNumber, IFSC
IFSC→ Bank Name
▪ Analysis:
Now there is no FD involving non-prime attribute, as well as there is no functional
dependency with non-prime attribute on LHS. Hence the tables are in BCNF.
● Advertisement Boards
Board (BoardID, Type, Location, Size)
▪ Functional Dependencies:
BoardID → Type, Location, Size
▪ Analysis:
BoardID entity set will list Drinking Water details which were using in the
mall. BoardID is unique so it is the candidate key in the entity set. By looking into
the functional dependencies, the entity set is in BCNF so it doesn't require
additional normalisation.
● Advertiser
Advertiser (AdvID, Type, BrandID/OperatorID)
▪ Functional Dependencies:
AdvID → Type, BrandID/OperatorID
A B V - I I I T M , G W A L I O R | 32
▪ Analysis:
Advertiser entity set is dependent on Advertisement for its existence and
connected as well via linking attribute AdvertiserID. By reviewing FDs, it is clear
that the table is in BCNF form so no further normalisation required.
● Advertisement
Advertisement (AdvertisementID, AdvertiserID, BoardID, Contract Period
(StartDate, EndDate), Fees, Description)
▪ Functional Dependencies:
AdvertisementID → AdvertiserID, BoardID, Contract Period, Fees, Description
▪ Analysis:
Advertisement entity set is dependent on Advertiser for its existence and
connected as well via linking attribute AdvertiserID. By reviewing FDs it is clear
that the table is in BCNF form so no further normalisation required.
● Services
Service (ServiceID, ServiceFor, ProviderID, Description, Contract Period (StartDate,
EndDate))
▪ Functional Dependencies:
ServiceID → ServiceFor, ProviderID, Description, Contract Period
▪ Analysis:
ServiceID entity set will list Drinking Water details which were using in the
mall. ServiceID is unique so it is the candidate key in the entity set. By looking
into the functional dependencies, the entity set is in BCNF so it doesn't require
additional normalisation
▪ Functional Dependencies:
ProviderID → ROID, RepresentativeID, Description
▪ Analysis:
ProviderID entity set will list Drinking Water details which were using in the
mall. ProviderID is unique so it is the candidate key in the entity set. By looking
into the functional dependencies, the entity set is in BCNF so it doesn't require
additional normalisation.
A B V - I I I T M , G W A L I O R | 33
▪ Functional Dependencies:
TempShopID → ShopFor, OperatorID, RepresentativeID, Description, Period
▪ Analysis:
TempShopID entity set will list Drinking Water details which were using in the
mall. TempShopID is unique so it is the candidate key in the entity set. By looking
into the functional dependencies, the entity set is in BCNF so it doesn't require
additional normalisation.
▪ Functional Dependencies:
TreeName → Numbers, Indoor/Outdoor
▪ Analysis:
All the attributes of table are atomic, as well as there is no partial dependency.
Hence the table is in 2NF. And, there does not exists any transitive dependency
involving non-prime attributes, so the it is in 3NF. There are no trouble-
causing dependencies in this entity set. Further, all the dependencies have
prime attributes on their LHS. Hence the tables are now converted to BCNF.
A B V - I I I T M , G W A L I O R | 34
6 IMPLEMENTATION
The feasibly of the data model can be demonstrated by running sample queries in
relational algebra and SQL. We have used the RelaX - relational algebra calculator
platform to create the database, populating it with dummy data and running the
ReAlg and SQL queries. The dummy data, queries and outputs can be found below.
Dummy Data
Phone_
RPID name Gender DOB State Email_Id
number
'RP_0001' 'Govardhan' 'Male' '02/03/1996' 'Telangana' 8903384682 'Govardhan123@gmail.com'
'RP_0002' 'Manish' 'Male' '04/06/1981' 'Andhra Pradesh' 6848866489 'Manish_mal@gmail.com'
'RP_0003' 'Shrikanth' 'Male' '06/07/1980' 'Madhyapradesh' 8902787462 'shri@yahoo.in'
'RP_0004' 'Raji' 'Female' '02/06/1988' 'Tamilnadu' 7890387463 'raji23@gmai.com'
'RP_0005' 'Mousa' 'Male' '09/01/1990' 'Bihar' 9003874628 'Mousa@yahooo.in'
'RP_0006' 'Abdul' 'Male' '08/01/1980' 'Delhi' 9048982676 'Abdul@gmail.com'
'RP_0007' 'Sunil' 'Male' '08/06/1995' 'Karnataka' 8938746274 'sunil224@gmail.com'
'RP_0008' 'Krish' 'Male' '22/03/1979' 'Gujarat' 6847200482 'Krish278@yahoo.com'
'RP_0009' 'Marcel' 'Male' '21/05/1991' 'Punjab' 6849028748 'Marcellus2028@gmail.com'
'RP_0010' 'Ram' 'Male' '18/11/1992' 'Uttarpradesh' 9098625479 'Ram@gmail.com'
'RP_0011' 'Klaus' 'Male' '20/12/1988' 'Tamilnadu' 8902846268 'Klaus1000@gmail.com'
'RP_0012' 'Elijah' 'Male' '28/05/1975' 'Maharasthra' 7820044862 'Elijah1004@gmail.com'
'RP_0013' 'Rebekah' 'Female' '06/06/1980' 'Punjab' 8745627902 'Rebekah998@gmail.com'
'RP_0014' 'Vishali' 'Female' '24/02/1978' 'Orissa' 8018465628 'Vishali224@yahoo.com'
'RP_0015' 'Preran' 'Male' '21/03/1976' 'Rajasthan' 6536820009 'preran@gmail.com'
'RP_0016' 'Camile' 'Female' '30/08/1974' 'Karnataka' 9019846629 'cami1990@gmail.com'
A B V - I I I T M , G W A L I O R | 35
Monthly_
Shop_ID Property_ID Revenue Revenue_sharing_per
maintenance
'SH_0001' 'PR_0001' 500000 8000 7
'SH_0002' 'PR_0002' 600000 6000 8.95
'SH_0003' 'PR_0003' 400000 4500 6.34
'SH_0004' 'PR_0004' 350000 7600 4.98
'SH_0005' 'PR_0005' 450000 9200 8.85
'SH_0006' 'PR_0006' 355000 8260 6.63
'SH_0007' 'PR_0007' 320000 8660 8
'SH_0008' 'PR_0008' 285000 9060 4.5
'SH_0009' 'PR_0009' 250000 9460 3.5
'SH_0010' 'PR_0010' 215000 9860 3.25
'SH_0011' 'PR_0011' 180000 3600 4
'SH_0012' 'PR_0012' 145000 4800 2.5
'SH_0013' 'PR_0013' 110000 7200 2.5
'SH_0014' 'PR_0014' 75000 2500 3
'SH_0015' 'PR_0015' 40000 4300 2
'SH_0016' 'PR_0016' 505500 4210 9
'SH_0017' 'PR_0017' 330000 4120 7.5
'SH_0018' 'PR_0018' 440000 4030 7.5
6.1.5 Visitor
Relational Algebra
6.2.1 Find the Shop_ID and Property_ID of those shops which are on 4 th floor
and having Owner with OwnerID OW_0004.
Query:
π Shop_ID, Property_ID (σ Floor=4 ∧ Owner_ID= 'OW_0004' (SHOP_DETAILS ⨝
(PROPERTY_DETAILS ⨝ property_Owned)))
Screenshot:
Output:
A B V - I I I T M , G W A L I O R | 40
6.2.2 Find the VisitorID and Vehicle number of visitors who has their 2-
wheeler parked in section-B
Query:
π Visitor_ID, Vehicle_Number (σ Type='2' ∧ Section_ID= 'Sec_B' (VISITOR ⨝
(VISITOR_VEHICLE ⨝ PARKING_SLOT)))
Screenshot:
Output:
A B V - I I I T M , G W A L I O R | 41
6.2.3 Find the IDs of recognised persons who are in the cashier position and
are contracted.
Query:
π RPID (σ category='Cashier' ∧ Type= 'Contracted' (Recognized_persons ⨝
Employee_Details))
Screenshot:
Output:
A B V - I I I T M , G W A L I O R | 42
6.2.4 Find the list of all owners who has a stake in more than one property
and has the same Representative for at least two of them.
Query:
π p1.Owner_ID (σ (p1.Property_ID ≠ p2.Property_ID) ∧(p1.Representative_ID =
p2.Representative_ID) ∧ (p1.Owner_ID=p2.Owner_ID) ( ρ p1 (property_Owned)
⨯ ρ p2 (property_Owned)) )
Screenshot:
Output:
A B V - I I I T M , G W A L I O R | 43
6.2.5 Find the list of employees who are of same category and have more
salary than the other.
Query:
π e1.Emp_ID, e2.Emp_ID (σ (e1.category = e2.category) ∧(e1.Salary >
e2.Salary) ( ρ e1 (Employee_Details) ⨯ ρ e2 (Employee_Details)) )
Screenshot:
Output:
A B V - I I I T M , G W A L I O R | 44
SQL
6.3.1 Find the Shop_ID and Property_ID of those shops on the 4th floor and
have Owner with OwnerID OW_0004.
Query:
SELECT SHOP_DETAILS.Shop_ID,SHOP_DETAILS.Property_ID
FROM
SHOP_DETAILS NATURAL JOIN PROPERTY_DETAILS NATURAL JOIN Property_Owned
WHERE Property_Owned.Owner_ID = 'OW_0004' AND PROPERTY_DETAILS.Floor = 4;
Screenshot:
Output:
A B V - I I I T M , G W A L I O R | 45
6.3.2 Find the VisitorID and Vehicle number of visitors who has their 2-
wheeler parked in section-B
Query:
SELECT VISITOR.Visitor_ID, VISITOR_VEHICLE.Vehicle_Number
FROM VISITOR NATURAL JOIN VISITOR_VEHICLE NATURAL JOIN PARKING_SLOT
WHERE PARKING_SLOT.Type = '2' AND PARKING_SLOT.Section_ID = 'Sec_B';
Screenshot:
Output:
A B V - I I I T M , G W A L I O R | 46
6.3.3 Find the IDs of recognised persons who are in the cashier position and
are contracted.
Query:
SELECT Recognized_persons.RPID
FROM Recognized_persons NATURAL JOIN Employee_Details
WHERE Employee_Details.category = 'Cashier' AND Employee_Details.Type =
'Contracted';
Screenshot:
Output:
A B V - I I I T M , G W A L I O R | 47
6.3.4 Find the list of all owners who have a stake in more than one property
and have the same Representative for at least two of them.
Query:
SELECT p1.Owner_ID
FROM Property_Owned AS p1, Property_Owned AS p2
WHERE p1.Property_ID != p2.Property_ID AND p1.Representative_ID =
p2.Representative_ID AND p1.Owner_ID = p2.Owner_ID;
Screenshot:
Output:
A B V - I I I T M , G W A L I O R | 48
6.3.5 Find the list of employees who are of the same category and have
more salary than the other.
Query:
SELECT e1.Emp_ID ,e2.Emp_ID
FROM Employee_Details AS e1, Employee_Details AS e2
WHERE e1.category = e2.category
AND e1.Salary > e2.Salary;
Screenshot:
Output:
A B V - I I I T M , G W A L I O R | 49
7 OUR LEARNINGS
During the course of this project, we have learnt quite a few things. Most important of
all was the development of the skills specific to collaborative efforts and
communication.
In this project, we have chosen to work on Shopping Mall Database Model. In order
to try to make this model as accurate and practical as possible, we had extensively
researched how a shopping mall works and tried to grasp all the aspects on which a
successful Mall is built. This itself increased the communications between the members
of the group and broadened our mind. This also helped us identify entity sets and
attributes that would be used to build a good database model. All our knowledge will
undoubtedly assist us in the future.
Drawing the ER Model was a difficult task as incorporating so many entities set into it
was complex. Also creating tables and inserting data into them, was though a tedious
work, it was a huge practice for us. Trying to incorporate various things in our queries
was especially a fun part as we ourselves had to think of a problem and try to make
query to solve that. Nonetheless, after completing it, we had an even more precise
image of our data-model looks and how the ER diagram helped us visualise the
database design.
8 REFERENCES
• Reference Articles
http://users.csc.calpoly.edu/~jdalbey/205/Lectures/HOWTO-ERD.html
http://www.cis.drexel.edu/faculty/song/courses/info%20605/appendix/Appe
ndixA.PDF