0% found this document useful (0 votes)
6 views17 pages

Database Management System Major Assignment

The document is a comprehensive overview of Database Management Systems (DBMS), covering various types such as RDBMS and NoSQL databases, along with key concepts like database design, SQL fundamentals, and data security. It includes practical examples and scenarios for better understanding, such as an online bookstore and a university management system. Additionally, it discusses advanced topics like cloud databases, indexing, and transaction management.

Uploaded by

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

Database Management System Major Assignment

The document is a comprehensive overview of Database Management Systems (DBMS), covering various types such as RDBMS and NoSQL databases, along with key concepts like database design, SQL fundamentals, and data security. It includes practical examples and scenarios for better understanding, such as an online bookstore and a university management system. Additionally, it discusses advanced topics like cloud databases, indexing, and transaction management.

Uploaded by

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

DATABASE SYSTEM

Major Assignment

SUBMITTED BY:
14660 SAMI ULLAH

SECTION (F)

SUBMITTED BY:
Mr. SAMEED UR REHMAN

Department BS Computer Science City University of Science and


Information Technology Peshawar.
1. Introduction to Database Management Systems (DBMS)
A Database Management System (DBMS) is software that facilitates the creation, management, and
manipulation of databases. Users can efficiently store, retrieve, and update data through its user-friendly
interface while maintaining data security and integrity. Examples include MySQL, Oracle, and
PostgreSQL.

Example: A DBMS is used by a library to manage loans, borrowers, and books, making it easy to search
for available books.

2. Relational Database Management Systems (RDBMS)


RDBMS organizes data into tables (relations) with rows and columns, using primary and foreign keys to
establish relationships. It follows a fixed schema and uses SQL for querying. Constraints like UNIQUE
and NOT NULL are used by RDBMS to guarantee data integrity.

Table: Sample Customers Table:


Customer_ID First_Name Last_Name Email City
1 Ahmed Khan [email protected] Peshawar
2 Fatima Ali [email protected] Lahore

Example: An RDBMS for an e-commerce platform links a Customers table to an Orders table via
CustomerID.

3. Types and Use Cases of NoSQL Databases


For big data applications, NoSQL databases handle unstructured or semi-structured data and offer flexibility
and scalability. Types include Key-Value, Document, Column-Family, and Graph databases, each
suited for specific use cases.
Table: Types of NoSQL Databases
Type Description Use Case Example Example
DB User
Key-Value Simple key-value pairs Session management, Redis Zainab Malik
caching
Document Documents in JSON or E-commerce, CMS MongoDB Bilal Ahmed
BSON
Column- Column-based storage Big data analytics Cassandra Ayesha
Family Siddiqui
Graph Edges and nodes for Social networks, fraud Neo4j Hassan Raza
connections detection
4. Database Design Principles and Normalization
Database design involves creating an efficient structure to minimize redundancy and ensure data integrity.
Principles include clarity (intuitive naming), modularity (logical separation), and scalability.
Normalization organizes data into tables to eliminate redundancy, following forms like 1NF, 2NF, and
3NF.
Example: Splitting a customer-order table into separate Customers and Orders tables to avoid repeating
customer details.

5. Entity-Relationship (ER) Modeling


ER modeling represents database structure using entities (objects like Customer), attributes (properties
like Name), and relationships (e.g., Customer places Order). ER diagrams use rectangles (entities), ovals
(attributes), and diamonds (relationships).

Table: ER Model for Bookstore

Entity Attribute Data Type Constraint


Customer CustomerID INT Primary Key
Customer Name VARCHAR(100) NOT NULL
Book BookID INT Primary Key
Book Title VARCHAR(100) NOT NULL

Example: A 1: N relationship connects an Order entity to a Customer entity.

6. SQL (Structured Query Language) Fundamentals


SQL is the standard language for querying and managing relational databases. It includes commands like:

1. SELECT (retrieve)
2. INSERT (add)
3. UPDATE (modify)
4. DELETE (remove)

7. Indexing and Query Optimization


Indexes are data structures that improve query performance by allowing faster data retrieval. Common
types include B-tree and hash indexes. Query optimization involves efficient SQL writing and
minimizing computation.
8. Control of Transactions and Concurrency
ACID properties—Atomicity, Consistency, Isolation, and Durability—ensure reliable operations.
Concurrency control (e.g., locking) prevents conflicts in multi-user environments.

9. Backup and Recovery in DBMS


Backups create copies to prevent data loss; recovery restores databases after failures. Types include full,
incremental, and differential backups.

10. Data Warehousing and Business Intelligence


Data warehouses store historical data for analysis, supporting BI tools like Power BI. They use star or
snowflake schemas for efficient querying.
Example: A warehouse for sales data with a fact table (Sales) and dimension tables (Time, Product).

11. Analytics and Management of Big Data


Big data involves managing massive datasets using tools like Hadoop, Spark, or NoSQL databases.
Analytics extract insights from large-scale data.
Example: Analyzing customer purchase patterns using Apache Spark.

12. Distributed Database Systems


Distributed databases store data across multiple locations, improving scalability and fault tolerance.
Challenges include data consistency and latency.
Example: A bank with branches in Karachi, Lahore, and Islamabad uses a distributed database for
account data.

13. Object-Oriented Databases


Object-oriented databases store data as objects, combining data and behavior. They are ideal for
applications with complex data, like CAD systems.
Example: Storing a Car object with attributes (color, model) and methods (start, stop).

14. Data Security and Privacy in DBMS


Security protects data from unauthorized access using authentication, encryption, and access control.
Privacy makes sure that laws like the GDPR are followed.
Table: Permissions for Users Role
Role Permissions Example User
Admin Full access Salman Iqbal
Clerk SELECT, INSERT Ayesha Siddiqui
Guest SELECT (limited) Zainab Malik
15. Database Administration and Performance Tuning
Database administrators (DBAs) manage DBMS, optimize performance, and ensure uptime. Tuning
involves indexing, query optimization, and resource allocation.
For instance, keeping an eye on CPU usage to identify slow queries.

16. Cloud Databases: Deployment and Management


Cloud databases (e.g., AWS RDS, Google Cloud SQL) offer scalability, backups, and managed services.
They reduce infrastructure overhead.
Example: Deploying a MySQL database on AWS RDS for a Pakistani e-commerce site.

17. In-memory Databases and Caching Strategies


In-memory databases (e.g., Redis) store data in RAM for fast access. Caching reduces database load by
storing frequently accessed data.
Example: Caching user profiles in Redis for a social media app.

18. Geospatial Databases and GIS


Geospatial databases store location-based data (e.g., coordinates) for Geographic Information Systems
(GIS). Examples: PostGIS, Oracle Spatial.
Example: Mapping delivery routes for a courier service in Karachi.

19. Time Series Databases for IoT Applications


Time series databases (e.g., InfluxDB) store time-stamped data, ideal for IoT applications like sensor
monitoring.
Example: Storing temperature data from IoT devices in a factory.

20. Graph Databases and Network Analysis


Graph databases (e.g., Neo4j) model relationships as nodes and edges, suitable for social networks or
fraud detection.
Table: Graph Example
Node Relationship Connected Node
Ali Raza Friend Zara Khan
Zara Khan Friend Sana Iqbal

Example: Querying friends of Ali Raza in Neo4j.

21. Introduction to Databases: Basic Concepts and Terminology


A database is an organized collection of data. Table (data structure), row (record), column (attribute), and
schema are important terms.

22. Understanding a Database's Tables, Rows, and Columns


Tables store data in rows and columns. Each row is a record, and each column is an attribute.
Table: Employees
EmpID Name Department Salary
1 Qureshi Usman IT 75000
2 Maryam Noor HR 60000
23. Using DBMS to Create and Manage Databases
Create databases using SQL commands and manage them with tools like phpMyAdmin.
Example: used phpMyAdmin

24. Introduction to SQL: Retrieving Data with SELECT Statements


SELECT is used to retrieve specific rows or columns from tables.
Example: table of employee

Insertion data in employee table:

Selection from employees:

25. Data Entry, Editing, and Delete in a Database


INSERT adds data, UPDATE modifies it, and DELETE removes it.
Example: Data entry (insertion).

Editing (update data).


Delete from database.

26. Primary Keys and Foreign Keys: Maintaining Data Integrity


Primary keys uniquely identify rows; foreign keys link tables to enforce referential integrity.
Example: Stud_id in student references stud_id in department.

27. Sorting and Filtering Data in SQL Queries


For sorting and filtering, use ORDER BY and WHERE.
Example:
i. Basic Filtering with WHERE:

ii. Sorting with ORDER BY:


iii. Combining Filtering and Sorting:

iv. Multiple Conditions:

v. Pattern Matching:

28. Basic Joins: Understanding INNER JOIN and LEFT JOIN


Joins combine data from multiple tables.
INNER JOIN
returns matching
records.

LEFT JOIN
includes all
records from the
left table.

29. Aggregate Functions in SQL (SUM, AVG, COUNT, MAX, MIN)


Aggregate functions perform calculations on a set of values and return a single value. They are commonly
used with the GROUP BY clause for data analysis.
1. Sum()

2. Avg()

3. Count()
4. Max() and Min()

30. Introduction to Database Normalization: First Normal Form (1NF)


Database normalization is a process of organizing data to minimize redundancy and improve data
integrity. First Normal Form (1NF) is the foundational step in this process.
Table: UNormalized vs. 1NF
Unnormalized:
OrderID CustomerName BooksOrdered
1 Bilal Ahmed Book1, Book2

1NF:

OrderID CustomerName BookOrdered


1 Bilal Ahmed Book1
1 Bilal Ahmed Book2

31. Backing Up and Restoring Databases


Backups save data; restores recover it after failures.
Examples: backup and restore queries (sql).

32. Simple Query Optimization Techniques


Optimize queries by using indexes, selecting specific columns, and avoiding subqueries where possible.
33. Data Types in SQL: VARCHAR, INT, DATE, etc.
Data types define the format of column values.
Table: Common Data Types
Data Type Use Case Example Value
VARCHAR Names, emails 'Hassan Raza'
INT IDs, counts 101
DATE Dates '2025-04-27'
34. Database Constraints: NOT NULL, UNIQUE, DEFAULT
Constraints enforce data integrity rules in database tables.
 NOT NULL (Mandatory Fields)
Ensures a column cannot contain NULL values.
 UNIQUE (No Duplicate Values)
Ensures all values in a column are distinct.
 DEFAULT (Fallback Value)
Sets a default value if none is provided.
35. Basic Transaction Management: COMMIT and ROLLBACK
Key Commands:
 START TRANSACTION → Begins transaction
 COMMIT → Saves changes permanently
 ROLLBACK → Undoes all changes

36. Introduction to Indexing: Improving Query Performance


Indexes reduce query execution time but slow down writes.

37. Creating Views for Data Presentation


Views are virtual tables based on queries, simplifying data access.
Creating a View (Example with Employees Table).
38. Introduction to Stored Procedures and Functions
Stored procedures are precompiled SQL scripts; functions return values.
Key Differences:
FEATURE PROCEDURE FUNCTION
RETURNS VALUE Optional Required
USAGE CALL SELECT
TRANSACTIONS Yes No

39. Database Security: User Permissions and Access Control


Database security refers to the measures implemented to protect data from unauthorized access,
modification, or destruction. Control access using GRANT and REVOKE.
Key Commands:
CREATE USER
GRANT (assign privileges)
REVOKE (remove privileges)

40. Simple Data Import and Export Operations


Data Export = Extracting database records into files (e.g., CSV, SQL).
Data Import = Loading external data into database tables.

41. Scenario: Online Bookstore Database


Database Schema Design

Tables:
1. Books

Insertion data in Books table:


2. Customers

Insertion data in Customers table:

3. Orders
Insertion data in Orders table:

4. OrderDetails

Insertion data in OrderDetails table:


42. University Management System Solution

Database Schema Design


Tables:
1. Students

Insert Students data:

2. Departments

Insert departments data:


3. Courses

Insert courses data:

4. Instructions

Insert instructions data:


5. Enrollments

Insert enrollments data:

You might also like