dbms notes
dbms notes
• Chapter 1 :
○ Definition of DBMS
○ DIKW pyramid
○ Architecture of DBMS (3 Layer, Schema, Tier)
DBMS users
DBMS Language
DBMS models.
• Chapter 2 : Keys
○ Super Key
○ Candidate Key
○ Primary Key
○ Secondary key
○ Alternate Key
○ Foreign Key
○ Composite Key
○ Surrogate Key
○ Partial Key
○ Unique Key
• Chapter 3 :
○ Relational Algebra :
Basic (6)
Advanced (4).
○ Relational Calculus : DRC and TRC
• Chapter 4 :
○ ER Models
Entity Type
Relational Type
ER Model Constraints
Cardinality Constraints
Participation Constraints
Attributes
Key Constraints
Weak entity set
ER model conversion to Relational model
Advanced Features
• Chapter 5 : SQL (structured query language)
○ Components of SQL :
DDL
DML
TCL
DQL
○ Operations of SQL :
○ Integrity Constraints
○ SQL Query
○ PL/SQL
○ Triggers/Cursors/Functions
• Chapter 6 : NoSQL
○ Comparison with SQL
○ Types of NoSQL
○ Architecture of NoSQL
• Chapter 7 : Functional Dependency (most important)
○ About FD
○ Properties of FD
○ DBMS anomalies
○ Lossless decomposition
○ Dependency preserving
○ Canonical Cover
○ Evaluate Keys by FD
• Chapter 8 : Normalization
○ Types of Normalization
1NF
2NF
3NF
BCNF
4NF
5NF
• Chapter 9 : Transaction Management
○ ACID properties
○ Serializability
○ Types of Serializability
View
Conflict
○ Problems in Transaction :
Dirty Read
Dirty Update
Dirty Write
• Chapter 10 : Concurrency Control
○ Lock based protocol
○ Deadlock
○ Starvation
○ 2 Phase locking
○ Strict, conservative
○ Regressive
○ Time stamp ordering protocol (using tree and graph)
• Chapter 11 : Indexing
○ Indexing methods
○ Indexing types
Single Level :
□ Dense
□ Sparse
Multi Level Indexing
B Tree and B+ Tree
○ Recovery Management
Types of Recoveries
Techniques of Recovery
□ Rollback Recovery
□ Commit (Redo)
□ Checkpoint Recovery
Chapter 1
Monday, January 20, 2025 8:59 AM
DIKW Chart :
Types of Data :
Unstructured Structured
• Data which is not in fixed and • Data which is in fixed and
predefined structured predefined structure
DBMS Architecture :
1. 3 Layer Architecture
• Level 1 : View level/external level/high level (used by end user and
developed by programmer)
• Level 2 : middle level / logical level/ conceptual level (handled by DB
Team or DBA)
• Level 3 : internal level/ lower level/ physical level (DB Design)
• Secondary storage (where database is saved)
2. Schema (HW)
• Logical architecture at each level is called Schema
• Schema architecture is the logical design of each level
3. Tier Architecture :
• There are only 2 types of architecture, tier 3 is just and upgrade of
tier 2
• Tier 1 : when the user is directly connected to the DBMS
• Tier 3 :
Types of DBMS Users
1. Naïve / Native / End User
a. Intended only for one user
2. Application Programmer user
a. Working on frontend
3. Sophisticated user
a. Working on the backend of the application
4. Specialized user
a. Working on a specific branch of the application
5. DB Developer
a. Team that constructs the DB
6. DBA (Database Admin)
a. To manage / to create / to provide support is the
responsibility of DBA
b. Roles and responsibilities of DBA :
i. To manage Database
ii. To secure the database
iii. Secondary storage access/ define the storage rules
iv. Administrative work with the concern of its team
v. Daily basis maintenance related with the DBMS
1) Regularly check the security
2) Backup
3) Check the definitions of storage
7. Casual User
a. Uses irregularly / not quite often
8. Regular User
9. Online User
a. Works on a live compiler (on the web)
10. Offline User
a. Works on an installed version
DBMS Language
• To create, manipulate, control, the database and its activities
• Components :
i. DDL (Data definition language)
• It is used to design the structure of DBMS (tables)
• Commands of DDL :
1. CREATE : creates the structure of table
2. DROP : drop the table permanently and it cannot be rolled
back
3. TRUNCATE : permanently deletes the data of the table
4. ALTER : used to modify table name, column name, add the
column, delete the column and define the definition of the
data or change the definition of the data.
5. RENAME : change the name of the table
6. COMMENT : adds comment
ii. DML (Data Manipulation language)
• It is used to manipulate the query of DBMS
• Commands of DML (all can be rolled back) :
1. SELECT : is used to select the column or row or complete
table
2. INSERT : to insert the data into the table (single or multiple)
3. DELETE : to delete the data from table (single or multiple)
4. UPDATE : update the data into table
5. CALL : to call PL/SQL or java commands
6. LOCK : to control the concurrency of table
7. EXPLAIN PLAN : to identify or recognize or create the path.
iii. DCL (Data Control language)
iv. TCL (Transaction Control language)
• Used to control the transaction of dbms
• Commands of TCL (can be rolled back unless committed)
1. COMMIT :
2. ABORT
3. ROLLBACK
v. DQL (Data Query Language)
Chapter 2 (Keys)
Monday, February 3, 2025 8:59 AM
DBMS Keys
Sid Sno Fullname Age
1 1
# Primary Key
• Derived from candidate key
• Unique + Not Null
• There is a single primary key always
# Composite Key
• Composition of more than one keys
# Alternate/Secondary Key
• All keys in candidate keys after removing all primary keys
are alternate keys
# Unique Key
• Unique + Null
# Surrogate Key
•
# Foreign Key
• Primary key of a table(reference table) used as a unique
identifier for another table(referencing table) is called
foreign key
• Referential integrity (imp)
○ Referential Integrity in Reference table
INSERT : may or may not be violated
DELETE : may or may not be violated (if deleted,
then its called cascading delete)
UPDATE : may or may not be violated (if updated,
then its called cascading updated)
○ Referential Integrity in Referencing table
INSERT : may or may not be violated (if violated, its
called cascading insert)
DELETE : may or may not be violated
UPDATE : may or may not be violated (if updated,
then its called cascading updated)
ER Models
Tuesday, February 4, 2025 10:32 AM
# Participation
1. Total participation :
# Features of ER Model :
1. Specialization
2. Generalization
3. Attribute Inheritance
4. Aggregation
Chapter 7 : Functional Dependency
Tuesday, February 11, 2025 10:43 AM
FD has 4 types :
1. Trivial
• If an attribute determines itself
• Eg: if x -> y then y -> x
• Trivial FD always show reflexive properties
• Trivial FD is always a valid FD
2. Non Trivial :
• If x determines y then X ∩ Y = ɸ
• It never shows reflexive properties
• Maybe valid or invalid
3. Multivalued
4. Transitive
# Attribute Closure
• Why : to find out the candidate key in relational table in
FD3
• If from an attribute, value of set of attributes can be
determined.
• Representation : X+
Redundancy causes :
1. Functional Dependency
• 3 types of Anomalies
INSERT anomaly :
DELETE anomaly :
UPDATE anomaly :
2. Multivalued Attributes :
• Representation : A -> -> B
• Conditions
1. if Xt1 = Xt3, then Xt3 = Xt4
2. If t1Y = t3Y, then t2Y= t4Y
3. If Zt1 = Zt4, then Zt2 = Zt3
Z Y Z
2 a h
2 b q
2 a q
2 b h
Forms of Normalization :
1NF
2NF
3NF
BCNF (3.5 NF)
4NF
5NF
# 2NF
• It must be in 1NF
• All FDs should be fully functional
• No partial FDs
• Fully FD conditions :