unit1_2024
unit1_2024
◼ Management System :
Management system is a collection of programs that enables
users to create and maintain the database
3
DBMS Application
◼ Banking : Transactions
input
◼ 1960s - 1970s:
◼ Hard disks allow direct access to data
◼ 1980s:
◼ Structure Query Language (SQL)
◼ Parallel and distributed database systems
5
◼ Object-oriented database systems
DBMS History
◼ 1990s:
◼ Large decision support and data-mining applications
◼ 2000s +:
◼ XML and XQuery standards
6
DBMS Classification Criteria
◼ Number of supported users
◼ Database site location
◼ Type of database use and Data Model
◼ Single-user DBMS:
◼ On PC – Desktop database
◼ Multi-user DBMS:
◼ Workgroup database (<50 users)
◼ Updates Problem
◼ Security problems
9
Basic Terminology of Database
◼ Field – A character or group of characters (alphanumeric or numeric)
that has a specific meaning
◼ Record – A set of one or more logically related fields
◼ File – A set of related records
Input
Application
Data file
program
Output
Frontend Tools Backend Tools 10
Database Schema/Structure and Instances/Record
A database model has two main components:
- Description
- Database itself
11
Database Schema and Instances
12
Database Schema and Instances
Instances or records
13
Practical Example of Database Structure and Records
Write a SQL command to create a table STUDENT with the following specifications field name, data type and size.
Solution :
Filed Name Data Type Size
S_code Integer 5
F_name Varchare 20
L_name Varchare 20
Dept Varchare 10
MySQL> create database college;
MySQL> use college;
MySQL> create table student (
S_code integer(5),
F_name varchar(20),
L_name varchar(20) ,
Dept varchar(10));
Write a SQL commands for alter to add new field DOB in student table and drop the table.
15
Practical Example of Database Structure and Records
Exp. Write SQL commands to:
16
Levels of Abstraction in a DBMS
17
Levels of Abstraction in a DBMS
External Schema 1 External Schema 2 External Schema 3
Physical Database
Schema
19
Conceptual (Logical) Schema
◼ The conceptual schema describes the stored data in terms of
the data model of the DBMS.
20
Conceptual (Logical) Schema
Example: Book table
(bid: char(2), title: char(50), author: char(20), price:
decimal(5,2), av_q: integer)
21
External Schema
◼ The external schema consists of the definition of the
logical records and the relationships in the external view
23
Data Independence
External Schema 1 External Schema 2 External Schema 3
Secondary
Storage 24
Logical Data Independence
◼ Logical data independence is the capacity to change
the conceptual schema with out having to change
external schemas or application programs
26
Database Architecture
Database Architecture uses programming languages to design
a particular type of software for businesses or organizations.
•One-Tier Architecture.
•Two-Tier Architecture.
•Three-Tier Architecture.
27
Database Architecture
28
DBMS Components
◼ Data Model
◼ Database languages
◼ Data Definition language (DML)
◼ Data Manipulation language (DDL)
29
Data Model
◼ Data Model gives us an idea that how the final system will
look like after its complete implementation. It defines the
data elements and the relationships between the data
elements. Data Models are used to show how data is
stored, connected, accessed and updated in the
database management system.
◼ Network Model,
◼ Relational Model.
31
Hierarchical Database Model
32
Network Database Model
◼ In network model terminology, a relationship is called a set.
34
Relational Data Model
◼ Before 1970 most the database system were based on two
models i.e. Hierarchical Model or Network Model
36
Relational Algebra
◼ Relational Algebra is a procedural query language. It consists of
set of operations that take one or two relations as input and
produce a new relation as their result.
◼ Relational Algebra is of following eight types:
1. Select (σ )
2. Project (Π )
3. Product (X)
4. Unions (U)
5. Differences (- )
6. Intersection ( )
7. Join ( )
8. Divide/ Division ( / )
Data Model
38
Data Dictionary
A Data Dictionary is a collection of names, definitions,
and attributes about data elements that are being
used or captured in a database, information system, or
part of a project.
39
Database Language
◼ A language is needed to describe the database to the DBMS
as well provide facilities for changing the database and
physical data structure.
◼ Most DML have built in function (SUM, COUNT and AVG etc.)
42
Difference between DBMS and RDBMS
43
Database Administrators (DBA)
◼ Database administrators (DBAs) use specialized Data
base software to store and organize the data.
◼ Capacity planning,
◼ Installation and Configuration,
◼ Database Design,
◼ Performance Monitoring,
◼ Security and troubleshooting,
◼ Authentication or Privilege
44
◼ Backup and Data Recovery.
Structure of DBMS
Query evaluation Engine
Database
Index Files
Data Dictionary
Data Files
45
Entity Relationship Model (ER Model )
◼ 1976 proposed by Peter Chen
46
Basic Concepts
◼ Entity - The entity is a thing or object in the world that has some independent existence with
some properties that make it differs from other. In other words entity is something that has on
identity
◼ Entity set – An Entity set is a set of entities of the same type that share the same properties
or attributes. An entity set contains many entities Ex. CAR (MAURTI , TATA, etc. )
◼ Weak Entity Set- An entity set which does not have a primary key
◼ Relationship – specify the relations among entities from two or more entity sets
◼ Domain - The Domain of an attributes is the collection of all possible values, an attribute
47can
Notations of ER Diagram
48
Notations of ER Diagram
49
Example : ER Model
50
Example : ER Diagram with Weak & Storing Entity Set
51
Relationship
◼ A relationship may be thought as a set as well
◼ For binary relationship, it enumerates the pairs of
entities that relate to each other
52
Relationship Example
53
Attribute of A Relationship Set
54
Relationship
• The degree of a relationship = the number of
entity sets that participate in the relationship
– Mostly binary relationships
– Sometimes more
• Mapping cardinality of a relationship
– 1 –1
– 1 – many
– many – 1
– Many-many
55
One-One and One-Many
56
Many-one and many-many
57
1- many
58
Many - 1
59
Many - many
60
Total Participation
When we require all entities to participate in the relationship
(total participation), we use double lines to specify
61
Self Relationship
◼ Sometimes entities in a entity set may relate to other
entities in the same set. Thus self relationship
◼ Here employees mange some other employees
◼ The labels “manger” and “worker” are called roles the
self relationship
62
More examples on self-relationship
◼ People to people
◼ Parent – Children
◼ Manager – Employee
◼ Husband – Wife
◼ Word to word
◼ Root – Synonym
63
Type of Attributes
◼ Single Value Attributes (Single Ellipse)
Ex. Student Roll No.
65
Ex. ER Diagram for Entity with Attribute
66
Ex. ER Diagram for Student and Faculty
67
Ex. ER Diagram for Customer, order and Product
68
Keys
A Key is a value which can always used to unique identification
an object instance
Student Table
Roll No Name Branch Semester Remarks
1001 Ram IT 3
1002 Shyam CSE 2
1003 Nitin TT 2
A Super key is a set of one or more attributes that taken collectively
allow us to identify uniquely an entity in the entity set.
Ex. Supper Key, S=(Roll No, Name, Branch)
S=(Name , Branch, Semester)
A Candidate key can be defined as the minimum number of super key
that identifies the record uniquely. 69
Keys
◼ A Primary key can be defined as the minimum number
of candidate key that is chosen by the database designer
as the principal means of identifying entities within an
entity set. There should not be any duplicate in the record
of primary key.
Ex. Primary Key, P=(Roll No)
Author
name death
birthday description
71
Extended ER Model
◼ The Extended Entity Relationship Model (EER) model
include all the modeling concepts of the ER model and
the concepts of specialization , generalization, higher-
level and lower-level entity set attributes inheritance and
aggregation.
72
Generalization
◼ Generalization is a relationship that exists between a high-
level entity set and lower-level entity set.
ISA
73
Example of Generalization
◼ A person is a high-level entity set and customer
and employee are lower-level entity set .
74
Fig. Generalizing Car and Truck Entities
75
Specialization Inheritance and Attribute Inheritance
◼ The process of designing sub groupings with an entity set is called
specialization.
Generalization
Specialization
77
Aggregation
◼ Aggregation is a technique to express relationship
among relationship.
79
Relationship Degree
80
Fig. Binary and Ternary Relationship
81
Ex. Reduction of ER diagram to Table
82
Ex. Reduction of ER diagram to Table
83