SlideShare a Scribd company logo
Introduction
 Purpose of Database Systems
 Database Languages
 Relational Databases
 Database Design
 Data Models
 Database Internals
 Database and SQL Overview
https://www.youtube.com/watch?v=FR4QIeZaPeM&feature=em
b_logo
 Difference between Relational DBMS and Flat File System
https://www.youtube.com/watch?v=B-l3VQuxYrs
 Basics o DBMS
https://www.youtube.com/watch?v=d11viALaCvA
 ER Diagram Steps
https://www.youtube.com/watch?v=_iVp0n8ALRA
Video references
Database Concepts
 Database is a collection of inter-related data
 Database Management System (DBMS) is a set of programs to use
and / or modify this data
 A computer based systematic record keeping system
 Database systems are used to manage collections of data that are:
 Highly valuable
 Relatively large
 Accessed by multiple users and applications, often at the same time.
 A modern database system is a complex software system whose task
is to manage a large, complex collection of data.
Database Management System (DBMS)
 DBMS contains information about a particular enterprise
 Collection of interrelated data
 Set of programs to access the data
 An environment that is both convenient and efficient to use
 Database Applications:
 Banking: all transactions
 Airlines: reservations, schedules
 Universities: registration, grades
 Sales: customers, products, purchases
 Online retailers: order tracking, customized recommendations
 Manufacturing: production, inventory, orders, supply chain
 Human resources: employee records, salaries, tax deductions
 Databases touch all aspects of our lives
 Enterprise Information
 Sales: customers, products, purchases
 Accounting: payments, receipts, assets
 Human Resources: Information about employees, salaries, payroll taxes.
 Manufacturing: management of production, inventory, orders, supply
chain.
 Banking and finance
 customer information, accounts, loans, and banking transactions.
 Credit card transactions
 Finance: sales and purchases of financial instruments (e.g., stocks and
bonds; storing real-time market data
 Universities: registration, grades
 Telecommunication: records of calls, texts, and data usage,
generating monthly bills, maintaining balances on prepaid calling
cards
Database Applications Examples
Purpose of Database Systems
In the early days, database applications were built directly on top of file
systems, which leads to
 Data redundancy and inconsistency: data is stored in multiple file
formats resulting in duplication of information in different files
 Difficulty in accessing data
 Need to write a new program to carry out each new task
 Data isolation
 Multiple files and formats
 Integrity problems
 Integrity constraints (e.g., account balance > 0) become “buried” in
program code rather than being stated explicitly
 Hard to add new constraints or change existing ones
Purpose of Database Systems (Cont.)
 Atomicity of updates
 Failures may leave database in an inconsistent state with partial
updates carried out
 Example: Transfer of funds from one account to another should
either complete or not happen at all
 Concurrent access by multiple users
 Concurrent accessed needed for performance
 Uncontrolled concurrent accesses can lead to inconsistencies
– Ex: Two people reading a balance (say 100) and updating it by
withdrawing money (say 50 each) at the same time
 Security problems
 Hard to provide user access to some, but not all, data
Database systems offer solutions to all the above problems
Simplified Database System
Application Programs / Queries
S/W to process Queries
S/W to access data
Users / Programmers
Data
Meta -Data
Simplified Database System
Meta-Data Data about data
Database A collection of related data
DBMS
A collection of programs that enable users to
create & maintain a Database
Database System The database & software together
Data Abstraction
Data abstraction means to hide certain details of how the data is stored
and maintained.
Level of abstraction
 Physical level: describes how a record (e.g., customer) is stored.
 Logical level: describes data stored in database, and the relationships
among the data.
type customer = record
customer_id : string;
customer_name : string;
customer_street : string;
customer_city : string;
end;
 View level: application programs hide details of data types. Views can
also hide information (such as an employee’s salary) for security
purposes.
An example of three levels
View of Data
An architecture for a database system
Instances and Schemas
 Similar to types and variables in programming languages
 Schema – the logical structure of the database
 Example: The database consists of information about a set of
customers and accounts and the relationship between them)
 Analogous to type information of a variable in a program
 Physical schema: database design at the physical level
 Logical schema: database design at the logical level
 Instance – the actual content of the database at a particular point in time
 Analogous to the value of a variable
 Physical Data Independence – the ability to modify the physical schema
without changing the logical schema
 Applications depend on the logical schema
 In general, the interfaces between the various levels and components
should be well defined so that changes in some parts do not seriously
influence others.
EmpNo Name Dept Sal
1234 Vikas Admin 10000
5678 Sachin Finance
30000
1357 Kiran HR 20000
2468 Manoj Admin 15000
Instance
Schema
Example: Schema & Instance
Data Models
 A collection of tools for describing
 Data
 Data relationships
 Data semantics
 Data constraints
Semantic Models
Semantic Models
Data Models
Object Based
Logical Models
Record Based Logical
Models
Hierarchical Model
Object
Oriented model
Relational Model
ER-Model
Network Model
Data Models
Object Based
Logical Models
Record Based Logical
Models
Hierarchical Model
Object
Oriented model
Relational Model
ER-Model
Network Model
The Entity-Relationship Model
 Models an enterprise as a collection of entities and relationships
 Entity: a “thing” or “object” in the enterprise that is distinguishable
from other objects
 Described by a set of attributes
 Relationship: an association among several entities
 Represented diagrammatically by an entity-relationship diagram:
Relational Model
 Example of tabular data in the relational model
Attributes
A Sample Relational Database
Network Data Model
 Data is represented by collection of records
 Similar to an entity in the E-R model
 Records & their fields are represented as a record type
 Relationships among data are represented by links
Network Data Model (Contd…)
Hierarchical Data Model
 A Hierarchical database consists of a collection of records that are
connected to one another through links
 A record is a collection of fields, and each field contains only one data
value
 Differs from the Network Model in that the records are organized as
collections of trees rather than as arbitrary graphs
 A link is an association between two records
Hierarchical Data Model (Contd…)
Object-Relational Data Models
 Built on top of relational data models by including object orientation and
constructs to deal with added data types
 Allow attributes of tuples to have complex types, including non-atomic
values such as nested relations
 Provide a convenient migration path for users of RDBMS who wish to use
OO features
 Compatibility with existing relational languages such as SQL
Object-Relational Data Models (Contd…)
 Example  Library Information System
 Each book has:
 Title
 A set of authors
 Publisher
 A set of keywords
 Relation BOOKS with composite attributes
Purpose of ER Model
 To express the logical properties of the database in an enterprise
schema
 To express the logical structure of the database
 Used mainly as a design tool and documentation for the system
 Describes the environment in terms of entities
Identifying Entities
 Given a system description we can identify entities by:
 Select all nouns
 Eliminate the one’s not necessary
 Filter those for which system needs to store records
 Identify the attributes that describe the entity
 Check how many records could be created for the same
ERM – Important Definitions
 An entity is an object or concept about which we store information
 Entity Set
 An entity set is a set of entities of the same type that share the
same properties or attributes
 Attributes
 Attributes are descriptive properties possessed by each member
of an entity set
 Possible attribute data values, including ‘null ‘ values are called
as Domain Sets
 Depending on the domain sets and storage related properties the
attributes of an entity are divided into several categories
Attribute Types
 Simple / Atomic: The value of the attribute can not be further divided
into components It is treated as a single atomic value
e.g. Empno
 Composite: The value of the attribute can be further divided into
components
e.g. Ename – fname, mname, lname
Empno
Emp-Name
F_Name
M_Name
L_Name
Attribute Types (Contd…)
 Single-Valued : Those attributes that can have only one value at a
time
e.g. Studno
 Multi-Valued : Those attributes that can have more than one value
at a time
e.g. Contact_Number
Studno
Contact_Number
Attribute Types (Contd…)
 Stored : These attributes are stored in a database table
e.g. DtOfBirth
 Derived : These attributes are not stored in database table. Their
value can be derived by using values of one or more stored
attributes
e.g. Age (could be derived from Date of Birth)
Age
DtOfBirth
Attribute Types (Contd…)
 Null Attributes
 Null attributes means those which can have NULL value i.e. the
attribute value may not be present for a tuple
 By default all attributes can have NULL values unless one
specifies either Primary Key Constraint or Not Null Constraint for
the attribute
 Null attributes can not be indicated / represented in E-R diagram
and must be documented separately
 An attribute value is left NULL in the following situations
 The attribute is not applicable for the tuple
 The attribute is applicable for the tuple however its value is not
known currently or can not be found out currently
Entity
Strong Entity / Dominant Entity: An entity which has its own identifier,
and is not built from another entities’ identifier
Weak Entity: An entity which borrows its identity from at
least one other entity
Employee
Dependent
Entity Relationship
Relationship
 A relationship is an association among several entities. Applies when
you want to keep track of connection between two distinct entities
Identifying a Relationship
 Special type of relationship that applies when we have weak entity
EMP DEPT
Belongs to
EMP Has Dependant
ERM - Degree of Relationship
 Unary: Degree 1
 Binary: Degree 2
 Ternary: Degree 3
 N-ary: Degree n
manages
EMPLOYEE
ORDER ITEM
Has
Order_dtls
CUSTOMER LOAN
Soc SNo
cust-city
loan-no
amount
borrower
Cust-name
Mapping Cardinalities
 Mapping Cardinalities expresses the number of entities to which another
entity can be associated via a relationship set
 Possible mapping cardinalities:
 One-to-One: An entity in A is associated with only one entity in B and
vice-versa e.g.
College & Principal, Customer & Account with the condition that a
customer can handle only one account
 One-to-Many: An entity in A is associated with any number (zero or
more) of entities in B, however an entity in B is associated with at most
one entity in A
College Ha
s
Principal
1 1
Work
s in
Department Faculty
1 M
Mapping Cardinalities (Contd…)
 Many-to-Many: Entities in A and B are associated with any number
of entities from each other
e.g. Employees can be assigned to more than one Project & a
Project should be assigned to at least 3 employees
Course Teaches Instructor
1
M
 Many-to-One: An entity in A is associated with at most one entity in B & an
entity in B is associated with any number in A
e.g. Customers & Joint Account, Employee & Department or an
Instructor & Courses taught
M
Employee Assign
To
Project
N
Participation of Entity Sets in Relations
 Total: The participation of an entity set E in a relationship set R is said
to be total if every entity in E participates in at least one relationship R
 Partial: Part of the set of entities participate in some relationship
EMP Has Dependant
EMP DEPT
Belongs to
ERM – A Recap
 Overall logical structure of a database can be expressed graphically
by an ER diagram
 Rectangles: Entity Sets
 Ellipses: Attributes (Simple, Single)
 Ellipses connected with many Ellipses: Composite Attributes
 Concatenated Ellipse: Multi-value Ellipse
 Dotted Ellipse : Derive Ellipse
ERM – A Recap (Contd…)
 Diamonds: Relationship Sets
 Lines: link Attributes to Entity Sets and Entity Sets to
Relationship Sets
 Double Lines: Total Participation
 Double Rectangle: Weak Entity
 Attribute with an underline: Primary Key ____
Entity Relationship Model
Customer loan
Cust-name
Soc-SNo
cust-city
loan-no
amount
borrower
ERM – An Example
1
1
PROJECT
DEPT
Belongs to
Assigned to
N 1
N
M
N
1
loc
dname
detno
projname
proj_id
Manages
No of hrs
EMP
DEPENDENTS
has
empno
ename sal
lname
fname mname
Dep_name relation
ERM - Explanation
 This schema has 3 entity types:
 EMPLOYEE
 DEPT
 PROJECT
& 1 weak entity type DEPENDENT
 There is an M:N relationship between PROJECT & EMP entity sets
 There is a 1:1 relationship between DEPT & PROJECT
 There is a 1:M relationship between DEPT & EMP entity sets
 No of hrs is an attribute on the relation “assigned to” between EMP &
PROJECT
 There is total participation for DEPENDENT, since we can not have a
Dependent without an Employee
ER Model for National Hockey League (NHL)
 The NHL has many teams,
 Each team has a name, a city, a coach, a captain,
and a set of players,
 Each player belongs to only one team,
 Each player has a name, a position (such as left
wing or goalie), a skill level, and a set of injury
records,
 A team captain is also a player,
 A game is played between two teams (referred to as
host_team and guest_team) and has a date (such
as May 11th, 1999) and a score (such as 4 to 2).
Extended E-R Diagram: Specialization
 A top-down design process
 Designates sub groupings within an entity set that are distinctive from
other entities in the set
 These sub groupings become lower-level entity sets that have special
attributes or participate in relationships
 Depicted by a triangle component labeled ISA
e.g. Customer “is a” Person
Specialization (Contd…)
S
Extended E-R Diagram: Generalization
 A bottom-up design process
 A number of entity sets that share the same features are combined
into a higher-level entity set
 Simple inversion of Specialization
 Represented in an E-R diagram in the same way
Generalization (Contd…)
G
Extended E-R Diagram: Aggregation
 In aggregation the aggregate entity set is treated as a single unit without
concern for the details of its internal structure
 E-R model doesn’t express Represent relationships among relationships
Aggregation (Contd…)
 Suppose we want to record managers for tasks performed by an
employee at a branch
Aggregation (Contd…)
 Aggregation is an abstraction through which relationships are treated
as higher level entities
 Building Composite Objects from Component Objects 
 3 Cases:
 When the aggregate attribute values of an object forms a whole
object
 When we view an aggregate relationship as ordinary relationship
 When we represent relationship among relationships
Aggregation (Contd…)
1 COMPANY CANDIDATE
Interviews
2
JOB_OFFER
COMPANY CANDIDATE
Interviews
3
JOB_OFFER
Results_in
COMPANY CANDIDATE
Interviews
4
Aggregation
Relationship
Aggregation (Contd…)
Interviews
COMPANY CANDIDATE
JOB_OFFER
Results_in
Case Study – ER Model For a college DB
Assumptions :
 A college contains many departments
 Each department can offer any number of courses
 Many instructors can work in a department
 An instructor can work only in one department
 For each department there is a Head
 An instructor can be head of only one department
 Each instructor can take any number of courses
 A course can be taken by only one instructor
 A student can enroll for any number of courses
 Each course can have any number of students
Steps in ER Modeling
 Identify the Entities
 Find relationships
 Identify the key attributes for every Entity
 Identify other relevant attributes
 Draw complete E-R diagram with all attributes including Primary Key
 Review your results with your Business users
 Step 1: Identify the Entities
 DEPARTMENT
 STUDENT
 COURSE
 INSTRUCTOR
 Step 2: Find the relationships
 One course is enrolled by multiple students and one student enrolls for
multiple courses,hence the cardinality between course and student is Many
to Many.
 The department offers many courses and each course belongs to only one
department,hence the cardinality between department and course is One to
Many.
 One department has multiple instructors and one instructor belongs to one
and only one department , hence the cardinality between department and
instructor is one to Many.
 Each department there is a “Head of department” and one instructor is
“Head of department “,hence the cardinality is one to one .
 One course is taught by only one instructor, but the instructor teaches
many courses,hence the cardinality between course and instructor is many
to one.
Step 3: Identify the key attributes
 Deptname is the key attribute for the Entity “Department”, as it identifies
the Department uniquely.
 Course# (CourseId) is the key attribute for “Course” Entity.
 Student# (Student Number) is the key attribute for “Student” Entity.
 Instructor Name is the key attribute for “Instructor” Entity.
Step 4: Identify other relevant attributes
 For the department entity, the relevant attribute is location
 For course entity, course name,duration,prerequisite
 For instructor entity, room#, telephone#
 For student entity, student name, date of birth
Step 5 : Draw complete E-R diagram with all
attributes including Primary Key
ER Model for movie studio
A movie studio wishes to create a database to manage their files of
movies, actors and directors. The following are relevant facts
 Each actor has appeared in many movies
 Each director has directed many movies
 Each movie has one director and one and more actors
 Each actor and director may have several addresses and telephone
numbers.
Identify the entities and attributes. Draw ER diagram.
ER diagram of movie studio
Merits and Demerits of ER Modeling
Merits
 Easy to understand. Represented in Business Users Language. Can
be understood by non-technical specialist.
 Intuitive and helps in Physical Database creation.
 Can be generalized and specialized based on needs.
 Can help in database design.
 Gives a higher level description of the system.
Demerits
 Physical design derived from E-R Model may have some amount of
ambiguities or inconsistency.
 Sometime diagrams may lead to misinterpretations
Reduction of an ER to Tables
 An E-R schema can be represented by collection of tables. Each
entity set and for each relationship set in the in the database
design, there is a unique table to which we assign the name of
the corresponding entity set or relationship set. Each table has
multiple columns, each of which has a unique name.
 Representation of Strong Entity Sets with Simple Attributes.
 Representation of Strong Entity Sets with Complex
Attributes
 Representation of Weak Entity Sets
 Representation of Relationship Sets
 Redundancy of Tables
 Combination of Tables
 Representation of Generalization
 Representation of Aggregation
E-R diagram with aggregation.
 The table for the relationship set manages between the
aggregation of works-on and the entity set manager includes a
column for each attribute in the primary keys of the entity set
manager and the relationship set works-on.
 It would also include a column for any descriptive attributes, if
they exist, of the relationship set manages.
 We then transform the relationship sets and entity sets within
the aggregated entity.
Representation of Aggregation
 Specification notation for defining the database schema
Example: create table instructor (
ID char(5),
name varchar(20),
dept_name varchar(20),
salary numeric(8,2))
 DDL compiler generates a set of table templates stored in a data
dictionary
 Data dictionary contains metadata (i.e., data about data)
 Database schema
 Integrity constraints
 Primary key (ID uniquely identifies instructors)
 Authorization
 Who can access what
Data Definition Language (DDL)
 Language for accessing and updating the data organized by the
appropriate data model
 DML also known as query language
 There are basically two types of data-manipulation language
 Procedural DML -- require a user to specify what data are needed and
how to get those data.
 Declarative DML -- require a user to specify what data are needed without
specifying how to get those data.
 Declarative DMLs are usually easier to learn and use than are
procedural DMLs.
 Declarative DMLs are also referred to as non-procedural DMLs
 The portion of a DML that involves information retrieval is called a
query language.
Data Manipulation Language (DML)
 SQL query language is nonprocedural. A query takes as input several
tables (possibly only one) and always returns a single table.
 Example to find all instructors in Comp. Sci. dept
select name
from instructor
where dept_name = 'Comp. Sci.'
 SQL is NOT a Turing machine equivalent language
 To be able to compute complex functions SQL is usually embedded in
some higher-level language
 Application programs generally access databases through one of
 Language extensions to allow embedded SQL
 Application program interface (e.g., ODBC/JDBC) which allow SQL
queries to be sent to a database
SQL Query Language
 Non-procedural query languages such as SQL are not as powerful as
a universal Turing machine.
 SQL does not support actions such as input from users, output to
displays, or communication over the network.
 Such computations and actions must be written in a host language,
such as C/C++, Java or Python, with embedded SQL queries that
access the data in the database.
 Application programs -- are programs that are used to interact with
the database in this fashion.
Database Access from Application Program
The process of designing the general structure of the database:
 Logical Design – Deciding on the database schema. Database design
requires that we find a “good” collection of relation schemas.
 Business decision – What attributes should we record in the database?
 Computer Science decision – What relation schemas should we have and
how should the attributes be distributed among the various relation
schemas?
 Physical Design – Deciding on the physical layout of the database
Database Design
Database Management System Internals
 The design of a database system include consideration of the
interface between the database system and the operating
system.
 A database system is partitioned into modules that deal with
each of the responsibilities of the overall system.
 The functional components of Database system is broadly
classified into following categories.
 The storage manager,
 The query processor component,
 The transaction management component.
 Storage manager is a program module that provides the
interface between the low-level data stored in the database
and the application programs and queries submitted to the
system.
 The storage manager is responsible to the following tasks:
 Interaction with the file manager
 Efficient storing, retrieving and updating of data
 The storage manager components include:
 Authorization and integrity manager
 Transaction manager
 File manager
 Buffer manager
Storage Manager
 The storage manager implements several data structures as
part of the physical system implementation:
 Data files -- store the database itself
 Data dictionary -- stores metadata about the structure of the
database, in particular the schema of the database.
 Indices -- can provide fast access to data items. A database
index provides pointers to those data items that hold a particular
value.
Storage Manager
The query processor components include:
 DDL interpreter -- interprets DDL statements and records the
definitions in the data dictionary.
 DML compiler -- translates DML statements in a query
language into an evaluation plan consisting of low-level
instructions that the query evaluation engine understands.
 The DML compiler performs query optimization; that is, it picks the lowest
cost evaluation plan from among the various alternatives.
 Query evaluation engine -- executes low-level instructions
generated by the DML compiler.
Query Processor
1. Parsing and translation
2. Optimization
3. Evaluation
Query Processing
 A transaction is a collection of operations that performs a
single logical function in a database application
 Transaction-management component ensures that the
database remains in a consistent (correct) state despite system
failures (e.g., power failures and operating system crashes)
and transaction failures.
 Concurrency-control manager controls the interaction among
the concurrent transactions, to ensure the consistency of the
database.
Transaction Management
 Centralized databases
 One to a few cores, shared memory
 Client-server,
 One server machine executes work on behalf of multiple client machines.
 Parallel databases
 Many core shared memory
 Shared disk
 Shared nothing
 Distributed databases
 Geographical distribution
 Schema/data heterogeneity
Database Architecture
Database Architecture
(Centralized/Shared-Memory)
Database applications are usually partitioned into two or three parts
 Two-tier architecture -- the application resides at the client machine,
where it invokes database system functionality at the server machine
 Three-tier architecture -- the client machine acts as a front end and
does not contain any direct database calls.
 The client end communicates with an application server, usually through a
forms interface.
 The application server in turn communicates with a database system to
access data.
Database Applications
Two-tier and three-tier architectures
Old
Modern
(web browser)
 Design a generaliztion – specialization hierarchy for a motor –
vehicle sales. The company sells motorcycles, passenger cars,
vans and buses. Justify the placement of attributes at each
level of hierarchy.
 Projects must be classified as either top secret or civilian (but
not both). There is information specific to top secret projects
and specific to civilian projects that we want to record.
Example

More Related Content

PPT
Unit-1.ppt FOR CSE STUDENTD ENGINEERING COURSES
PPT
Ch1- Introduction to dbms
PDF
M.sc. engg (ict) admission guide database management system 4
PPTX
Database Management System, Lecture-1
PPTX
DIGITAL CONTENT for the help of students.pptx
PPT
dbms notes.ppt
PPT
DBMS - Introduction
PPT
Database Systems Concepts, 5th Ed
Unit-1.ppt FOR CSE STUDENTD ENGINEERING COURSES
Ch1- Introduction to dbms
M.sc. engg (ict) admission guide database management system 4
Database Management System, Lecture-1
DIGITAL CONTENT for the help of students.pptx
dbms notes.ppt
DBMS - Introduction
Database Systems Concepts, 5th Ed

Similar to DBMS Unit 1 nice content please download it (20)

PPT
Unit 1
PPTX
Dbms
PPT
Unit01 dbms
PPT
PPT
Ch1
 
PPT
PPT
1. Introduction to DBMS
PPTX
Introduction to Database
PDF
database introductoin optimization1-app6891.pdf
PDF
Database management systems
PPTX
Lecture 1 to 3intro to normalization in database
PPSX
Abhishek_DBMS-ch1_Database_management.ppsx
PPT
21UCAC 41 Database Management System.ppt
PDF
chapter 2-DATABASE SYSTEM CONCEPTS AND architecture [Autosaved].pdf
PPTX
DBMS Part 1.pptx
PPTX
DBMS DATA MANAGEMENT SYSTEM ppt Cs403 rtc
PDF
Ch-1-Introduction-to-Database.pdf
PDF
Database Management System NOTES for 2nd year
PDF
Database Concepts & SQL(1).pdf
PPTX
DBMS-Unit-1.pptx
Unit 1
Dbms
Unit01 dbms
Ch1
 
1. Introduction to DBMS
Introduction to Database
database introductoin optimization1-app6891.pdf
Database management systems
Lecture 1 to 3intro to normalization in database
Abhishek_DBMS-ch1_Database_management.ppsx
21UCAC 41 Database Management System.ppt
chapter 2-DATABASE SYSTEM CONCEPTS AND architecture [Autosaved].pdf
DBMS Part 1.pptx
DBMS DATA MANAGEMENT SYSTEM ppt Cs403 rtc
Ch-1-Introduction-to-Database.pdf
Database Management System NOTES for 2nd year
Database Concepts & SQL(1).pdf
DBMS-Unit-1.pptx
Ad

Recently uploaded (20)

PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
August 2025 - Top 10 Read Articles in Network Security & Its Applications
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PPTX
"Array and Linked List in Data Structures with Types, Operations, Implementat...
PDF
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
PPTX
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
PPTX
Information Storage and Retrieval Techniques Unit III
PPTX
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
PPTX
Feature types and data preprocessing steps
PDF
Accra-Kumasi Expressway - Prefeasibility Report Volume 1 of 7.11.2018.pdf
PDF
Soil Improvement Techniques Note - Rabbi
PDF
Abrasive, erosive and cavitation wear.pdf
PPTX
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
PPTX
Safety Seminar civil to be ensured for safe working.
PDF
Design Guidelines and solutions for Plastics parts
PPTX
Fundamentals of Mechanical Engineering.pptx
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
R24 SURVEYING LAB MANUAL for civil enggi
August 2025 - Top 10 Read Articles in Network Security & Its Applications
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
"Array and Linked List in Data Structures with Types, Operations, Implementat...
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
Information Storage and Retrieval Techniques Unit III
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
Feature types and data preprocessing steps
Accra-Kumasi Expressway - Prefeasibility Report Volume 1 of 7.11.2018.pdf
Soil Improvement Techniques Note - Rabbi
Abrasive, erosive and cavitation wear.pdf
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
Safety Seminar civil to be ensured for safe working.
Design Guidelines and solutions for Plastics parts
Fundamentals of Mechanical Engineering.pptx
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
Ad

DBMS Unit 1 nice content please download it

  • 1. Introduction  Purpose of Database Systems  Database Languages  Relational Databases  Database Design  Data Models  Database Internals
  • 2.  Database and SQL Overview https://www.youtube.com/watch?v=FR4QIeZaPeM&feature=em b_logo  Difference between Relational DBMS and Flat File System https://www.youtube.com/watch?v=B-l3VQuxYrs  Basics o DBMS https://www.youtube.com/watch?v=d11viALaCvA  ER Diagram Steps https://www.youtube.com/watch?v=_iVp0n8ALRA Video references
  • 3. Database Concepts  Database is a collection of inter-related data  Database Management System (DBMS) is a set of programs to use and / or modify this data  A computer based systematic record keeping system  Database systems are used to manage collections of data that are:  Highly valuable  Relatively large  Accessed by multiple users and applications, often at the same time.  A modern database system is a complex software system whose task is to manage a large, complex collection of data.
  • 4. Database Management System (DBMS)  DBMS contains information about a particular enterprise  Collection of interrelated data  Set of programs to access the data  An environment that is both convenient and efficient to use  Database Applications:  Banking: all transactions  Airlines: reservations, schedules  Universities: registration, grades  Sales: customers, products, purchases  Online retailers: order tracking, customized recommendations  Manufacturing: production, inventory, orders, supply chain  Human resources: employee records, salaries, tax deductions  Databases touch all aspects of our lives
  • 5.  Enterprise Information  Sales: customers, products, purchases  Accounting: payments, receipts, assets  Human Resources: Information about employees, salaries, payroll taxes.  Manufacturing: management of production, inventory, orders, supply chain.  Banking and finance  customer information, accounts, loans, and banking transactions.  Credit card transactions  Finance: sales and purchases of financial instruments (e.g., stocks and bonds; storing real-time market data  Universities: registration, grades  Telecommunication: records of calls, texts, and data usage, generating monthly bills, maintaining balances on prepaid calling cards Database Applications Examples
  • 6. Purpose of Database Systems In the early days, database applications were built directly on top of file systems, which leads to  Data redundancy and inconsistency: data is stored in multiple file formats resulting in duplication of information in different files  Difficulty in accessing data  Need to write a new program to carry out each new task  Data isolation  Multiple files and formats  Integrity problems  Integrity constraints (e.g., account balance > 0) become “buried” in program code rather than being stated explicitly  Hard to add new constraints or change existing ones
  • 7. Purpose of Database Systems (Cont.)  Atomicity of updates  Failures may leave database in an inconsistent state with partial updates carried out  Example: Transfer of funds from one account to another should either complete or not happen at all  Concurrent access by multiple users  Concurrent accessed needed for performance  Uncontrolled concurrent accesses can lead to inconsistencies – Ex: Two people reading a balance (say 100) and updating it by withdrawing money (say 50 each) at the same time  Security problems  Hard to provide user access to some, but not all, data Database systems offer solutions to all the above problems
  • 8. Simplified Database System Application Programs / Queries S/W to process Queries S/W to access data Users / Programmers Data Meta -Data
  • 9. Simplified Database System Meta-Data Data about data Database A collection of related data DBMS A collection of programs that enable users to create & maintain a Database Database System The database & software together
  • 10. Data Abstraction Data abstraction means to hide certain details of how the data is stored and maintained. Level of abstraction  Physical level: describes how a record (e.g., customer) is stored.  Logical level: describes data stored in database, and the relationships among the data. type customer = record customer_id : string; customer_name : string; customer_street : string; customer_city : string; end;  View level: application programs hide details of data types. Views can also hide information (such as an employee’s salary) for security purposes.
  • 11. An example of three levels
  • 12. View of Data An architecture for a database system
  • 13. Instances and Schemas  Similar to types and variables in programming languages  Schema – the logical structure of the database  Example: The database consists of information about a set of customers and accounts and the relationship between them)  Analogous to type information of a variable in a program  Physical schema: database design at the physical level  Logical schema: database design at the logical level  Instance – the actual content of the database at a particular point in time  Analogous to the value of a variable  Physical Data Independence – the ability to modify the physical schema without changing the logical schema  Applications depend on the logical schema  In general, the interfaces between the various levels and components should be well defined so that changes in some parts do not seriously influence others.
  • 14. EmpNo Name Dept Sal 1234 Vikas Admin 10000 5678 Sachin Finance 30000 1357 Kiran HR 20000 2468 Manoj Admin 15000 Instance Schema Example: Schema & Instance
  • 15. Data Models  A collection of tools for describing  Data  Data relationships  Data semantics  Data constraints Semantic Models Semantic Models Data Models Object Based Logical Models Record Based Logical Models Hierarchical Model Object Oriented model Relational Model ER-Model Network Model Data Models Object Based Logical Models Record Based Logical Models Hierarchical Model Object Oriented model Relational Model ER-Model Network Model
  • 16. The Entity-Relationship Model  Models an enterprise as a collection of entities and relationships  Entity: a “thing” or “object” in the enterprise that is distinguishable from other objects  Described by a set of attributes  Relationship: an association among several entities  Represented diagrammatically by an entity-relationship diagram:
  • 17. Relational Model  Example of tabular data in the relational model Attributes
  • 19. Network Data Model  Data is represented by collection of records  Similar to an entity in the E-R model  Records & their fields are represented as a record type  Relationships among data are represented by links
  • 20. Network Data Model (Contd…)
  • 21. Hierarchical Data Model  A Hierarchical database consists of a collection of records that are connected to one another through links  A record is a collection of fields, and each field contains only one data value  Differs from the Network Model in that the records are organized as collections of trees rather than as arbitrary graphs  A link is an association between two records
  • 23. Object-Relational Data Models  Built on top of relational data models by including object orientation and constructs to deal with added data types  Allow attributes of tuples to have complex types, including non-atomic values such as nested relations  Provide a convenient migration path for users of RDBMS who wish to use OO features  Compatibility with existing relational languages such as SQL
  • 24. Object-Relational Data Models (Contd…)  Example  Library Information System  Each book has:  Title  A set of authors  Publisher  A set of keywords  Relation BOOKS with composite attributes
  • 25. Purpose of ER Model  To express the logical properties of the database in an enterprise schema  To express the logical structure of the database  Used mainly as a design tool and documentation for the system  Describes the environment in terms of entities
  • 26. Identifying Entities  Given a system description we can identify entities by:  Select all nouns  Eliminate the one’s not necessary  Filter those for which system needs to store records  Identify the attributes that describe the entity  Check how many records could be created for the same
  • 27. ERM – Important Definitions  An entity is an object or concept about which we store information  Entity Set  An entity set is a set of entities of the same type that share the same properties or attributes  Attributes  Attributes are descriptive properties possessed by each member of an entity set  Possible attribute data values, including ‘null ‘ values are called as Domain Sets  Depending on the domain sets and storage related properties the attributes of an entity are divided into several categories
  • 28. Attribute Types  Simple / Atomic: The value of the attribute can not be further divided into components It is treated as a single atomic value e.g. Empno  Composite: The value of the attribute can be further divided into components e.g. Ename – fname, mname, lname Empno Emp-Name F_Name M_Name L_Name
  • 29. Attribute Types (Contd…)  Single-Valued : Those attributes that can have only one value at a time e.g. Studno  Multi-Valued : Those attributes that can have more than one value at a time e.g. Contact_Number Studno Contact_Number
  • 30. Attribute Types (Contd…)  Stored : These attributes are stored in a database table e.g. DtOfBirth  Derived : These attributes are not stored in database table. Their value can be derived by using values of one or more stored attributes e.g. Age (could be derived from Date of Birth) Age DtOfBirth
  • 31. Attribute Types (Contd…)  Null Attributes  Null attributes means those which can have NULL value i.e. the attribute value may not be present for a tuple  By default all attributes can have NULL values unless one specifies either Primary Key Constraint or Not Null Constraint for the attribute  Null attributes can not be indicated / represented in E-R diagram and must be documented separately  An attribute value is left NULL in the following situations  The attribute is not applicable for the tuple  The attribute is applicable for the tuple however its value is not known currently or can not be found out currently
  • 32. Entity Strong Entity / Dominant Entity: An entity which has its own identifier, and is not built from another entities’ identifier Weak Entity: An entity which borrows its identity from at least one other entity Employee Dependent
  • 33. Entity Relationship Relationship  A relationship is an association among several entities. Applies when you want to keep track of connection between two distinct entities Identifying a Relationship  Special type of relationship that applies when we have weak entity EMP DEPT Belongs to EMP Has Dependant
  • 34. ERM - Degree of Relationship  Unary: Degree 1  Binary: Degree 2  Ternary: Degree 3  N-ary: Degree n manages EMPLOYEE ORDER ITEM Has Order_dtls CUSTOMER LOAN Soc SNo cust-city loan-no amount borrower Cust-name
  • 35. Mapping Cardinalities  Mapping Cardinalities expresses the number of entities to which another entity can be associated via a relationship set  Possible mapping cardinalities:  One-to-One: An entity in A is associated with only one entity in B and vice-versa e.g. College & Principal, Customer & Account with the condition that a customer can handle only one account  One-to-Many: An entity in A is associated with any number (zero or more) of entities in B, however an entity in B is associated with at most one entity in A College Ha s Principal 1 1 Work s in Department Faculty 1 M
  • 36. Mapping Cardinalities (Contd…)  Many-to-Many: Entities in A and B are associated with any number of entities from each other e.g. Employees can be assigned to more than one Project & a Project should be assigned to at least 3 employees Course Teaches Instructor 1 M  Many-to-One: An entity in A is associated with at most one entity in B & an entity in B is associated with any number in A e.g. Customers & Joint Account, Employee & Department or an Instructor & Courses taught M Employee Assign To Project N
  • 37. Participation of Entity Sets in Relations  Total: The participation of an entity set E in a relationship set R is said to be total if every entity in E participates in at least one relationship R  Partial: Part of the set of entities participate in some relationship EMP Has Dependant EMP DEPT Belongs to
  • 38. ERM – A Recap  Overall logical structure of a database can be expressed graphically by an ER diagram  Rectangles: Entity Sets  Ellipses: Attributes (Simple, Single)  Ellipses connected with many Ellipses: Composite Attributes  Concatenated Ellipse: Multi-value Ellipse  Dotted Ellipse : Derive Ellipse
  • 39. ERM – A Recap (Contd…)  Diamonds: Relationship Sets  Lines: link Attributes to Entity Sets and Entity Sets to Relationship Sets  Double Lines: Total Participation  Double Rectangle: Weak Entity  Attribute with an underline: Primary Key ____
  • 40. Entity Relationship Model Customer loan Cust-name Soc-SNo cust-city loan-no amount borrower
  • 41. ERM – An Example 1 1 PROJECT DEPT Belongs to Assigned to N 1 N M N 1 loc dname detno projname proj_id Manages No of hrs EMP DEPENDENTS has empno ename sal lname fname mname Dep_name relation
  • 42. ERM - Explanation  This schema has 3 entity types:  EMPLOYEE  DEPT  PROJECT & 1 weak entity type DEPENDENT  There is an M:N relationship between PROJECT & EMP entity sets  There is a 1:1 relationship between DEPT & PROJECT  There is a 1:M relationship between DEPT & EMP entity sets  No of hrs is an attribute on the relation “assigned to” between EMP & PROJECT  There is total participation for DEPENDENT, since we can not have a Dependent without an Employee
  • 43. ER Model for National Hockey League (NHL)  The NHL has many teams,  Each team has a name, a city, a coach, a captain, and a set of players,  Each player belongs to only one team,  Each player has a name, a position (such as left wing or goalie), a skill level, and a set of injury records,  A team captain is also a player,  A game is played between two teams (referred to as host_team and guest_team) and has a date (such as May 11th, 1999) and a score (such as 4 to 2).
  • 44. Extended E-R Diagram: Specialization  A top-down design process  Designates sub groupings within an entity set that are distinctive from other entities in the set  These sub groupings become lower-level entity sets that have special attributes or participate in relationships  Depicted by a triangle component labeled ISA e.g. Customer “is a” Person
  • 46. Extended E-R Diagram: Generalization  A bottom-up design process  A number of entity sets that share the same features are combined into a higher-level entity set  Simple inversion of Specialization  Represented in an E-R diagram in the same way
  • 48. Extended E-R Diagram: Aggregation  In aggregation the aggregate entity set is treated as a single unit without concern for the details of its internal structure  E-R model doesn’t express Represent relationships among relationships
  • 49. Aggregation (Contd…)  Suppose we want to record managers for tasks performed by an employee at a branch
  • 50. Aggregation (Contd…)  Aggregation is an abstraction through which relationships are treated as higher level entities  Building Composite Objects from Component Objects   3 Cases:  When the aggregate attribute values of an object forms a whole object  When we view an aggregate relationship as ordinary relationship  When we represent relationship among relationships
  • 51. Aggregation (Contd…) 1 COMPANY CANDIDATE Interviews 2 JOB_OFFER COMPANY CANDIDATE Interviews 3 JOB_OFFER Results_in COMPANY CANDIDATE Interviews
  • 53. Case Study – ER Model For a college DB Assumptions :  A college contains many departments  Each department can offer any number of courses  Many instructors can work in a department  An instructor can work only in one department  For each department there is a Head  An instructor can be head of only one department  Each instructor can take any number of courses  A course can be taken by only one instructor  A student can enroll for any number of courses  Each course can have any number of students
  • 54. Steps in ER Modeling  Identify the Entities  Find relationships  Identify the key attributes for every Entity  Identify other relevant attributes  Draw complete E-R diagram with all attributes including Primary Key  Review your results with your Business users
  • 55.  Step 1: Identify the Entities  DEPARTMENT  STUDENT  COURSE  INSTRUCTOR  Step 2: Find the relationships  One course is enrolled by multiple students and one student enrolls for multiple courses,hence the cardinality between course and student is Many to Many.  The department offers many courses and each course belongs to only one department,hence the cardinality between department and course is One to Many.  One department has multiple instructors and one instructor belongs to one and only one department , hence the cardinality between department and instructor is one to Many.  Each department there is a “Head of department” and one instructor is “Head of department “,hence the cardinality is one to one .  One course is taught by only one instructor, but the instructor teaches many courses,hence the cardinality between course and instructor is many to one.
  • 56. Step 3: Identify the key attributes  Deptname is the key attribute for the Entity “Department”, as it identifies the Department uniquely.  Course# (CourseId) is the key attribute for “Course” Entity.  Student# (Student Number) is the key attribute for “Student” Entity.  Instructor Name is the key attribute for “Instructor” Entity. Step 4: Identify other relevant attributes  For the department entity, the relevant attribute is location  For course entity, course name,duration,prerequisite  For instructor entity, room#, telephone#  For student entity, student name, date of birth
  • 57. Step 5 : Draw complete E-R diagram with all attributes including Primary Key
  • 58. ER Model for movie studio A movie studio wishes to create a database to manage their files of movies, actors and directors. The following are relevant facts  Each actor has appeared in many movies  Each director has directed many movies  Each movie has one director and one and more actors  Each actor and director may have several addresses and telephone numbers. Identify the entities and attributes. Draw ER diagram.
  • 59. ER diagram of movie studio
  • 60. Merits and Demerits of ER Modeling Merits  Easy to understand. Represented in Business Users Language. Can be understood by non-technical specialist.  Intuitive and helps in Physical Database creation.  Can be generalized and specialized based on needs.  Can help in database design.  Gives a higher level description of the system. Demerits  Physical design derived from E-R Model may have some amount of ambiguities or inconsistency.  Sometime diagrams may lead to misinterpretations
  • 61. Reduction of an ER to Tables  An E-R schema can be represented by collection of tables. Each entity set and for each relationship set in the in the database design, there is a unique table to which we assign the name of the corresponding entity set or relationship set. Each table has multiple columns, each of which has a unique name.  Representation of Strong Entity Sets with Simple Attributes.  Representation of Strong Entity Sets with Complex Attributes  Representation of Weak Entity Sets  Representation of Relationship Sets  Redundancy of Tables  Combination of Tables  Representation of Generalization  Representation of Aggregation
  • 62. E-R diagram with aggregation.
  • 63.  The table for the relationship set manages between the aggregation of works-on and the entity set manager includes a column for each attribute in the primary keys of the entity set manager and the relationship set works-on.  It would also include a column for any descriptive attributes, if they exist, of the relationship set manages.  We then transform the relationship sets and entity sets within the aggregated entity. Representation of Aggregation
  • 64.  Specification notation for defining the database schema Example: create table instructor ( ID char(5), name varchar(20), dept_name varchar(20), salary numeric(8,2))  DDL compiler generates a set of table templates stored in a data dictionary  Data dictionary contains metadata (i.e., data about data)  Database schema  Integrity constraints  Primary key (ID uniquely identifies instructors)  Authorization  Who can access what Data Definition Language (DDL)
  • 65.  Language for accessing and updating the data organized by the appropriate data model  DML also known as query language  There are basically two types of data-manipulation language  Procedural DML -- require a user to specify what data are needed and how to get those data.  Declarative DML -- require a user to specify what data are needed without specifying how to get those data.  Declarative DMLs are usually easier to learn and use than are procedural DMLs.  Declarative DMLs are also referred to as non-procedural DMLs  The portion of a DML that involves information retrieval is called a query language. Data Manipulation Language (DML)
  • 66.  SQL query language is nonprocedural. A query takes as input several tables (possibly only one) and always returns a single table.  Example to find all instructors in Comp. Sci. dept select name from instructor where dept_name = 'Comp. Sci.'  SQL is NOT a Turing machine equivalent language  To be able to compute complex functions SQL is usually embedded in some higher-level language  Application programs generally access databases through one of  Language extensions to allow embedded SQL  Application program interface (e.g., ODBC/JDBC) which allow SQL queries to be sent to a database SQL Query Language
  • 67.  Non-procedural query languages such as SQL are not as powerful as a universal Turing machine.  SQL does not support actions such as input from users, output to displays, or communication over the network.  Such computations and actions must be written in a host language, such as C/C++, Java or Python, with embedded SQL queries that access the data in the database.  Application programs -- are programs that are used to interact with the database in this fashion. Database Access from Application Program
  • 68. The process of designing the general structure of the database:  Logical Design – Deciding on the database schema. Database design requires that we find a “good” collection of relation schemas.  Business decision – What attributes should we record in the database?  Computer Science decision – What relation schemas should we have and how should the attributes be distributed among the various relation schemas?  Physical Design – Deciding on the physical layout of the database Database Design
  • 69. Database Management System Internals  The design of a database system include consideration of the interface between the database system and the operating system.  A database system is partitioned into modules that deal with each of the responsibilities of the overall system.  The functional components of Database system is broadly classified into following categories.  The storage manager,  The query processor component,  The transaction management component.
  • 70.  Storage manager is a program module that provides the interface between the low-level data stored in the database and the application programs and queries submitted to the system.  The storage manager is responsible to the following tasks:  Interaction with the file manager  Efficient storing, retrieving and updating of data  The storage manager components include:  Authorization and integrity manager  Transaction manager  File manager  Buffer manager Storage Manager
  • 71.  The storage manager implements several data structures as part of the physical system implementation:  Data files -- store the database itself  Data dictionary -- stores metadata about the structure of the database, in particular the schema of the database.  Indices -- can provide fast access to data items. A database index provides pointers to those data items that hold a particular value. Storage Manager
  • 72. The query processor components include:  DDL interpreter -- interprets DDL statements and records the definitions in the data dictionary.  DML compiler -- translates DML statements in a query language into an evaluation plan consisting of low-level instructions that the query evaluation engine understands.  The DML compiler performs query optimization; that is, it picks the lowest cost evaluation plan from among the various alternatives.  Query evaluation engine -- executes low-level instructions generated by the DML compiler. Query Processor
  • 73. 1. Parsing and translation 2. Optimization 3. Evaluation Query Processing
  • 74.  A transaction is a collection of operations that performs a single logical function in a database application  Transaction-management component ensures that the database remains in a consistent (correct) state despite system failures (e.g., power failures and operating system crashes) and transaction failures.  Concurrency-control manager controls the interaction among the concurrent transactions, to ensure the consistency of the database. Transaction Management
  • 75.  Centralized databases  One to a few cores, shared memory  Client-server,  One server machine executes work on behalf of multiple client machines.  Parallel databases  Many core shared memory  Shared disk  Shared nothing  Distributed databases  Geographical distribution  Schema/data heterogeneity Database Architecture
  • 77. Database applications are usually partitioned into two or three parts  Two-tier architecture -- the application resides at the client machine, where it invokes database system functionality at the server machine  Three-tier architecture -- the client machine acts as a front end and does not contain any direct database calls.  The client end communicates with an application server, usually through a forms interface.  The application server in turn communicates with a database system to access data. Database Applications
  • 78. Two-tier and three-tier architectures Old Modern (web browser)
  • 79.  Design a generaliztion – specialization hierarchy for a motor – vehicle sales. The company sells motorcycles, passenger cars, vans and buses. Justify the placement of attributes at each level of hierarchy.  Projects must be classified as either top secret or civilian (but not both). There is information specific to top secret projects and specific to civilian projects that we want to record. Example