Mod_1
Mod_1
BCS403
MODULE-1
Introduction to Databases
Course Coordinator
Dr Archana R A
✔ What is DBMS
✔ Course Outcomes
18/03/25
Department of Computer Science and Business
2
systems
Contents
1. Topics of Module-1
2. Learning Objectives
3. Basic Definitions of Database Concepts
4. Database system environment
5. Main Characteristics of the Database Approach
6. Advantages of using the DBMS Approach
7. Historical Development of Database Technology
8. Database Languages and Architectures
9. Schemas versus Instances with examples
10. Conclusion
18/03/25
Department of Computer Science and Business
3
systems
Module-1
Introduction to Databases
18/03/25
Department of Computer Science and Business
4
systems
Topics of Module-1
Introduction to Databases: Introduction, Characteristics of database approach,
Advantages of using the DBMS approach, History of database applications.
Overview of Database Languages and Architectures: Data Models,
Schemas, and Instances. Three schema architecture and data independence,
database languages, and interfaces, The Database System environment.
Conceptual Data Modelling using Entities and Relationships: Entity types,
Entity sets, attributes, roles, and structural constraints, Weak entity types, ER
diagrams, examples, Specialization and Generalization.
10 Hours
Textbook 1:Ch 1.1 to 1.8, 2.1 to 2.6, 3.1 to 3.10
Text Books:
1. Fundamentals of Database Systems, Ramez Elmasri and Shamkant B.
Navathe, 7th Edition, 2017, Pearson.
2. Database management systems, Ramakrishnan, and Gehrke, 3rd Edition,
2014, McGraw Hill
18/03/25
Department of Computer Science and Business
5
systems
Learning Objectives
18/03/25
Department of Computer Science and Business
6
systems
Quote for the Day
With data collection, ‘the sooner the better’ is always the best answer.”
- Marissa Mayer
American businesswoman and investor
“You can have data without information, but you cannot have
information without data.”
- Daniel Keys Moran
American computer programmer and science fiction writer
18/03/25
Department of Computer Science and Business
7
systems
Basic Definitions
18/03/25
Department of Computer Science and Business
8
systems
Basic Definitions (Cont…)
Database System
DBMS Software
18/03/25
Department of Computer Science and Business
10
systems
Main Characteristics of the Database Approach (
Cont…)
2. Insulation between programs and data:
3. Data Abstraction:
• A data model is used to hide storage details and present the users with a
conceptual view of the database.
• Programs refer to the data model constructs rather than data storage
details
4. Support of Multiple views of the data:
• Each user may see a different view of the database, which describes
only the data of interest to that user.
18/03/25
Department of Computer Science and Business
11
systems
Main Characteristics of the Database Approach (
Cont…)
5. Sharing of data and multi-user transaction
processing:
18/03/25
Department of Computer Science and Business
12
systems
Disadvantages of Traditional File
system
1) Data Redundancy : Since each application has its own data file, the same data may
have to be recorded and stored in many files. For example, personal file and payroll
file, both contain data on employee name, designation etc. The result is unnecessary
duplicate or redundant data items. This redundancy requires additional or higher
storage space, costs extra time and money, and requires additional efforts to keep all
files upto-date.
2) Data Inconsistency :Data redundancy leads to data inconsistency especially when
data is to be updated. Data inconsistency occurs due to the same data items that
appear in more than one file do not get updated simultaneously in each and every file.
For example, an employee is promoted from Clerk to Superintendent and the same is
immediately updated in the payroll file may not necessarily be updated in
provident fund file. This results in two different designations of an employee at the
same time. Over the period of time, such discrepencis degrade the quality of
information contain in the data file that affects the accuracy of reports.
3/18/25
Department of Computer Science and Business
13
systems
3) Lack of Data Integration : Since independent data file exists, users face difficulty in
getting information on any adhoc query that requires accessing the data stored in
many files. In such acase complicated programs have to be developed to
retrieve data from every file or the users have to manually collect the required
information.
4) Program Dependence: The reports produced by the file processing system are
program dependent, which means if any change in the format or structure of data and
records in the file is to be made, the programs have to modified correspondingly.
Also, a new program will have to be developed to produce a new report.
5) Data Dependence :The Applications/programs in file processing system are data
dependent i.e., the file organization, its physical location and retrieval from the storage
media are dictated by the requirements of the particular application. For example, in
payroll application, the file may be organized on employee records sorted on their last
name, which implies that accessing of any employee's record has to be through the last
nameonly.
3/18/25
Department of Computer Science and Business
14
systems
6) Limited Data Sharing :There is limited data sharing possibilities
with the traditional filesystem. Each application has its own private
files and users have little choice to share the data outside their own
applications. Complex programs required to be written to obtain data
from several incompatible files.
7) Poor Data Control :There was no centralised control at the data
element level, hence a traditional file system is decentralised in
nature.
3/18/25
Department of Computer Science and Business
15
systems
Advantages of using the DBMS Approach
(Cont…)
• Controlling redundancy in data storage and in development and
maintenance efforts.
• Sharing of data among multiple users.
• Restricting unauthorized access to data.
• Providing persistent storage for program Objects
• Providing Storage Structures (e.g. indexes) for efficient Query
Processing.
• Providing backup and recovery services.
• Providing multiple interfaces to different classes of users.
• Representing complex relationships among data.
• Enforcing integrity constraints on the database.
• Drawing inferences and actions from the stored data using deductive
and active rules
18/03/25
Department of Computer Science and Business
16
systems
Historical Development of Database
Technology
Early Database Applications:
18/03/25
Department of Computer Science and Business
17
systems
Historical Development of Database Technology
(Cont…)
Object-oriented and emerging applications:
• Object-Oriented Database Management Systems (OODBMSs) were
introduced in late 1980s and early 1990s to cater to the need of complex
data processing in CAD and other applications.
• Many relational DBMSs have incorporated object database concepts,
leading to a new category called object-relational DBMSs (ORDBMSs)
• Extended relational systems add further capabilities (e.g. for multimedia
data, XML, and other data types)
• Scientific Applications
• XML (eXtensible Markup Language)
• Image Storage and Management
• Audio and Video Data Management
• Data Warehousing and Data Mining
• Spatial Data Management
• Time Series and Historical Data Management
The above gives rise to new research and development in incorporating new
data types, complex data structures, new operations and storage and indexing
schemes in database systems.
18/03/25
Department of Computer Science and Business
19
systems
Overview of Database Languages and Architectures (
Cont…)
Data Model: is a way to organize and describe data in
database, A set of concepts to describe the structure of a
database, the operations for manipulating these structures,
and certain constraints that the database should obey.
Data Model Structure and Constraints:
• Constructs are used to define the database structure
• Constructs typically include elements (and their data
types) as well as groups of elements.
• (e.g. entity, record, table), and relationships among
such groups
• Constraints specify some restrictions on valid data,
• These constraints must be enforced at all times
18/03/25
Department of Computer Science and Business
20
systems
Overview of Database Languages and Architectures (
Cont…)
Data Model Operations:
•These operations are used for specifying
database retrievals and updates by referring to
the constructs of the data model.
•Operations on the data model may include basic
model operations
•(Ex. generic insert, delete, update) and
user-defined operations
•(Ex. compute_student_gpa, update_inventory)
18/03/25
Department of Computer Science and Business
21
systems
Categories of Data Models
Conceptual (high-level, semantic) data models:
The conceptual data model represents the overall structure of data
required to support the business requirements independent of any
software or data storage structure. . Also called entity-based or
object-based data models.
18/03/25
Department of Computer Science and Business
22
systems
Schemas versus Instances
Database Schema:
Schema Diagram:
Schema Construct:
18/03/25
Department of Computer Science and Business
23
systems
Schemas versus Instances (Cont…)
Database State:
This includes the collection of all the data in the database.
Also called database instance (or occurrence or snapshot).
The term instance is also applied to individual database
components,
Ex: record instance, table instance, entity instance
The actual data stored in a database at a particular moment in
time.
18/03/25
Department of Computer Science and Business
24
systems
Database Schema vs. Database
State
Database State: Refers to the content of a database at a moment in time.
Valid State: A state that satisfies the structure and constraints of the
database.
Distinction:
• The database schema changes very infrequently.
• The database state changes every time the database is
updated .
Schema is also called intension.
State is also called extension.
18/03/25
Department of Computer Science and Business
25
systems
Schema Diagram for the database
• Student and Course Information Database
18/03/25
Department of Computer Science and Business
26
systems
Three-Schema Architecture
DBMS schemas are defined at three levels:
18/03/25
Department of Computer Science and Business
27
systems
The Three-Schema Architecture
User Views
Structures and
Constraints
Physical Storage
Structure
Three-schema architecture
18/03/25
Department of Computer Science and Business
28
systems
The Three-Schema Architecture
(Cont..)
• Mappings among schema levels are needed to transform requests
and data.
18/03/25
Department of Computer Science and Business
29
systems
Data Independence
Logical Independence
Physical
Independence
Logical Data Independence: The capacity to change the
conceptual schema without having to change the external schemas
and their associated application programs.
18/03/25
Department of Computer Science and Business
30
systems
DBMS Languages
18/03/25
Department of Computer Science and Business
31
systems
Data Definition Language (DDL)
1. Data Definition Language: DDL stands for Data Definition Language.
18/03/25
Department of Computer Science and Business
32
systems
Data Manipulation Language (DML)
18/03/25
Department of Computer Science and Business
33
systems
Data Control Language (DCL)
DCL stands for Data Control Language.
There are the following operations which have the authorization of Revoke:
18/03/25
Department of Computer Science and Business
35
systems
DBMS Interfaces
A database management system (DBMS) interface is a user interface
which allows for the ability to input queries to a database without
using the query language itself.
18/03/25
Department of Computer Science and Business
36
systems
DBMS Interfaces (Cont…)
• These interfaces present the user with lists of options (called menus) that lead
the user through the formation of a request.
• Basic advantage of using menus is that they removes the tension of
remembering specific commands and syntax of any query language,
• Pull-down menus are a very popular technique in Web based interfaces.
2.Forms-Based Interfaces :
18/03/25
Department of Computer Science and Business
37
systems
DBMS Interfaces (Cont…)
18/03/25
Department of Computer Science and Business
38
systems
Other DBMS Interfaces
18/03/25
Department of Computer Science and Business
39
systems
The Component Modules of a DBMS and their
Interactions.
Users
DBA Staff
Casual Users/End users
Application
Programmers
Parametric Users
Tr
Ca sact
an
nn ion
ed
Query and Transaction
Execution
• Data Dictionary/Catalog
• Runtime Database
Processor
• Stored Database
• Concurrency
Control/Backup/Recovery
• Stored Data Manager Department of Computer Science and Business
18/03/25 40
systems
User Type Role/Responsibility
1. Database Administrator (DBA) Manage and control the entire database system.
3/18/25
Department of Computer Science and Business
41
systems
3/18/25
Department of Computer Science and Business
42
systems
3/18/25
Department of Computer Science and Business
43
systems
3/18/25
Department of Computer Science and Business
44
systems
3/18/25
Department of Computer Science and Business
45
systems
3/18/25
Department of Computer Science and Business
46
systems
3/18/25
Department of Computer Science and Business
47
systems
Overview of Database Design Process
Back End
Front End
18/03/25
Department of Computer Science and Business
48
systems
The database design process involves six key steps:
3/18/25
Department of Computer Science and Business
49
systems
COMPANY Database : An Example
18/03/25
Department of Computer Science and Business
50
systems
COMPANY Database : An Example
(Cont..)
•We store each EMPLOYEE’s social security number,
address, salary, sex, and birthdate.
•Each employee works for one department but may
work on several projects.
•We keep track of the number of hours per week that
an employee currently works on each project.
•We also keep track of the direct supervisor of each
employee.
•Each employee may have a number of DEPENDENTs.
•For each dependent, we keep track of their name, sex,
birthdate, and relationship to the employee.
18/03/25
Department of Computer Science and Business
51
systems
ER Diagram of a Company
18/03/25
Department of Computer Science and Business
52
systems
Entities and their Attributes are
• Employee Entity :
• Attributes of Employee Entity are Name, Id, Address, Gender, Dob
and Doj.
Id is Primary Key for Employee Entity.
• Department Entity :
• Attributes of Department Entity are D_no, Name and Location.
D_no is Primary Key for Department Entity.
• Project Entity :
• Attributes of Project Entity are P_No, Name and Location.
P_No is Primary Key for Project Entity.
• Dependent Entity :
• Attributes of Dependent Entity are D_no, Gender and relationship.
18/03/25
Department of Computer Science and Business
53
systems
Relationships are :
18/03/25
Department of Computer Science and Business
54
systems
ER Model Concepts
• Entities and Attributes
•Entities:
Entities are specific objects or things in the mini-world
that are represented in the database.
For example the EMPLOYEE John Smith, the Research
DEPARTMENT, the ProductX PROJECT
• Attributes:
Attributes are Properties used to describe an entity.
For Ex: An EMPLOYEE entity may have the attributes Name,
SSN, Address, Sex, BirthDate.
Entity will have a value for each of its attributes.
For Example: Employee entity may have
Name='John Smith', SSN='123456789', Address ='731, Fondren,
Houston, TX', Sex='M', BirthDate='09-JAN-55‘
18/03/25
Department of Computer Science and Business
55
systems
Types of Attributes
Simple Vs Composite
Single Vs Multivalued
Stored Vs Derived
• Simple Vs Composite
Simple
• Each entity has a single atomic value for the attribute.
For example, SSN or Sex.
Composite
The attribute may be composed of several components/Simple.
For example:
Address(Apt#, House#, Street, City, State, ZipCode, Country),
or Name(FirstName, MiddleName, LastName).
Composition may form a hierarchy where some
components are themselves composite.
18/03/25
Department of Computer Science and Business
56
systems
Types of Attributes (Cont…)
• In general, composite and multi-valued attributes may be nested
arbitrarily to any number of levels, although this is rare.
18/03/25
Department of Computer Science and Business
57
systems
Example of a Composite Attribute
18/03/25
Department of Computer Science and Business
58
systems
• Single Vs Multi-Valued
18/03/25
Department of Computer Science and Business
59
systems
Stored Vs Derived
18/03/25
Department of Computer Science and Business
61
systems
Entity Types and Key Attributes
(Cont..)
•A key attribute may be composite.
•VehicleTagNumber is a key of the CAR entity type with
components (Number, State).
18/03/25
Department of Computer Science and Business
62
systems
Displaying an Entity type
• In ER diagrams,
An entity type is displayed in a rectangular box
18/03/25
Department of Computer Science and Business
63
systems
Entity Type CAR with two keys and a corresponding Entity Set
18/03/25
Department of Computer Science and Business
64
systems
Entity Set
•Each entity type will have a collection of entities
stored in the database Called the entity set
•Three CAR entity instances in the entity set for CAR
(In Previous Slide)
•Same name (CAR) used to refer to both the entity
type and the entity set
•Entity set is the current state of the entities of that
type that are stored in the database
18/03/25
Department of Computer Science and Business
65
systems
Design of Entity Types for the COMPANY Database
Schema
• Based on the requirements, we can identify four initial entity types in the
COMPANY database:
• DEPARTMENT
• PROJECT
• EMPLOYEE
• DEPENDENT
18/03/25
Department of Computer Science and Business
66
systems
Initial Design of Entity Types:
EMPLOYEE, DEPARTMENT, PROJECT, DEPENDENT
18/03/25
Department of Computer Science and Business
67
systems
Refining the initial design by introducing
relationships
• Some aspects in the requirements will be represented as
relationships.
18/03/25
Department of Computer Science and Business
68
systems
Relationships and Relationship Types
18/03/25
Department of Computer Science and Business
70
systems
Relationship instances of the M:N WORKS_ON
Relationship between EMPLOYEE and PROJECT
18/03/25
Department of Computer Science and Business
71
systems
Relationship type vs. relationship set
• Relationship Type:
• Is the schema description of a relationship
• Identifies the relationship name and the participating entity types
• Also identifies certain relationship constraints
• Relationship Set:
• The current set of relationship instances represented in the
database
• The current state of a relationship type
Each instance in the set relates individual participating entities – one
from each participating entity type
18/03/25
Department of Computer Science and Business
73
systems
ER DIAGRAM - RELATIONSHIPS
• WORKS_FOR (N:1)
• CONTROLS (1:N)
• SUPERVISION(1:N)
• DEPENDENTS_OF(1:N)
18/03/25
Department of Computer Science and Business
74
systems
Recursive Relationship
Type
•A relationship type whose with the same participating
entity type in distinct roles
•Example: the SUPERVISION relationship
EMPLOYEE participates twice in two distinct roles:
• supervisor (or boss) role
• supervisee (or subordinate) role
Each relationship instance relates two distinct EMPLOYEE
entities:
• One employee in supervisor role
• One employee in supervisee role
18/03/25
Department of Computer Science and Business
75
systems
Weak Entity Types
• An entity that does not have a key attribute
• A weak entity must participate in an identifying relationship type with
an owner entity type
• Entities are identified by the combination of:
• A partial key of the weak entity type
• The particular entity they are related to in the identifying entity
type
• For Example:
• A DEPENDENT entity is identified by the dependent’s first
name, and the specific EMPLOYEE with whom the dependent is
related
• Name of DEPENDENT is the partial key
• DEPENDENT is a weak entity type
• EMPLOYEE is its identifying entity type via the identifying
relationship type DEPENDENT_OF
Department of Computer Science and Business
18/03/25 76
systems
Constraints on
Relationships
•Constraints on Relationship Types
•(Also known as ratio constraints)
•Cardinality Ratio (specifies maximum participation)
•One-to-one (1:1)
•One-to-many (1:N) or Many-to-one (N:1)
•Many-to-many (M:N)
•Existence Dependency Constraint (specifies minimum
participation) (also called participation constraint)
18/03/25
Department of Computer Science and Business
77
systems
Many-to-one (N:1) Relationship
18/03/25
Department of Computer Science and Business
78
systems
Many-to-many (M:N)
Relationship
18/03/25
Department of Computer Science and Business
79
systems
A Recursive Relationship Supervision`
18/03/25
Department of Computer Science and Business
80
systems
Recursive Relationship Type is: SUPERVISION
(participation role names are shown)
18/03/25
Department of Computer Science and Business
81
systems
Notation for Constraints on Relationships
•Cardinality ratio (of a binary relationship): 1:1, 1:N, N:1, or
M:N
•Shown by placing appropriate numbers on the
relationship edges.
•Participation constraint (on each participating entity type):
•Total (called existence dependency) or Partial.
18/03/25
Department of Computer Science and Business
82
systems
Degree of Relationship
Degree of Relationship: The number of participating entities
in a relationship defines the degree of the relationship.
• Binary = Degree - 2
• Ternary = Degree - 3
• n-ary = Degree
18/03/25
Department of Computer Science and Business
83
systems
Mapping
Mapping Cardinalities:Cardinalities
Cardinality defines the number of entities in one
entity set, which can be associated with the number of entities of other
set via relationship set.
1:N
• 1:1 1:1
• 1:N
• N:1 N:1
• M:
M:N
N
18/03/25
Department of Computer Science and Business
84
systems
Notation for ER Diagrams
18/03/25
Department of Computer Science and Business
85
systems
ER Diagrams
3/18/25
Department of Computer Science and Business
86
systems
ER diagram of Bank
18/03/25
Department of Computer Science and Business
87
systems
ER Diagram of Bank
18/03/25
Department of Computer Science and Business
88
systems
Student Information System
18/03/25
Department of Computer Science and Business
89
systems
Student Information System
18/03/25
Department of Computer Science and Business
90
systems
Problem Statements of Lab
Experiments
Program 1: Library Database
18/03/25
Department of Computer Science and Business
93
systems
18/03/25
Department of Computer Science and Business
94
systems
Program 3: Movie Database
18/03/25
Department of Computer Science and Business
95
systems
18/03/25
Department of Computer Science and Business
96
systems
Program 4: College Database
18/03/25
Department of Computer Science and Business
97
systems
18/03/25
Department of Computer Science and Business
98
systems
Program 5: Company Database
18/03/25
Department of Computer Science and Business
99
systems
18/03/25
Department of Computer Science and Business
100
systems
Differences between DBMS and File System
DBMS File System
DBMS is a collection of data. In DBMS, the File system is a collection of data. In this
user is not required to write the procedures. system, the user has to write the procedures
for managing the database.
DBMS gives an abstract view of data that File system provides the detail of the data
hides the details. representation and storage of data.
DBMS provides a crash recovery mechanism, File system doesn't have a crash mechanism,
i.e., DBMS protects the user from the system i.e., if the system crashes while entering some
failure. data, then the content of the file will lost.
DBMS provides a good protection mechanism. It is very difficult to protect a file under the file
system.
DBMS contains a wide variety of sophisticated File system can't efficiently store and retrieve
techniques to store and retrieve the data. the data.
DBMS takes care of Concurrent access of In the File system, concurrent access has
data using some form of locking. many problems like redirecting the file while
other deleting some information or updating
some information.
18/03/25
Department of Computer Science and Business
101
systems
Generalization and
Specialization
Generalization is the process of
extracting common properties from a set
of entities and create a generalized entity
from it. It is a bottom-up approach in
which two or more entities can be
generalized to a higher level entity if they
have some attributes in common.
18/03/25
Department of Computer Science and Business
102
systems
Generalization and Specialization
(Cont…)
Specialization, an entity is divided into
sub-entities based on their
characteristics. It is a top-down
approach where higher level entity is
specialized into two or more lower level
entities.
Dec.2019/Jan.2020
18/03/25
Department of Computer Science and Business
104
systems
18/03/25
Department of Computer Science and Business
105
systems
18/03/25
Department of Computer Science and Business
106
systems
ER Diagram Examples
✔ Library Management System ✔ Employee Database
✔ Hospital Management ✔ E-Farming Management System
✔ Student Database ✔ Leave Management System
✔ College Database ✔ Tourism Management system
✔ online Shopping ✔ Transport Management System
✔ Bank Databas ✔ Time Table Management
✔ Company Database ✔ Taxi Management System
✔ Blood Donation ✔ Travel agency Management
✔ Railway Reservation system
✔ Real estate Management ✔ Toll Gate Management System
System ✔ University Management System
✔ Restaurant Management System ✔ Inventory Management
✔ Recruitment Management ✔ Invoice Management System
system ✔ Insurance Management System
✔ Quiz Application ✔ Online Food Ordering System
✔ Question Paper Generator ✔ Online Book Store
✔ Website development ✔ Online Voting System
✔ Waste Management system ✔ Payroll Management System
✔ Weather forecasting system ✔ Pharmacy Management System
✔ Wholesale Management
18/03/25
Department of Computer Science and Business
107
systems
3/18/25
Department of Computer Science and Business
108
systems