Data Base Hand Writting Note
Data Base Hand Writting Note
Data:
Data is a collection of raw (UN processed) facts, figures, or information
that has no meaning on its own. It becomes useful when it is processed
and organized.
Types of Data:
Numerical Data:
This type of data consists of numbers.
Examples: 50, 63.14, speed, temperature, etc.
Text Data:
This type of data includes words or characters.
Examples: Ali, Karachi, name, address, ID, etc.
Multimedia Data:
This type of data includes media files.
Examples: images, audio, video, etc.
Information:
Information is processed or organized data that has meaning and can
be used for decision-making. Information is extracted from data.
Example:
Raw Data:
Ali, 08-02-2026, 50
Information:
Ali scored 50 marks in the Math exam on 08-02-2026.
✅ Simple idea:
Data: Raw facts without clear meaning.
Information: Processed data that gives a clear message.
Data base:
A database is a collection of related data that represents real-world
entities. When a change occurs in the real world, the database is
updated to reflect that change.
✅ Explanation:
A database stores related data (for example: student records, bank accounts, product
details).
The data represents real-world objects or entities such as students, customers, or
employees.
When something changes in real life (e.g., a student changes address), the database is
updated to keep the information accurate.
Or
Database Definition:
A database is an organized collection of related data that is stored and managed so it can be
easily accessed, updated, and retrieved.
Example of DBMS:
MySQL
Oracle Database
Microsoft SQL Server
Unstructured Database
Definition:
An unstructured database is a database that stores data without a fixed
format or predefined structure.
Key Points:
Used to store multimedia data, such as images, audio, video, and
documents.
90% of data in the world is stored in unstructured databases.
Example image audio video document etc.
Database Management System (DBMS)
– Background
Scenario:
Suppose we have a lot of data stored on a hardware device (like a
server).
In the future, we may need to:
Update existing data
Add new data
Delete old data
Access or retrieve data
These actions are called database operations.
Problem:
Performing these operations directly on raw data is difficult and
inefficient.
We need a system to interact with the database and perform these
operations easily.
Solution:
This system is called a Database Management System (DBMS).
For relational databases, we specifically use an RDBMS (Relational
Database Management System).
Data base management system DBMS
A Database Management System (DBMS) is a system, software or a
collection of programs that allows users to create, store, manage, and
manipulate data in a database efficiently. In simple terms, a database is
a collection of related data, while a DBMS is the software that controls
and manages the database.
Example of DBMS
MySQL – Popular open-source relational DBMS used in web
applications.
Oracle Database – Powerful commercial relational DBMS for
enterprises.
Microsoft SQL Server – Relational DBMS by Microsoft for business
applications.
PostgreSQL – Open-source advanced relational DBMS with strong
features.
MongoDB – NoSQL DBMS for storing unstructured or semi-structured
data.
SQLite – Lightweight relational DBMS often used in mobile apps and
embedded systems.
IBM Db2 – Enterprise-grade relational DBMS used in large
organizations.
Relational data base management system RDBMS
A Relational Database Management System (RDBMS) is a type of DBMS
that stores data in tables consisting of rows and columns, and defines
relationships between these tables. Every RDBMS is a DBMS, but not
every DBMS is an RDBMS.
Functionalities of DBMS:
Defining Database (Data Definition):
This is a functionality of a DBMS that allows the user to specify the
structure of the database. It includes:
Creating tables
Defining fields (columns)
Specifying data types (e.g., integer, text, date)
Setting constraints (like primary key, unique, not null)
To construct a data base or (data storage)
A DBMS helps to store and organize data in a database according to the
defined structure. It ensures that data is stored efficiently and can be
easily retrieved or managed. Simply Data is stored on a storage
medium such as a hard disk, SSD, or cloud storage.
Manipulating the Database:
A DBMS allows the user to manipulate data in the database using
operations such as:
Insert – Add new records.
Update – Modify existing records.
Delete – Remove records.
Example:
Inserting a new student into the Student table.
Updating a student’s marks.
Deleting a student who has left the school.
Sharing the Database (Multi-User Access):
A DBMS allows multiple users to access and use the database
simultaneously without conflict, problem. It manages concurrent access
and ensures data consistency.
Example:
A teacher updating marks in the Student table while students
simultaneously view their own results.
This functionality is important in multi-user environments like schools,
banks, or businesses, where many users interact with the database at
the same time.
Data Security:
A DBMS allows users to control access to the database. This ensures
that only authorized users can perform specific actions.
Example:
Only the admin can add or modify records, while a student can only
view their own data.
Data Integrity:
A DBMS ensures that the data is accurate, valid, and consistent. This is
maintained using constraints and rules.
Example:
No two students can have the same Student ID.
Marks cannot exceed 100 if the field has a constraint.
Data Abstraction and data independency
DBMS hides the internal details of how data is stored and managed.
Shows the user only what is necessary to perform their tasks.
Reduces complexity for users and developers.
Data independency
Definition: Data independence means that changes at one level of the
data base do not affect other levels or the application programs.
File system vs DBMS
File system:
File System
Definition:
A file system is a system software used by an operating system to store,
organize, and manage files on a storage device like a hard disk, SSD, or
USB drive.
Purpose:
To store data in a structured way.
To allow easy access, retrieval, and management of files.
To keep track of file locations, permissions, and sizes.
Features of a File System:
File Organization: How files are stored (e.g., sequential, indexed).
Directory Structure: Organizes files into folders/directories.
File Access Control: Permissions for reading, writing, or executing files.
Storage Management: Keeps track of free space and file locations.
Examples of File Systems:
NTFS – Used by Windows.
FAT32 – Older Windows and USB drives.
Ext4 – Linux systems.
HFS+ / APFS – macOS.
Difference between file system and DBMS:
It describe how the data is logically organized but does not contains the actual data
Schema as Logical Representation (0:24): The video emphasizes that a schema is a logical
representation of a database, distinguishing it from the physical storage of data on hard drives
(0:25). For example, in a Relational Database Management System (RDBMS), data is logically
represented in the form of tables or relations (0:47).
Designing a Schema (1:11): The speaker explains how to design a schema for an entity like a
"student" by identifying its attributes or columns, such as roll number, name, and address (1:17).
Similarly, for a "course," attributes like course ID, name, and duration would define its schema
(1:40).
Implementation of Schema with SQL (2:55): The video highlights that while schema is a logical or
"paper representation" (3:42), its actual implementation is done using Structured Query Language
(SQL) (2:55). Specifically, Data Definition Language (DDL) commands like CREATE TABLE, ALTER
TABLE, and DROP TABLE are used to define and modify the schema (3:19).
Schema as a Structure or Collection of Tables (4:13): A schema can refer to the structure of a
single table or a collection of multiple interrelated tables
Database Instance
the actual data stored in the database at a specific moment in time. Or the actual snapshot of the
data base at a specific point of time. While the
schema is relatively static, the instance changes frequently.
what is entity
Entity :
An entity is a real-world object, person, place, or thing that can be identified and stored in a
database. 📊
Examples of entities:
Student
Teacher
Course
Product
Example:
Entity: Student
Attributes: Student_ID, Name, Age, Department
Definition:
“Three-Level Schema Architecture in a Database Management System is a database design approach
that divides the database into three levels: External level, Conceptual level, and Internal level to
separate user views from physical data storage and provide data independence and data abstraction
External level, view level
The external level is the level where users interact with the database, and each user can see only the
data relevant to them.
The User View. Describes how individual users see the data. It hides technical details and irrelevant
data from the end-user.
Key Points
Example
In a university database:
The external level is the user view of the database that shows only the required data to each
user.
The main (key) objective of the External Level in a Database Management System is to
provide different views of the database to different users while hiding unnecessary data.
In simple words
The external level allows each user to see only the data they need and keeps the rest of the
database hidden.
Key Objectives
Simple Definition
The conceptual level shows what data is stored in the database and how the data is related,
but it does not show how the data is physically stored.
Key Points
Example
Student table
Course table
Teacher table
Relationship between students and courses
Data Consistency
Data consistency in a Database Management System means that the same data remains
accurate, correct, and the same in all places in the database.
Example
Student Table
Library Table
Student_ID Name
101 Ali
If the name Ali is changed to Ali Khan, it must be updated everywhere in the database.
The conceptual level ensures data consistency by defining relationships, keys, and
constraints so that updates in one place are automatically consistent throughout the database.
Internal Level
The Physical View. Describes how data is physically stored on the storage device, including data
structures and access paths.
Data independency:
Data Independence is the ability to modify a schema at one level of the
database system without affecting the schema at the next higher level
Logical data independence means that changes made in the database schema (tables,
attributes, relationships) do not require changes in the application programs that use the
Key Point
Logical data independence works between the conceptual level and external level of a
database.
Examples
Example
The ability to change the physical storage structure of the database without affecting the conceptual
schema or external schemas.
Examples
Data structure remains the same. Mean the conceptual or logical schema does not change
Applications continue working normally.
Data Compression
This means that application programs do not need to change when the database structure or
storage method changes.
The database system separates (isolates) the programs from the internal changes in the
database.
Simple Explanation
With data independence, if the database administrator changes these things, the applications
using the database still work normally.
DBMS ARCHITECTURE:
DBMS architecture simply means the structure or design of a Database Management System (DBMS).
In other words, it defines how users, applications, and the database communicate and work together.
The DBMS design depends upon its architecture .the architecture define how users communicate with
data base to get there request done. The most commonly uses DBMS architecture are 1 tier 2 tier and 3
tier architectures. Tier mean layer
DBMS architecture
Tier 3 architecture
Tier 1 architecture Tier 2 architecture
One-tier architecture is a DBMS architecture in which the user, application, and database all exist on a
single system, and the user interacts directly with the database without any separate server or network
layer.
Client, Server, and Database all reside on the same machine
Simplest architecture, used primarily for SQL practice and local development.
No network communication required between components.
Example
Definition:
Two-tier architecture is a DBMS design in which the client (user application) directly
communicates with the database server over a network. The application and database are on
separate systems, unlike one-tier archi
Presentation layer runs on the client (PC, Mobile).{ Presentation Layer = User
Interface
It collects input from the user and sends it to the next layer (application/business logic)}
[Database Server]
- Stores Data
- Processes Query
Pros (Advantages) ✅
Cons (Disadvantages) ❌
Network Dependency
Definition:
Three-tier architecture is a DBMS design in which the system is divided into three layers:
Presentation layer, Application layer, and Database layer. Each layer performs a different
function and communicates with the others.
1. Presentation Layer
Its tasks:
[Presentation Layer]
(User Interface)
│
▼
[Application Layer]
(Business Logic)
│
▼
[Database Layer]
(Database Server)
Pros (Advantages) ✅
1. Better Security
o The client cannot access the database directly. The business layer protects the
data layer.
2. Improved Scalability
3. The system can support many users easily.
4. Better Performance
5. The business layer handles processing, reducing load on the database server.
Complex Design
Higher Cost
Network Dependency
The Database Development Life Cycle is a structured, step-by-step process used to design,
implement, test, operate, and maintain a database system.
It ensures that the database is efficient, reliable, and meets user requirements.
Following this cycle ensures that the database meets organizational goals, remains
scalable, and stays secure throughout its lifespan.
Database Initial Study
Database Initial Study is the phase where the organization’s current system is
analyzed, problems are identified, and objectives and scope of the database project
are defined.
Key components of database initial study are:
Analyze the Environment
Analyzing the environment means understanding how the organization currently works
before designing a new database system. It involves studying the company structure,
departments, and how information flows between them. The goal is to know how data is
collected, stored, and used by different people in the organization. For example, in a
hospital, this step may involve observing how doctors record patient information, how
nurses update patient status, and how the pharmacy manages medicine records.
Define Problems
Defining problems means identifying the issues or weaknesses in the current system. This
step focuses on understanding what difficulties users face and what needs improvement.
Problems may include slow processes, data duplication, lost records, or inefficient data
storage. For example, in a hospital system, patient records might be stored on paper,
which can easily be lost or damaged, and searching for patient information may take a
long time.
Set Objectives
Setting objectives means deciding the goals that the new database system should achieve.
These objectives guide the development of the system and ensure that it solves the
problems identified earlier. Objectives may include improving efficiency, reducing
errors, and making data easier to access and manage. For example, a hospital database
system may aim to store all patient records in one place, allow doctors to quickly access
patient information, and reduce the use of paper files.
Define Scope
Defining the scope means determining the boundaries of the project, including what will
be included in the database system and what will not. This step helps keep the project
focused and manageable. It identifies the features, functions, and limitations of the
system. For example, in a hospital database project, the scope may include patient
records, doctor information, and appointment scheduling, but it may exclude other
systems such as payroll or building management. The scope also include Budgetary
constraints and equipment limitations. Timeframes and organizational change
requirements
Phase 2 of the Database Development Life Cycle (DDLC) Database Design:
Phase 2 of the Database Development Life Cycle (DDLC is called Database Design. In
this phase, the structure of the database is planned based on the requirements collected in
the previous phase. The goal is to organize the data in a clear and efficient way so that it
can be stored, accessed, and managed easily. During this phase, designers identify the
entities (objects such as students, customers, or products), attributes (details about those
objects), and relationships between them. The database tables, fields, and keys are also
defined to ensure that the data is accurate and not duplicated. This phase usually includes:
DBMS slection, conceptual design, logical design, and physical design of the database.
Example:
In a university database system, the designer may create tables such as Students, Courses,
and Enrollments. The Students table may contain fields like Student_ID, Name, and Age,
while the Courses table may include Course_ID and Course_Name. A relationship is
created so that students can enroll in different courses. This design helps organize the
data properly before the database is built.
Phase 3 of the Database Development Life Cycle (DDLC) is Implementation, where the
database design is turned into a real working system.
In this phase:
Physical Creation – The database storage and space are created in the system.
Schema Deployment – Tables, fields, indexes, and views are built using SQL (Data
Definition Language).
Access Control – Permissions are assigned so administrators and users can access the
database safely.
Data Loading – Existing data from files or old systems is added into the new database.
Example:
For a school database, tables like Students, Teachers, and Courses are created in the
system. Student and course records are added, and teachers are given access to view or
update student information.
Phase 4: Testing and Evaluation
Phase 4 of the Database Development Life Cycle (DDLC) is Testing and Evaluation,
where the database is checked to ensure it works correctly, is accurate, and meets user
requirements. This phase ensures the system is reliable, secure, and ready for real use.
Key Points:
Testing – Checking if the database functions properly:
All tables, queries, forms, and reports work correctly.
Data is stored and retrieved accurately.
The system performs well under heavy usage.
Security rules and access permissions are working.
Evaluation – Assessing if the database meets objectives and user needs:
Does it solve the problems identified in Phase 1?
Is it user-friendly and efficient?
Are any improvements or changes needed before deployment?
Example:
For a school database, testing and evaluation ensures:
Students’ records, grades, and attendance can be correctly added, viewed, and updated.
Teachers can access their classes securely.
Reports are accurate, and the system is fast and reliable.