DataBase System CH - 1 and 2
DataBase System CH - 1 and 2
Introduction
Produces output
Play a critical role in almost all areas where computers are used,
including Business, Engineering, Medicine, Law, Education, And
Library Science, Etc.
The cost and risk during conversion from the old to the new system
Defining database
Constructing database
DBMS.
maintain databases.
These facilities will help the designer, the user as well as the
constraints
04/15/2021 Database System 15
Con’t…
database.
data model
Since the required data or Query by the user will be extracted using
how
04/15/2021 it is to be retrieved
Database System 17
Con’t…
parents.
attributes.
model
Entity - Relationship (E/R) : Views the real world as a set of basic objects (entities)
and relationships among these objects.
Attribute: describes the entity, such as the invoice date or the customer first name.
Eg “EMPLOYEES”(EMPLOYEE1, EMPLOYEE2,
EMPLOYEE3,etc ) entity set represents all the set of employees
Identifiers or
Descriptors.
superkeys.
Alternate key: All the keys which are not primary key are called an
alternate key. It is a candidate key which is currently not the primary
key. However, A table may have single or multiple choices for the
primary key.
Example: In this table. StudID, Roll No, Email are qualified to become
a primary key. But since StudID is the primary key, Roll No, Email
becomes the alternative key.
The Primary key should be selected from the candidate keys. Every
table must have at least a single candidate key.
the composite key may or maybe not a part of the foreign key.
Types of constraints
NOT NULL
UNIQUE
DEFAULT
CHECK
Key Constraints – PRIMARY KEY, FOREIGN KEY
Mapping constraints
Domain constraints
04/15/2021 Database System 2-20
Cont..
NOT NULL: constraint makes sure that a column does not hold NULL
value. When we don’t provide value for a particular column while
inserting a record into a table, it takes NULL value by default.
Key constraints:
Mapping Cardinality:
Domain constraints: Each table has certain set of columns and each
column allows a same type of data, based on its data type. The column
does not accept values of any other data type.
Domain Constraint = data type + Constraints (NOT NULL /
UNIQUE / PRIMARY KEY / FOREIGN KEY / CHECK /
DEFAULT)
The above table is not normalized. We will see the problems that we
face when a table is not normalized.
Conversion to 2NF
A → B:
A is a super key
5. What is ODL ? Explain with neat diagram and compare with E/R.