Comprehensive Study Notes on Database Management
For BSc Computer Applications
Table of Contents
Unit I: Overview of Database Management
1. Introduction to Database Management
2. File-Oriented Approach vs. Database-Oriented Approach
o Disadvantages of File-Oriented Approach
3. Data Independence
4. Database Administrator (DBA) and Its Role
5. DBMS Architecture
6. Different Types of DBMS Users
7. Data Dictionary and Its Contents
8. Types of Database Languages
9. Different Types of Data Models
Unit II: Relational Model & Database Design
1. Definition of Relational Model
2. Concept of Keys
o Candidate Key
o Primary Key
o Foreign Key
3. Fundamental Integrity Rules
4. Relational Algebra
5. Database Design Using ER Model
o Entities, Attributes, and Relationships
o Strong and Weak Entities
o ER Diagrams
Unit III: Normalization & SQL
1. Normalization in Relational Model
o Functional Dependencies
o Normal Forms (1NF, 2NF, 3NF, BCNF, 4NF)
2. SQL Concepts
o SQL Constructs: SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY
o INSERT, DELETE, UPDATE
o Views: Definition and Use
o Nested Queries
Unit IV: FoxPro & Case Studies
1. Introduction to FoxPro
2. Database Construction in FoxPro
3. Operations in FoxPro
o Searching, Sorting, Indexing
o Updation, Reports, Screen Designing
4. Programming Concepts in FoxPro
5. Managing Numbers and Dates in FoxPro
6. Case Studies
o Inventory Control System
o Payroll Processing
UNIT I: Overview of Database Management
1️⃣ Introduction to Database Management
A Database Management System (DBMS) is software that manages databases efficiently and
provides users with a systematic way to create, retrieve, update, and manage data.
Key Features of DBMS
Centralized Data Management
Reduction of Data Redundancy
Data Integrity and Security
Concurrent Access
2️⃣ File-Oriented Approach vs. Database-Oriented Approach
Feature File-Oriented Approach Database-Oriented Approach
High (same data stored in multiple
Data Redundancy Low (data stored centrally)
files)
Feature File-Oriented Approach Database-Oriented Approach
Data Integrity Difficult to maintain Easier due to constraints
Data Security Less secure More secure
Data High (programs remain
Low (changes in files affect programs)
Independence unaffected)
Complexity Simple but inefficient for large data More complex but efficient
Disadvantages of File-Oriented Approach
Data Redundancy (same data stored multiple times)
Data Inconsistency (different versions of the same data)
Lack of Security (difficult to control access)
No Data Independence (changes in data structure affect applications)
3️⃣ Data Independence
Data Independence refers to the separation of data from application programs.
Logical Data Independence: The ability to change the logical structure without affecting
applications.
Physical Data Independence: The ability to change the physical storage without affecting
the logical structure.
4️⃣ Database Administrator (DBA) and Its Role
A DBA (Database Administrator) is responsible for managing and maintaining the database.
Responsibilities of a DBA
Database Design and Implementation
Data Security and Authorization
Backup and Recovery Management
Performance Monitoring
5️⃣ DBMS Architecture
Three-Tier Architecture
1️⃣ External Level (User View)
2️⃣ Conceptual Level (Logical Structure)
3️⃣ Internal Level (Physical Storage)
Diagram of DBMS Architecture
[ User 1 ] [ User 2 ] [ User 3 ]
| | |
|________External Level________|
Conceptual Level
Internal (Storage) Level
6️⃣ Types of DBMS Users
End Users – Use applications to interact with the database
DBA – Manages the database system
Application Programmers – Develop software that interacts with DBMS
System Analysts – Design database structure
7️⃣ Data Dictionary and Its Contents
A Data Dictionary is a collection of metadata that describes database structure.
Contents
Table names, attributes, data types
Constraints (Primary Key, Foreign Key)
Indexes, Views
8️⃣ Types of Database Languages
Data Definition Language (DDL) – CREATE, ALTER, DROP
Data Manipulation Language (DML) – INSERT, UPDATE, DELETE, SELECT
Data Control Language (DCL) – GRANT, REVOKE
Transaction Control Language (TCL) – COMMIT, ROLLBACK
9️⃣ Types of Data Models
Hierarchical Model – Tree-like structure
Network Model – Graph-based structure
Relational Model – Uses tables (most common)
Object-Oriented Model – Uses objects
UNIT II: Relational Model & Database Design
1️⃣ Definition of Relational Model
The Relational Model represents data as tables (relations) where each row is a record (tuple)
and each column is a field (attribute).
2️⃣ Concept of Keys
Candidate Key – A unique identifier for records
Primary Key – A chosen candidate key (cannot be NULL)
Foreign Key – A key in one table referring to the primary key of another table
Example:
Student_ID (PK) Name Course_ID (FK)
101 Alex CSE101
102 John CSE102
Here, Student_ID is a Primary Key, and Course_ID is a Foreign Key.
3️⃣ Fundamental Integrity Rules
Entity Integrity – Primary key cannot be NULL
Referential Integrity – Foreign key must refer to an existing primary key
UNIT III: Normalization & SQL
1️⃣ Normalization in Relational Model
What is Normalization?
Normalization is the process of organizing data to reduce redundancy and improve data
integrity in a relational database.
Functional Dependencies
A functional dependency (FD) exists when one attribute uniquely determines another.
Notation: If A → B, then knowing A means we can determine B.
Example:
• Student_ID → Student_Name (Each Student_ID uniquely determines Student_Name)
2️⃣ Normal Forms
Normalization is achieved through Normal Forms (NF):
First Normal Form (1NF)
No repeating groups (each column has atomic values)
Each column contains unique data
Example (Not in 1NF):
Order_ID Product_Name Quantity
101 Pen, Book 5, 2
102 Pencil 3
Converted to 1NF:
Order_ID Product_Name Quantity
101 Pen 5
101 Book 2
102 Pencil 3
Second Normal Form (2NF)
Must be in 1NF
No partial dependency (No attribute should depend on only part of the primary key)
Example (Not in 2NF):
Order_ID (PK) Product_ID (PK) Product_Name Supplier
101 P1 Pen ABC Ltd
101 P2 Book XYZ Ltd
Issue: Product_Name and Supplier depend only on Product_ID, not on Order_ID.
Solution: Split the table.
Converted to 2NF:
Order Table
Order_ID (PK) Product_ID (FK)
101 P1
101 P2
Product Table
Product_ID (PK) Product_Name Supplier
P1 Pen ABC Ltd
P2 Book XYZ Ltd
Third Normal Form (3NF)
Must be in 2NF
No transitive dependency (A non-key attribute should not depend on another non-key
attribute)
Example (Not in 3NF):
Student_ID (PK) Student_Name Course_ID Course_Name
101 Alex CSE101 DBMS
102 John CSE102 OS
Issue: Course_Name depends on Course_ID, not Student_ID.
Solution: Split into two tables.
Converted to 3NF:
Student Table
Student_ID (PK) Student_Name Course_ID (FK)
101 Alex CSE101
102 John CSE102
Course Table
Course_ID (PK) Course_Name
CSE101 DBMS
CSE102 OS
Boyce-Codd Normal Form (BCNF)
A stricter version of 3NF
Every determinant must be a candidate key
Fourth Normal Form (4NF)
Must be in BCNF
No multi-valued dependencies
Example (Not in 4NF):
Student_ID (PK) Course Hobby
101 DBMS Chess
101 DBMS Music
101 OS Chess
Issue: Multi-valued dependency (Course and Hobby are independent).
Solution: Split into separate tables.
Student-Course Table
Student_ID (PK) Course
101 DBMS
101 OS
Student-Hobby Table
Student_ID (PK) Hobby
101 Chess
101 Music
3️⃣ SQL (Structured Query Language)
SQL is used to interact with databases.
SQL Commands
Data Retrieval (SELECT Statement)
SELECT Name, Age FROM Students WHERE Age > 20;
Sorting (ORDER BY)
SELECT Name, Age FROM Students ORDER BY Age DESC;
Grouping (GROUP BY and HAVING)
SELECT Course, COUNT(*) FROM Students GROUP BY Course HAVING COUNT(*) > 5;
Insert Data (INSERT INTO)
INSERT INTO Students (Student_ID, Name, Age) VALUES (101, 'Alice', 22);
Update Data (UPDATE)
UPDATE Students SET Age = 23 WHERE Student_ID = 101;
Delete Data (DELETE FROM)
DELETE FROM Students WHERE Age < 18;
Nested Queries
SELECT Name FROM Students WHERE Course_ID IN
(SELECT Course_ID FROM Courses WHERE Course_Name = 'DBMS');
UNIT IV: FoxPro & Case Studies
1️⃣ Introduction to FoxPro
FoxPro is a relational database management system (RDBMS) used for data processing,
management, and programming.
2️⃣ Database Operations in FoxPro
Creating a Database
CREATE DATABASE StudentDB
Creating a Table
CREATE TABLE Students (Student_ID INT, Name CHAR(20), Age INT)
Inserting Data
INSERT INTO Students VALUES (101, 'Alice', 22)
Searching Records
SELECT * FROM Students WHERE Age > 20
Sorting Records
SORT ON Age DESCENDING TO SortedStudents
Indexing
INDEX ON Student_ID TO StudentIndex
Updating Records
UPDATE Students SET Age = 23 WHERE Student_ID = 101
Report Generation
REPORT FORM StudentReport PREVIEW
3️⃣ Case Studies
Inventory Control System
Objective: Manage stock levels, suppliers, and sales.
Tables: Products, Suppliers, Sales
Queries: Low stock alerts, supplier details, total sales
Payroll Processing
Objective: Manage employee salaries, deductions, and attendance.
Tables: Employees, Salaries, Attendance
Queries: Monthly salary calculations, tax deductions
Summary
Normalization reduces redundancy and improves integrity
SQL is used for data manipulation
FoxPro is a relational database management system
Case Studies help in real-world application