0% found this document useful (0 votes)
4 views4 pages

DataBase Systems

The document provides an overview of databases, including definitions, types, and key concepts such as Database Management Systems (DBMS), SQL, normalization, ACID properties, indexing, transactions, triggers, stored procedures, NoSQL databases, data warehousing, and data mining. It highlights the importance of databases in various applications like banking, healthcare, and business analytics. Examples are given for each concept to illustrate their practical use.

Uploaded by

jadeatwork123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

DataBase Systems

The document provides an overview of databases, including definitions, types, and key concepts such as Database Management Systems (DBMS), SQL, normalization, ACID properties, indexing, transactions, triggers, stored procedures, NoSQL databases, data warehousing, and data mining. It highlights the importance of databases in various applications like banking, healthcare, and business analytics. Examples are given for each concept to illustrate their practical use.

Uploaded by

jadeatwork123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

DataBases

1. Introduction to Databases
Definition:
A database is a structured collection of data stored electronically, allowing
efficient retrieval, insertion, updating, and management.

Explanation:
Databases store information systematically, making it easy to access, update, and
manage large amounts of data.

Uses:
Websites (e.g., storing user profiles, orders)
Banking (e.g., storing transactions)
Hospitals (e.g., patient records)
Example:
A university database stores student names, roll numbers, and marks.
2. Database Management System (DBMS)
Definition:
A DBMS (Database Management System) is software that allows users to create,
manage, and interact with databases.

Explanation:
A DBMS provides an interface for users to interact with databases, ensuring
security, consistency, and easy data retrieval.

Uses:
Stores and manages large datasets
Provides multi-user access
Ensures data security
Example:
Popular DBMS software:

MySQL
PostgreSQL
Microsoft SQL Server
3. Types of Databases
Definition & Explanation:
Different types of databases are designed for specific needs.

Relational Database (RDBMS) – Stores data in tables with relations.


Example: MySQL, PostgreSQL
NoSQL Database – Stores unstructured or semi-structured data.
Example: MongoDB, Firebase
Hierarchical Database – Data stored in a tree-like structure.
Example: IBM IMS
Network Database – Uses a graph structure with multiple relationships.
Example: CODASYL DBMS
Uses:
RDBMS is used in banking, enterprise apps.
NoSQL is used in big data applications, real-time analytics.
4. SQL (Structured Query Language)
Definition:
SQL is a language used to query and manipulate relational databases.

Explanation:
SQL allows users to perform CRUD operations:

Create (INSERT)
Read (SELECT)
Update (UPDATE)
Delete (DELETE)
Uses:
Used in backend development
Helps retrieve and modify data
Example:
sql
Copy
Edit
SELECT * FROM Students WHERE age > 18;
(Selects all students older than 18.)

5. Normalization
Definition:
Normalization is a process of organizing a database to reduce redundancy and
improve integrity.

Explanation:
It divides a large table into smaller ones and establishes relationships between
them.

Forms of Normalization:
1NF (Eliminates duplicate columns)
2NF (Eliminates partial dependencies)
3NF (Removes transitive dependencies)
Uses:
Prevents data duplication
Saves storage space
Example:
Before normalization:

Student Course Teacher


Ali Math John
Sara Math John
Ali Science Mike
After normalization:
Students Table

Student_ID Name
1 Ali
2 Sara
Courses Table

Course_ID Course
101 Math
102 Science
6. ACID Properties
Definition:
ACID properties ensure database transactions are reliable.

Explanation:
Atomicity – All or nothing execution of a transaction.
Consistency – Ensures valid state before and after a transaction.
Isolation – Transactions don't interfere with each other.
Durability – Changes remain even after a system crash.
Uses:
Ensures data integrity in banking and e-commerce.
Example:
A banking transaction transferring money from one account to another must be atomic
—either fully complete or not executed at all.

7. Indexing
Definition:
Indexing is a technique that improves the speed of data retrieval.

Explanation:
An index creates a quick lookup mechanism for finding records faster.

Uses:
Used in search engines
Improves database performance
Example:
An index on the "name" column in a Students table allows fast searches.

sql
Copy
Edit
CREATE INDEX idx_name ON Students(name);
8. Transactions
Definition:
A transaction is a sequence of operations that is treated as a single unit.

Explanation:
A transaction ensures that multiple operations are completed together.

Uses:
Used in online payments, shopping carts.
Example:
If a user buys an item and the payment is deducted but the order is not placed, a
rollback should occur.

sql
Copy
Edit
BEGIN TRANSACTION;
UPDATE Accounts SET balance = balance - 100 WHERE user_id = 1;
UPDATE Orders SET status = 'Placed' WHERE order_id = 101;
COMMIT;
9. Triggers
Definition:
Triggers are special SQL procedures that execute automatically when certain
conditions are met.

Explanation:
Triggers help automate database tasks like logging changes.

Uses:
Used in auditing and security.
Example:
Automatically record when a new user is added.

sql
Copy
Edit
CREATE TRIGGER after_insert_user
AFTER INSERT ON Users
FOR EACH ROW
INSERT INTO AuditLog(user_id, action) VALUES (NEW.id, 'User Added');
10. Stored Procedures
Definition:
Stored procedures are precompiled SQL scripts stored in the database.

Explanation:
They improve security and efficiency by reducing repetitive query execution.

Uses:
Used in enterprise applications.
Example:
sql
Copy
Edit
CREATE PROCEDURE GetStudents()
AS
SELECT * FROM Students;
11. NoSQL Databases
Definition:
NoSQL databases store data in a non-relational format.

Explanation:
Unlike SQL databases, NoSQL databases store data in flexible formats like JSON,
key-value pairs, or graphs.

Uses:
Used in social media, real-time analytics.
Example:
MongoDB stores data in JSON format:

json
Copy
Edit
{ "name": "Ali", "age": 22, "city": "Lahore" }
12. Data Warehousing
Definition:
A data warehouse is a system used for reporting and data analysis.

Explanation:
It collects and stores large datasets for business intelligence.

Uses:
Used in business analytics, reporting.
Example:
Amazon stores customer purchase history in a data warehouse for recommendations.

13. Data Mining


Definition:
Data mining is the process of discovering patterns in large datasets.

Explanation:
It helps businesses find trends using algorithms.

Uses:
Used in fraud detection, recommendations.
Example:
Netflix suggests movies based on user preferences.

You might also like