Docsity

Relational Databases Revision Notes, Study notes of Computer science

Toggle sidebar
bg1
Relational Databases & SQL – Complete
Revision Notes (Class 12)
1. Introduction to Database
A database is a collection of related data stored in an organized way so it can be easily
accessed, managed, and updated.
A Database Management System (DBMS) is software used to:
Store data
Retrieve data
Modify data
Manage large amounts of information
Example: School records, bank systems, hospital databases
Purpose of Database
Traditional file systems have problems like:
Data redundancy (duplicate data)
Data inconsistency
Poor security
Advantages of Database System
1. Reduced Data Redundancy
Avoids duplication of data
Saves storage space
2. Controlled Data Inconsistency
Ensures same data is updated everywhere
3. Data Sharing
Multiple users can access data simultaneously
4. Standardized Data
pf3
pf4
pf5

Partial preview of the text

Download Relational Databases Revision Notes and more Study notes Computer science in PDF only on Docsity!

Relational Databases & SQL – Complete

Revision Notes (Class 12)

1. Introduction to Database

A database is a collection of related data stored in an organized way so it can be easily accessed, managed, and updated. A Database Management System (DBMS) is software used to:  Store data  Retrieve data  Modify data  Manage large amounts of information Example: School records, bank systems, hospital databases

Purpose of Database

Traditional file systems have problems like:  Data redundancy (duplicate data)  Data inconsistency  Poor security

Advantages of Database System

1. Reduced Data Redundancy

 Avoids duplication of data  Saves storage space

2. Controlled Data Inconsistency

 Ensures same data is updated everywhere

3. Data Sharing

 Multiple users can access data simultaneously

4. Standardized Data

 Follows uniform format and rules

5. Data Security

 Access control using passwords & permissions

6. Data Integrity

 Ensures accurate and valid data

2. Data Models A data model defines how data is stored and organized.

Types of Data Models:

🔹 Relational Model

 Data stored in tables (rows & columns)  Most widely used

🔹 Network Model

 Data stored as records connected by links

🔹 Hierarchical Model

 Data organized in a tree structure

3. Relational Model (Important) Proposed by E.F. Codd (1970)

Key Features:

 Data stored in tables  Each row = record  Each column = attribute

🔹 Candidate Key

 All possible keys that can become primary key

🔹 Alternate Key

 Candidate key not selected as primary key

🔹 Foreign Key

 Links one table to another 👉 Example:  Student ID → Primary Key  Class ID → Foreign Key 🔗 6. Referential Integrity Ensures relationships between tables remain valid.

Rules:

 Foreign key must match primary key  Cannot delete referenced data  Prevents invalid data entry

Special Features:

Cascade Delete → Deletes related data automatically  Cascade Update → Updates related data automatically

7. Introduction to MySQL MySQL is an:  Open-source RDBMS  Uses SQL language

Features:

 Fast and reliable  Free to use  Supports large data

8. SQL (Structured Query Language) Used to:  Create database  Retrieve data  Modify data 9. Types of SQL Commands

🔹 DDL (Data Definition Language)

Used to define structure Commands:  CREATE  ALTER  DROP

🔹 DML (Data Manipulation Language)

Used to modify data Commands:  INSERT  UPDATE  DELETE  SELECT