On DBMS
On DBMS
On DBMS
Management
System
Dr. Shiv Kumar
Session Objectives
Basic Concepts
Data Models
Advantages of Database Approach
Overview of E-R Modeling
Data Modeling
Entity
Attributes
Relationships
Key Concepts
Normalization
Basic Normal Forms (restricted up to 3 NF)
Overview of SQL
Database Management System
Imagine if you turned on a computer, started the
word processor, but could not save a document
Imagine if you opened a music player but there
was no music to play
Imagine opening a web browser but there were no
web pages
Information
By itself, data is not that useful. To be useful, it needs to be
given context.
Processed data is called information
The purpose of data processing is to generate the meaningful
information
Cont…
Field, Record & File
In a database table, a field is a data structure for a single piece of data. A
combination of fields makes up a table, which contain all the
information within the table relevant to a specific entity. A record is
one instance of a set of fields in a table. Multiple data records make up
a table or data file. Files store data information
For example, in a table called Student, the Enrollment number would likely be
a field in a row that would also contain other fields such as Student Name,
Class, Address and Pin Code. The records make up the table rows and the
fields make up the columns
Database
Database
A database is an organized collection of related
information. It is an organized collection, because in
a database, all data is described and associated with
other data. All information in a database should
be related as well
Data Sharing
The integration of the whole data in an organization leads to the ability
to produce more information from a given amount of data
Data Independence
The system data descriptions are separated from the application
programs. Changes to the data structure is handled by the DBMS and
not embedded in the program.
Benefits of DBMS
Providing multiple views of data
A view may be a subset of the database. Various users may have
different views of the database itself.
Users may not need to be aware of how and where the data they refer
to is stored
Levels
courses, subjects)
The relationships between data items (e.g., students are supervised by
Relational Model
Network Model
Hierarchical Model
Relational Model
The relational model represents data as relations, or tables.
Relationships between data items are expressed by means
of tables. It is a database that maintains a set of separate,
related files (tables), but combines data elements from the
files for queries and reports when required
Example:
Relational database comprising of two tables
Customer –Table
Account –Table
Relational Model
Customer –Table
Customer Customer ID Address City Account
Name Number
Amit Kumar 345678 Sector 8 Gurugram K-100
Mohit Dutta 345679 Dwarka Delhi K-302
Pawan Singh 345122 Salt Lake Kolkata K-113
Pooja Garg 345103 First Lane Agra K-201
Amy 345221 3/114 C Chandigarh K-415
Account –Table
Account Number Balance
K-100 5000.00
K-302 12000.00
K-113 3500.00
K-201 250000.00
K-415 12000.00
Network Model
The network model represents data as record types. The relationships
between data are represented by links. The network database model is
very similar to the hierarchical model. However, instead of using a single-
parent tree hierarchy, the network model uses set theory to provide a
tree-like hierarchy with the exception that the child tables were allowed
to have more than one parent
Hierarchical Model
The hierarchical database stores data in a series of records. These records
have a set of field values attached to them. All instances of a specific
record are collected together as a "record type". It uses "Parent Child
Relationships" to create links between record types. It does this by using
trees
Database Management Systems:
Classification
1 Relationship
1
Entity Entity
Relationship
One-to-many − These are the most common relationships and exist
when one entity can be related to more than one other entity
O M
Entity Relationship Entity
Relationship
Many-to-Many − This relationship exists when one entity can be
related to multiple entities of the same type of the original entity
M M
Entity Relationship Entity
Keys
An important constraint on an entity is the key. The key is an attribute or a
group of attributes whose values can be used to uniquely identify an individual
entity in an entity set.
Types of Keys
Candidate
Composite
Primary
Foreign
Alternate
Types of Keys
Candidate Key
A candidate key is a simple or composite key that is unique. It is unique
because no two rows in a table may have the same value at any time
Composite Key
It consists of more than one attribute to uniquely identify rows (tuples) in a
table is called composite key
Keys
Primary Key
The primary key is a candidate key that is selected by the database designer to be used as an identifying
mechanism for the whole entity set. It must uniquely identify tuples in a table. A table cannot have more than
one primary key
Foreign Key
A foreign key (FK) is an attribute in a table that references the primary key in another table. They act as a cross-
reference between tables
Alternate Key
Alternate keys are all candidate keys not chosen as the primary key.
ER Modeling Steps
Identify the entities
Find relationships
Identify the key attributes for every entity
Identify other relevant attributes
Complete E-R diagram
Review
ER Diagram Notations
Entity Weak Entity
Relationship
Multivalued Derived
Attribute Attribute
O M
Cardinality Entity Entity
Normalization
An entity relation diagram (ERD) provides the big picture,
or macro view, of an organization’s data requirements and
operations. This is created through an iterative process
that involves identifying relevant entities, their attributes
and their relationships
Table: Customer
Customer Address Movies Salutation Category
Name Rented
Amit Jain Sector 4 DDLJ Mr. Romantic
Amit Jain Sector 4 Don Mr. Action
Yash Dev Model Town Karz Mr. Drama
Yash Dev Model Town Bazigar Mr. Thriller
Yash Dev 5th Avenue Yarana Dr. Drama
Normalization Levels
For the second normal form, the relation must first be in 1NF and there should be
single column Primary Key.
1 DDLJ
1 Don
2 Karz
2 Bazigar
3 Yarana
Normalization Levels
3 Yarana
Overview of SQL
SQL stands for Structured Query Language. SQL is used to
communicate with a database. According to ANSI
(American National Standards Institute), it is the standard
language for relational database management systems
SQL was initially developed by IBM in the early 1970s and the
initial version was SEQUEL(Structured English Query Language)
https://cnx.org/contents/tXuHYGiY@1/Database-System-Concepts
https://bus206.pressbooks.com/chapter/chapter-4-data-and-databases/
https://www.guru99.com/er-diagram-tutorial-dbms.html