Before Mids Data Base Notes Word File
Before Mids Data Base Notes Word File
Key Terms
Data: Raw facts or figures that have no meaning on their
own.
Example: A student’s name, roll number, or address.
Information: Processed data that is meaningful and useful.
Example: A student’s details shown in a report card.
Database: A collection of related data organized in a way
that makes it easy to access.
DBMS (Database Management System): Software that
creates, manages, and controls access to the database.
Summary
Understanding basic database concepts is very important
because databases organize and protect data. They help
businesses and organizations manage data efficiently and
securely.
Purpose of DBMS
To store large amounts of data efficiently.
To provide easy access to data.
To maintain data security and integrity.
To allow multiple users to use the database at the same
time without conflicts.
To backup data and recover it in case of loss.
Functions of DBMS
Data Storage Management: DBMS stores data in an
organized way.
Data Retrieval: Allows users to get data easily using
queries.
Data Manipulation: Users can insert, update, delete data.
Security Management: Controls who can access or
modify data.
Backup and Recovery: Protects data from loss and
restores it if needed.
Data Integrity: Ensures data is accurate and consistent.
Examples of DBMS
MySQL
Oracle Database
Microsoft SQL Server
PostgreSQL
MongoDB (for NoSQL databases)
Advantages of DBMS
Reduces data redundancy and inconsistency.
Provides better data security than file-based systems.
Supports multi-user environments.
Provides backup and recovery facilities.
Improves data sharing and data integrity.
Summary
DBMS is the software that manages databases and makes sure
data is stored, accessed, and protected properly. It’s an essential
tool for handling large and complex data efficiently.
Summary
Database approach is better than file-based system because it
organizes data centrally, reduces redundancy, and supports
multiple users while keeping data secure and consistent.
Summary
Database architecture organizes data management into
three levels: internal, conceptual, and external.
This separation allows flexibility, security, and ease of
management.
Users see only what they need; changes in storage don’t
affect users; and designers have a clear structure to work
with.
5. Data Independence
What is Data Independence?
Data Independence is the ability to change the database structure
at one level without affecting the other levels or users'
applications. It means changes in how data is stored or
organized do not affect how users see or use the data.
This makes the database flexible and easier to maintain.
Summary
Data Independence is a key feature of modern databases that
separates how data is physically stored, how it is logically
organized, and how it is viewed by users. It protects users and
applications from changes in the database, making the system
flexible and easier to manage.
Students, Courses).
o Tables have a name and contain data about that entity.
2. Tuple (Row)
o A tuple is a single row in the table.
table.
3. Attribute (Column)
o An attribute is a column in the table.
the entity.
o For example, StudentName, Age, or CourseID.
4. Domain
o Domain is the set of allowable values for an attribute.
6. Relation Instance
o This is the actual data present in a relation at a
particular time.
o It is the set of tuples (rows) in the table.
Summary
The Relational Data Model organizes data in tables with rows
and columns. It uses clear concepts like relations, tuples, and
attributes to manage data efficiently and simply. It is the
foundation of most modern database systems.
7. Keys of Relations
What are Keys?
In a relational database, keys are special attributes (columns)
that help uniquely identify each record (row) in a table
(relation). They are very important because they ensure data
accuracy and help in searching and linking tables.
Types of Keys
1. Super Key
o A set of one or more attributes that can uniquely
uniqueness.
o Example: In a student table, {StudentID,
the table.
o It must be unique and cannot be NULL.
student table.
4. Alternate Key
o Candidate keys which are not selected as the primary
key.
o Example: If StudentID is primary key, Email can be
an alternate key.
5. Foreign Key
o An attribute (or set of attributes) in one table that
the record.
o Example: In a table tracking student courses, the
Importance of Keys
Uniqueness: Ensure each record can be uniquely
identified.
Data Integrity: Help prevent duplicate records.
Relationships: Foreign keys link tables together for
relational queries.
Searching: Keys speed up data retrieval.
Summary
Keys are essential parts of a relational database that uniquely
identify records and connect tables. Primary keys, candidate
keys, foreign keys, and composite keys all have important roles
to maintain accurate and organized data.
8. Attributes, Schemas, Tuples, Domains,
Relation Instances
8.1 Attributes
Attributes are the columns in a table (relation).
Each attribute represents a property or characteristic of
an entity.
Example: In a Student table, attributes could be StudentID,
Name, Age, and Address.
Each attribute has a name and a data type (like integer,
string, date).
8.2 Schema
A schema is the structure or design of a database or table.
For a relation (table), schema defines the table name and its
attributes with data types.
It is like a blueprint of the table, showing what kind of data
will be stored.
Example: Student(StudentID: integer, Name: string, Age:
integer)
8.3 Tuple
A tuple is a row in a table.
It represents a single record or instance of the entity.
Each tuple contains a value for every attribute in the
schema.
Example: (101, "Ali", 20, "Lahore") is a tuple in the
Student table.
8.4 Domain
A domain is the set of allowable values for an attribute.
It defines what kind of data is valid for a column.
Example: Age attribute can have domain as numbers from
1 to 100.
Domains help maintain data integrity by restricting invalid
data.
Summary
Attributes = Columns/properties of a table.
Schema = Structure/design of the table (attributes + data
types).
Tuple = Row/record in the table.
Domain = Allowed values for each attribute.
Relation Instance = Actual data present in the table at a
moment.
These terms form the basic language of the relational database
model and help us understand how data is organized and
managed.
1. Entity Integrity
o Ensures that the primary key of a table cannot have
NULL values.
o This guarantees each record is uniquely identifiable.
entries.
o Example: In an Enrollment table, StudentID must
user.
1. Selection (σ)
o Selects rows from a table that satisfy a condition.
2. Projection (π)
o Selects specific columns from a table.
3. Union (∪)
o Combines rows from two tables with the same
another table.
o Usually used as a step before joining tables.
6. Join (⨝)
o Combines rows from two tables based on a related
StudentID.
Summary
Integrity constraints enforce rules on the data to maintain
correctness.
Relational algebra provides fundamental operations to
retrieve and manipulate data.
Both are essential for efficient and reliable database
management.
in a transaction.
o Phantom Read: New rows appear in between queries
within a transaction.
o Types of locks:
can read/write.
2. Timestamp Ordering
o Each transaction gets a timestamp.
Summary
Concurrency control keeps data safe and consistent when many
users access the database at the same time. It uses locks,
timestamps, and protocols to avoid conflicts and ensure smooth
transaction processing.
11. Normalization
What is Normalization?
Normalization is a process in database design that organizes data
to reduce redundancy (repeated data) and improve data
integrity (accuracy and consistency). It breaks down large
tables into smaller, related tables.
Why Normalize?
To avoid data duplication, which wastes space.
To prevent update anomalies (errors when updating data).
To make the database efficient and easy to maintain.
determines StudentName).
2. Normal Forms
o Steps or rules that guide how to organize data. Each
multiple columns).
3. Third Normal Form (3NF)
o Must be in 2NF.
Benefits of Normalization
Data is stored logically and efficiently.
Eliminates duplicate data.
Helps maintain data integrity.
Makes updates, insertions, and deletions safer.
Summary
Normalization is essential to design good databases by
organizing data into tables that avoid duplication and
inconsistency. It uses functional dependencies and normal forms
to guide this process.
determinant.
o Example: {StudentID, Name} → StudentID (always
true).
2. Non-trivial Functional Dependency
o When the dependent attribute is not part of the
determinant.
o Example: StudentID → StudentName.
3. Transitive Dependency
o If A → B and B → C, then A → C is transitive.
normalization.
Summary
Functional dependencies describe relationships between
attributes and are key to understanding how to organize tables
correctly. They guide the normalization process to keep
databases efficient and consistent.
independent existence.
o Example: Student, Teacher, Car.
o Represented by a rectangle.
2. Attributes
o Properties or details that describe an entity.
o Example: For Student entity, attributes can be
3. Entity Set
o A collection of similar entities.
entity set.
4. Relationship
o Shows how entities are connected or related to each
other.
o Example: Student enrolls in Course.
o Represented by a diamond.
5. Relationship Set
o A set of relationships of the same type.
Types of Attributes
Simple (Atomic) Attribute: Cannot be divided further
(e.g., Age).
Composite Attribute: Can be divided into smaller parts
(e.g., FullName into FirstName and LastName).
Derived Attribute: Can be derived from other attributes
(e.g., Age from Date of Birth).
Multi-valued Attribute: Can have multiple values (e.g.,
Phone Numbers).
Types of Relationships
1. One-to-One (1:1)
o One entity from A relates to only one entity from B,
Summary
ER Model is a powerful tool to represent the database logically
using entities, attributes, and relationships. It provides a clear
blueprint for building databases.
Types of Keys
1. Candidate Key
o A minimal set of attributes that can uniquely identify a
tuple.
o There can be more than one candidate key in a table.
3. Alternate Key
o Candidate keys that are not chosen as the primary key.
an alternate key.
4. Super Key
o A set of one or more attributes that uniquely identify
tuples.
o A super key may contain extra attributes beyond what
is necessary.
5. Foreign Key
o An attribute (or set) in one table that refers to the
primary key of another table.
o Used to maintain relationships between tables.
o Example: In a CourseEnrollment table, StudentID
might be a foreign key referring to Student table.
Characteristics of Keys
Uniqueness: No two rows can have the same key value.
Minimality: No extra attribute should be in the key (only
necessary attributes).
Non-null: Primary keys cannot have null values.
Example
StudentID (PK) Name Email
101 Ali ali@example.com
102 Sara sara@example.com
Here, StudentID is the Primary Key.
Email could be a Candidate Key or Alternate Key if it is
unique.
Summary
Keys are essential in relational databases to uniquely identify
records, maintain data integrity, and define relationships
between tables.
15. Attributes, Schemas, Tuples, Domains,
Relation Instances
15.1 Attributes
Attributes are the columns or fields in a table that describe
the properties of an entity.
Example: In a Student table, attributes can be StudentID,
Name, Age.
Each attribute has a name and a data type (like integer,
string).
15.2 Schema
The schema is the structure or design of a database or a
relation (table).
It defines the table name, attributes, and the type of data
each attribute holds.
Think of it as a blueprint for the table.
Example: Student(StudentID: int, Name: varchar, Age: int)
15.3 Tuple
A tuple is a single row in a table, which contains data
corresponding to all attributes.
It represents one record or instance of the entity.
Example: (101, "Ali", 20) is a tuple in the Student table.
15.4 Domain
A domain is the set of allowable values for an attribute.
It defines the type and range of data an attribute can have.
Example: Domain of Age could be integers between 0 and
150.
15.5 Relation Instance
A relation instance is the actual set of tuples (rows)
present in a table at any given time.
It changes as data is inserted, updated, or deleted.
Example: The Student table with 3 rows is a relation
instance.
Summary
Attributes: Describe the data fields (columns).
Schema: Defines the structure of the table.
Tuples: Individual records (rows).
Domains: Allowed values for attributes.
Relation Instance: Actual data present in the table at a
moment.
identifier.
2. Referential Integrity
o Ensures that foreign key values must either be null
3. Domain Integrity
o Ensures that attribute values fall within a defined
domain or range.
o For example, age must be between 0 and 150.
4. User-defined Integrity
o Custom rules defined by users to meet specific
business requirements.
o Example: A student’s grade must be between A and F
only.
Examples
StudentID (PK) Name Age DepartmentID (FK)
101 Ali 20 10
StudentID (PK) Name Age DepartmentID (FK)
102 Sara 22 11
Entity Integrity: StudentID must be unique and not null.
Referential Integrity: DepartmentID in Student must exist
in Department table or be null.
Domain Integrity: Age must be within a realistic range,
e.g., 0-150.
Summary
Integrity constraints are essential rules that ensure data stays
valid, consistent, and reliable in a database system.
o Symbol: σ_condition(Relation)
o Example: σ_Age>20(Student)
2. Projection (π)
o Selects specific columns (attributes) from a table.
o Symbol: π_attribute-list(Relation)
3. Union (∪)
o Combines tuples from two relations with the same
of another.
o Used to prepare for joins.
6. Rename (ρ)
o Renames the relation or attributes for convenience.
7. Join
o Combines related tuples from two relations based on a
condition.
o Types:
Example
Suppose we have two tables:
Student(StudentID, Name, Age)
Enrollment(StudentID, CourseID)
To find names of students enrolled in CourseID = 101:
1. Select enrollments with CourseID = 101:
σ_CourseID=101(Enrollment)
Student ⨝ Enrollment
2. Join with Student table on StudentID:
π_Name(Student ⨝ σ_CourseID=101(Enrollment))
3. Project only Student Names:
Summary
Relational Algebra is a set of operations that allows you to
manipulate and query data in relational databases
mathematically and precisely. It’s the theoretical basis for SQL
queries.
Key Concepts
1. Transaction
o A set of database operations that perform a single
logical task.
o Must be completed fully or not at all (Atomicity).
other forever.
Summary
Concurrency Control ensures safe and reliable database
operations when many users access data simultaneously. It
prevents data corruption and maintains consistency.
candidate key.
Example of Normalization
Suppose a table stores:
StudentID StudentName CourseID CourseName Instructor
Here, CourseName and Instructor depend on CourseID, not
StudentID → violates 2NF.
Normalization splits this into two tables:
1. Student (StudentID, StudentName)
2. Course (CourseID, CourseName, Instructor)
Summary
Normalization helps create a database that is free from
redundancy and update problems, ensuring data accuracy and
efficiency.
Notation
If attribute B depends on attribute A, it is written as:
A→B
This means A functionally determines B.
Example
In a Student table:
StudentID → StudentName
If you know StudentID, you can find the StudentName.
itself.
o Example: StudentID, Name → Name (this is trivial).
subset of A.
3. Fully Functional Dependency
o When an attribute depends on the whole composite
so A determines C indirectly.
Key Components
1. Entity
o A real-world object or concept with a distinct
existence.
o Example: Student, Teacher, Course.
2. Entity Set
o A collection of similar entities.
3. Attributes
o Properties or details about an entity.
Age.
4. Relationship
o An association among entities.
6. Primary Key
o An attribute that uniquely identifies an entity in an
entity set.
Types of Entities
Strong Entity: Exists independently (has a primary key).
Weak Entity: Depends on another entity (no primary key
alone).
Types of Relationships
One-to-One (1:1)
One entity in set A relates to only one entity in set B.
One-to-Many (1:N)
One entity in set A relates to many in set B.
Many-to-Many (M:N)
Many entities in set A relate to many in set B.
ER Diagram Symbols
Rectangle: Entity
Oval: Attribute
Diamond: Relationship
Lines connect entities and relationships.
Why Use ER Model?
Helps in database design by visualizing data structure.
Simplifies communication between developers and users.
Summary
The ER Model visually represents database elements and their
relationships, making database design easier and more
organized.
2. Identify Entities
o Find the real-world objects (like Student, Course,
entity.
Example: Student → StudentID, Name, Age
4. Identify Relationships
o Figure out how entities are connected.
database system.
it must handle.
2. Identify Entities
o Find all real-world objects that need to be stored.
UML if needed.
9. Review and Validate
o Recheck everything with the user or requirement to
🎨 ER Diagram Symbols
Symbol Meaning
Rectangle Strong Entity
Double Rectangle Weak Entity
Oval Attribute
Double Diamond Identifying Relationship (for weak entities)
✅ Summary
Entity Types define a class of real-world things stored in
the database.
Strong entities have their own primary keys and exist
independently.
Weak entities rely on strong entities and don’t have unique
keys.
✅ Example:
In a university database:
A Student can enrolls in a Course
→ This interaction is a relationship.
So:
Entities = Student, Course
Relationship = Enrolls
🎨 ER Diagram Representation
Rectangle: Entity
Diamond: Relationship
Line: Connection between entity and relationship
📍 The number of lines connecting entities to the diamond shows
the degree of the relationship.
✅ Summary
Type Degree Involves Example
✅ Examples:
1. One-to-One (1:1)
One person has one passport.
2. One-to-Many (1:N)
One teacher can teach many students.
3. Many-to-One (N:1)
Many employees work in one department.
4. Many-to-Many (M:N)
Many students can register in many courses.
✅ Examples:
Total Participation:
Every employee must work in a department.
→ So, Employee entity has total participation in the
"Works_In" relationship.
Partial Participation:
Some students may borrow books from the library. Not
all do.
→ So, Student entity has partial participation in the
"Borrows" relationship.
🎨 ER Diagram Notation
Concept Symbol
Total Participation Double line
Partial Participation Single line
One-to-One 1—1
One-to-Many 1—N
Many-to-Many M—N
✅ Summary
Constraint Type Purpose
Cardinality Ratio Defines how many instances are involved
Participation Defines whether all instances must participate
Structural constraints help us accurately model relationships
and ensure that data is consistent and meaningful.
🔹 1. One-to-One (1:1)
📌 Definition:
One-to-Many
One ↔ Many (Optional) Teacher ↔ Students
(1:*)
✅ Summary:
Structural constraints control participation and define
how entities connect.
Binary relationships are classified as 1:1, 1:*, *:1, and *:*.
Some are optional, while others are mandatory,
depending on whether participation is required or not
📘 Definition:
In database design (especially in the ER model), a supertype is
a general entity type, and a subtype is a more specific entity
type that inherits attributes from the supertype.
This concept is useful when some entities share common
properties, but also have unique properties of their own.
✅ 1. Supertype
A supertype is a general category.
It contains common attributes that are shared by all
subtypes.
There is always at least one attribute or characteristic
common to all subtypes.
🔹 Example:
If we have an entity “Employee”, all employees have:
Name
Employee ID
Address
So Employee is the supertype.
✅ 2. Subtype
A subtype is a specialized version of the supertype.
It has its own unique attributes in addition to those
inherited from the supertype.
Subtypes are connected to their supertype through a
relationship called "IS-A".
🔹 Example:
We can have two subtypes of Employee:
Manager (with extra attribute: DepartmentManaged)
Technician (with extra attribute: SkillSet)
Both Manager and Technician are Employees, but they have
their own specific fields too.
✅ 3. IS-A Relationship
The "IS-A" relationship means that:
Subtype IS-A Supertype
Example:
Manager is an Employee
Technician is an Employee
This relationship is shown using an arrow from subtype to
supertype in ER diagrams.
✅ ER Diagram Example:
Employee (Supertype)
--------------------
Emp_ID
Name
Address
|
---------------------
| |
Manager (Subtype) Technician (Subtype)
--------------- -------------------
DeptManaged SkillSet
✅ Summary:
Term Meaning
Supertype General entity with common attributes
Subtype Specialized entity with extra attributes
IS-A Relationship that connects subtype to supertype
Disjoint Entity can be in only one subtype
Overlapping Entity can be in multiple subtypes
Term Meaning
Total All supertype entities must belong to a subtype
Some supertype entities may not belong to any
Partial
subtype
📘 What is a Key?
In a database, a key is an attribute (or set of attributes) that is
used to:
Uniquely identify a record (row) in a table.
Establish relationships between different tables.
✅ 1. Types of Keys
Here are the main types of keys in a relational database:
✅ Summary Table:
Key Type Description
Uniquely identifies each record, must be
Primary Key
unique & not null
Candidate Key All possible unique keys in a table
Key Type Description
Alternate Key Candidate key not selected as primary
Composite Key A key made of two or more attributes
Foreign Key References a primary key from another table
Concatenated
Another name for Composite Key
Key
Types of Two-Attribute and Multi-Attribute based on
Composite the number of columns joined
📘 Definition
A Compound Primary Key is a primary key that consists of
two or more columns.
It is used when no single column is able to uniquely identify a
row.
🟢 Example:
Imagine a table called StudentCourses that stores which student
is enrolled in which course.
StudentID CourseID Grade
101 CS101 A
101 MA101 B
102 CS101 A
📘 Definition
A Foreign Key is an attribute (or group of attributes) in one
table that refers to the Primary Key in another table.
It is used to create a relationship between two tables.
🟢 Example:
We have two tables:
Students Table
StudentID Name
101 Aisha
102 Usman
StudentCourses Table
StudentID (FK) CourseID
101 CS101
102 MA101
✅ 3. Candidate Key
📘 Definition
A Candidate Key is any column (or set of columns) that can
uniquely identify a row in a table.
A table can have multiple candidate keys, but only one is
chosen as the Primary Key.
The others are called Alternate Keys.
🟢 Example:
Employees Table
EmpID Email CNIC
1 ali@gmail.com 35201-1234567-8
2 sara@hotmail.com 35202-9876543-1
In this case:
EmpID is a candidate key
Email is also unique → another candidate key
CNIC is also unique → another candidate key
✅ Summary Table
Key Type Definition Example
✅ 1. Integrity in Databases
📘 Definition:
Integrity means maintaining the accuracy, consistency, and
correctness of data in a database over its entire life.
It ensures that:
The data entered is valid and meaningful
There are no conflicts, duplications, or invalid
relationships
🔐 Authorized Users:
o Application developers
🚫 Unauthorized Users:
✅ 3. Constraints in DBMS
📘 Definition:
A Constraint is a rule or restriction that ensures that data
entered into the database is valid, consistent, and reliable.
These rules cannot be violated — otherwise, the system will
reject the invalid data.
📌 Purpose of Constraints:
Enforce data accuracy
Avoid errors and duplicates
Protect data integrity
Control what type of data can go into tables
✅ 4. Types of Constraints
🔹 a. Domain Constraint
"Other"
🔹 b. Entity Integrity Constraint
✅ Summary Table
Term Explanation
✅ 1. Normalization
📘 Definition:
Normalization is a process in database design that organizes
data to reduce redundancy (duplicate data) and improve data
integrity.
It breaks down a large table into smaller tables and defines
relationships between them.
✅ 2. Purpose of Normalization
Eliminate duplicate data to save space
Avoid data anomalies (problems when inserting, updating,
or deleting data)
Ensure data dependencies make sense (data stored
logically)
Improve database efficiency by structuring data properly
✅ 5. Example
Imagine a table that stores students and the courses they take
along with their instructors:
StudentID StudentName Course Instructor
101 Ali Math Mr. Khan
101 Ali Science Mrs. Ahmed
StudentID StudentName Course Instructor
102 Sara Math Mr. Khan
Issues:
Redundancy: StudentName repeated multiple times
Update anomaly: If instructor changes, multiple rows need
update
Insert anomaly: Cannot add instructor without
course/student
After Normalization:
1. Students Table
| StudentID | StudentName |
|-----------|-------------|
| 101 | Ali |
| 102 | Sara |
2. Courses Table
| CourseID | CourseName | Instructor |
|----------|------------|-------------|
| 1 | Math | Mr. Khan |
| 2 | Science | Mrs. Ahmed |
3. Enrollments Table
| StudentID | CourseID |
|-----------|----------|
| 101 | 1 |
| 101 | 2 |
| 102 | 1 |
✅ Summary:
Normal Form Main Rule
1NF Atomic values, no repeating groups
2NF No partial dependency on part of primary key
3NF No transitive dependency
BCNF Every determinant is a candidate key
4NF No multi-valued dependencies
5NF No join dependencies causing redundancy
✅ 2. Types of Anomalies
🔹 a. Insertion Anomaly
🔹 b. Update Anomaly
🔹 c. Deletion Anomaly
✅ Summary Table
Anomaly Type What Happens Example
✅ 4. Database Recovery
Recovery means restoring the database to a correct state
after failure or crash.
Uses backups and transaction logs to undo incomplete
transactions and redo completed ones.
✅ 5. Recovery Techniques
Rollback: Undo changes made by incomplete transactions
to maintain data consistency.
Rollforward: Reapply changes from backup logs to bring
the database up to date.
Shadow Paging: Keeps a copy of data pages before change
to revert if failure happens.
Checkpointing: Save current state periodically to reduce
recovery time.
✅ 6. Summary
Backup Type Description Pros Cons
Copies entire Complete Slow, needs
Full Backup
database restore more storage
Incremental Copies changes Fast, saves Recovery
Backup since last backup storage slower
Differential Copies changes Faster Uses more
Backup since last full recovery storage
✅ 2. Types of Threats
Unauthorized access (hacking)
Data theft or data loss
Data tampering or modification
Software bugs or hardware failure
Denial of Service (DoS) attacks
✅ 3. Database Authorization
Authorization means granting or restricting access to
database users.
Only authorized users can read, write, update, or delete
data based on permissions.
✅ 6. Summary
Security
Description Example/Method
Aspect
Authentication Verifying user identity Passwords, biometrics
GRANT and REVOKE
Authorization Controlling user access
commands
Protecting data from Data encryption
Encryption
unauthorized use algorithms
Monitoring user
Audit Trails Database logs
actions
✅ 3. Transaction States
Active: Transaction is being executed.
Partially Committed: Last operation done but changes not
yet permanent.
Committed: All changes are saved permanently.
Failed: Transaction is aborted due to error.
Terminated: Transaction ends successfully or
unsuccessfully.
✅ 4. Transaction Optimization
Aim to reduce transaction time and improve database
performance.
Techniques include:
o Minimizing locking time.
o Query optimization.
data).
o Deadlocks (transactions waiting indefinitely for each
other).
✅ 3. Concurrency Control Techniques
🔹 a. Lock-Based Protocols
✅ 4. Deadlock
Occurs when two or more transactions wait indefinitely for
each other’s locks.
Deadlock detection and resolution techniques include:
o Timeout (abort after waiting too long).
o Transaction rollback.
✅ 5. Summary Table
Concept Description
✅ 3. Choosing a DBMS
Depends on requirements like scale, data type, budget, and
platform.
Relational DBMS (RDBMS) are common for structured
data.
NoSQL DBMS are used for big data, flexible schemas.
✅ 1. History of Oracle
Oracle was founded in 1977 by Larry Ellison, Bob Miner,
and Ed Oates.
It was one of the first companies to develop a commercial
relational database.
Oracle Database has grown to become one of the most
popular and powerful DBMS worldwide.
✅ 4. Summary
Aspect Description
Oracle Founded 1977
Installation Download, run installer, configure DB
Key Features High performance, security, scalability
Languages Supported SQL, PL/SQL
Platforms Supported Windows, Linux, Unix
✅ 1. Relational Algebra
A procedural query language used to retrieve data from
relational databases.
Works on relations (tables) and produces new relations as
results.
Basic operations include:
Operation Description
Select (σ) Selects rows that satisfy a condition.
Operation Description
Project (π) Selects columns (attributes) from a relation.
Combines rows from two relations, removing
Union (∪)
duplicates.
Returns rows in one relation but not in
Set Difference (-)
another.
Cartesian Combines every row of one relation with
Product (×) every row of another.
Rename (ρ) Renames the output relation or attributes.
Combines related tuples from two relations
Join
based on a condition.
✅ 2. Relational Calculus
A non-procedural query language (specifies what to
retrieve, not how).
Two types:
o Tuple Relational Calculus (TRC): Works with tuple
variables.
o Domain Relational Calculus (DRC): Works with
✅ Summary Table
Language
Purpose Commands
Type
Define or change CREATE, ALTER,
DDL
database structure DROP, TRUNCATE
Manipulate data in SELECT, INSERT,
DML
tables UPDATE, DELETE
Manage permissions
DCL GRANT, REVOKE
and security
30. Storage & File Structure
✅ 1. Storage Devices
Data is stored on physical devices like:
o Hard Disk Drives (HDD)
✅ 3. Buffer Management
A buffer temporarily holds data transferred between disk
and memory.
Efficient buffer management reduces disk I/O and speeds
up database operations.
✅ 4. Indexing
Indexes are special data structures stored separately to
speed up data retrieval.
Common types:
o B-Tree Index: Balanced tree structure, good for range
queries.
o Hash Index: Fast exact match queries.
✅ Summary
Efficient file storage and organization are essential for fast data
access and good DBMS performance. Understanding file
structures and storage concepts helps design databases that work
well with the underlying hardware.
✅ 3. Database Tuning
The process of improving database performance.
Techniques include:
Technique Description
Creating, dropping, or modifying indexes
Index Tuning
for better query speed.
Query Analyzing and rewriting queries for
Optimization efficiency.
Database Adjusting DBMS settings like cache size,
Configuration connection limits.
Splitting large tables into smaller parts for
Partitioning
faster access.
Monitoring & Using tools to monitor database
Profiling performance and identify bottlenecks.
✅ Summary
Database efficiency and tuning ensure databases run fast and use
resources well. Data warehousing helps organizations analyze
big data collected over time for better business decisions.