Unit 1 Mapping Constraints
Unit 1 Mapping Constraints
Program: B.TECH
Course Code:E2UC302B
Course Name: Database Management
System
School of Computing Science and Engineering
Course Code :E2UC302B Course Name: DBMS
Vision
To be known globally as a premier department of Computer
Science and Engineering for value-based education,
multidisciplinary research and innovation.
Mission
M1: Developing a strong foundation in fundamentals of
computing science with responsiveness towards emerging
technologies.
M2: Establishing state-of-the-art facilities and adopt education
4.0 practices to analyze, develop, test and deploy sustainable
ethical IT solutions by involving multiple stakeholders.
M3: Establishing Centers of Excellence for multidisciplinary
collaborative research in association with industry and
academia.
Program Name: B.TECH Program Code: E2UC302B
School of Computing Science and Engineering
Course Code :E2UC302B Course Name: DBMS
Course Prerequisites
Knowledge of Mathematics
Query Languages
Computer must be allocated to one and only one employee but an employee
can be allocated zero or any number of computers.
Integrity Enforced
Types Definition Through
Entity Each table must have a column or a set of columns Primary
Integrity through which we can uniquely identify a row. Key
These column(s) cannot have empty (null) values.
Domain All attributes in a table must have a defined Data Types,
Integrity domain. In addition we can also have value Check
restriction as per business rules e.g. Gender must be Constraint
M or F.
Referential Every value of a column in a table must exist as a Foreign Key
Integrity value of another column in a different (or the same)
table.
Candidate Key
Minimal set of columns/attributes that can be used to uniquely identify a
single tuple in a relation.
Candidate Keys are determined during database design based on the
underlying business rules of the database.
Employee(EmployeeNo, Name, AadharNo, Salary, DateOfBirth)
Candidate Key
Key Rationale
EmployeeNo This seems to be a good candidate key as companies usually issue a
unique number for each employee.
AadharNo This seems to be a good candidate key for a company based in India.
However we have assumed that every employee has an Aadhar
number which may not be true. In addition for a multinational firm
with employees across the globe this will not work at all.
Name, This might work for a small firm of 10 people as a combination of
DateOfBirth Name and Date of Birth is likely to be unique.
Salary This is not a good candidate as salary is generally paid uniformly to
people at same level.
EmployeeNo, It is not a candidate key as EmployeeNo alone is unique. By definition
DateOfBirth only minimal set of attributes can be candidate key.
Mandatory Desired
Must uniquely identify a tuple Should not change with time
Must not allow NULL values Should have short size e.g. numeric
data types
Foreign Key
It is a set of one or more columns in the child table whose values are
required to match with corresponding columns in the parent table.
Foreign key columns on child tables must be primary key or unique on
the parent table.
The child table can contain NULL values. Let us take Employee and
Computer tables as provided below: