Moocs
Moocs
On
of
B.Tech in CSE
RAJENDRA SINGH RATHOR
SESSION (2024-2025)
CERTIFICATE
SIGNATURE
TABLE OF CONTENT
I take this opportunity to express my profound gratitude and deep regards to my guide Mr. Aviral
Awasthi for her exemplary guidance, monitoring and constant encouragement throughout the course.
The blessing, help and guidance given by her time to time helped me throughout the project. The
success and final outcome of this course required a lot of guidance and assistance from many people
and I am extremely privileged to have got this all along the completion of my report. All that I have
Done is only due to such supervision and assistance and I would not forget to thank them. I am
Thankful to and fortunate enough to get constant encouragement, support and guidance from all the
People around me which helped me in successfully completing my online course.
Introduction
The Database Management System (DBMS) course introduces the concepts and principles behind
managing data in an organized and efficient way. A DBMS is a software system that helps users
create, manage, and interact with databases.
The course covers various aspects of databases, including how data is stored, accessed, and
maintained. It also provides insights into solving real-world problems by organizing data
systematically and securely. This module lays the foundation for understanding how modern
applications rely on databases to function smoothly.
1
ER Models and Diagrams
Cardinality
• Specifies how many instances of one entity are associated with instances
of another entity.
• Types of cardinality include:
o One-to-One (1:1): A student has one ID card
o Many-to-Many (M:N): Students enroll in many courses, and
courses have many students.
Importance of ER Models and Diagrams
• Clarity: Provides a clear structure for the database design.
• Simplicity: Simplifies communication between developers and
stakeholders.
• Error Reduction: Identifies potential design issues early in the
development process.
• Foundation for Implementation: Acts as a roadmap for creating the
actual database.
3
Relational Algebra
5
Division Operator
The Division operator is used to find rows in one relation that match all values
of another relation. It is typically used when dealing with "all" conditions.
Example:
If we have two tables:
• StudentsCourses (Student, Course)
• Courses (Course)
The query "Which students are enrolled in all courses?" can be answered using
the division operator:
StudentsCourses ÷ Courses
Structured Query Language (SQL) stands as the cornerstone of relational
database management systems (RDBMS), serving as a universal language for
managing, manipulating, and querying data. Its significance lies in its ability to
interact with databases, enabling users to retrieve, insert, update, and delete data
with ease and efficiency.
SQL operates on the principle of relational algebra, offering a standardized
approach to interact with databases irrespective of the underlying RDBMS
platform. It provides a rich set of commands and syntax for performing various
operations on data, making it a versatile tool for developers, data analysts, and
database administrators alike.
The primary components of SQL include:
1. Data Definition Language (DDL): DDL commands facilitate the creation,
modification, and deletion of database objects such as tables, indexes, and
views. Commands like CREATE, ALTER, and DROP are used to define the
structure and organization of data within a database.
2. Data Manipulation Language (DML): DML commands enable users to
manipulate the data stored in tables. Commands like SELECT, INSERT,
UPDATE, and DELETE are used to retrieve, add, modify, and remove data
6
from tables, facilitating seamless data manipulation.
3. Data Control Language (DCL): DCL commands govern the access and
permissions granted to users for database objects. Commands like GRANT and
REVOKE regulate user privileges, ensuring data security and integrity within
the database environment.
4. Data Query Language (DQL): DQL is primarily concerned with querying
data from databases using SELECT statements. It allows users to retrieve
specific data subsets based on specified criteria, enabling comprehensive data
analysis and reporting
7
SQL
Introduction
This section delved into the various SQL commands essential for data
manipulation and retrieval. It covered a wide array of commands including
SELECT, INSERT, UPDATE, and DELETE, elucidating their syntax and
usage. Additionally, the course explored different data types supported by SQL,
emphasizing their significance in defining the structure of a database.
Constraints
Query Writing
Sample Tables
8
Joins in SQL
Joins are pivotal for fetching data from multiple tables based on common
columns. This section elucidated different types of joins including INNER
JOIN, LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN. Participants
learned to leverage joins effectively to combine data from disparate tables,
facilitating comprehensive data analysis.
Subquery
Subqueries enable nesting one query within another, allowing for complex data
retrieval and manipulation. This section explored the concept of subqueries,
illustrating their applications in filtering, sorting, and aggregating data.
Participants gained insights into writing efficient subqueries to solve intricate
database problems.
Derived Table
Derived tables, also known as inline views, are temporary result sets generated
within a SQL query. This section delved into the creation and utilization of
derived tables to simplify complex queries and improve query performance.
Participants learned to leverage derived tables effectively for data analysis and
reporting purposes.
Views
9
Data Manipulation Language
Introduction to Data Manipulation Language
DML operations are essential for interacting with the database and ensuring
data remains up-to-date and accurate.
INSERT Command
Example:
Imagine a "Students" table with columns for ID, Name, and Age. To add a new
student, you would use the INSERT command. For example, you could add a
student with an ID of 1, a name of "John Doe," and an age of 20.
Points to Note:
UPDATE Command
Example:
Suppose you need to update the age of the student with an ID of 1 in the
"Students" table. If the student’s age was originally 20 and you want to change
it to 21, you would use the UPDATE command.
10
Points to Note:
DELETE Command
Example:
If a student with an ID of 1 leaves the system and you no longer need to keep
their information, you can use the DELETE command to remove their record
from the "Students" table.
Points to Note:
11
Data Definition Language
Introduction to Data Definition Language
DDL operations are crucial for creating and maintaining the database
framework, ensuring that it meets the requirements of the application or
organization.
CREATE Command
The CREATE command is used to create new database objects like tables,
indexes, or schemas.
Example:
If you want to create a table named "Students" with columns for ID, Name, and
Age, the CREATE command helps set up the structure for storing this data.
This is the starting point for defining the data storage framework of the
database.
ALTER Command
Example:
If the "Students" table needs an additional column for storing email addresses,
the ALTER command can be used to add the new column without affecting the
existing data.
DROP Command
12
Example:
If the "Students" table is no longer needed, the DROP command can remove it
from the database entirely.
TRUNCATE Command
The TRUNCATE command is used to remove all rows from a table without
deleting the table itself. Unlike the DELETE command, TRUNCATE resets the
table and frees up storage space used by the data.
Example:
If you want to remove all records from the "Students" table but keep the table
structure intact for future use, the TRUNCATE command is ideal.
It is faster and more efficient than DELETE for bulk data removal.
Example:
If you only need to remove records of students older than 25 from the
"Students" table, DELETE is appropriate.
This makes DELETE more flexible than TRUNCATE but less efficient for
clearing entire tables.
13
Data Control Language
Introduction to Data Control Language
GRANT Command
Example:
If a user named "Alice" needs permission to read data from a table called
"Students," the GRANT command can give her the necessary access.
The GRANT command ensures that users only have access to the data and
operations they need, minimizing security risks.
REVOKE Command
The REVOKE command helps maintain strict control over database security by
allowing administrators to modify or remove user privileges as necessary.
14
Normalization
Introduction to Normalization
Example:
A table storing student details is not in 1NF if the "Subjects" column contains
multiple subjects like "Math, Science". To make it 1NF, each subject should be
stored in a separate row.
1. It is in 1NF.
2. All non-key attributes are fully dependent on the primary key.
Example:
15
Third Normal Form (3NF)
1. It is in 2NF.
2. There are no transitive dependencies.
Example:
1. It is in 3NF.
2. For every functional dependency (A → B), A must be a superkey (a key
that uniquely identifies rows).
Example:
16
File Structure
Files and Indexing
In databases, files store the data, and indexing helps improve the speed of data
retrieval. Indexing is a technique used to quickly locate and access data in a
database table without having to scan every row.
Files:
Files are used to store data in a structured way. In databases, data is usually
stored in files that represent tables. These files can be organized in different
formats, such as flat files or more complex hierarchical or relational formats.
Indexing:
Indexing involves creating a separate data structure (an index) that points to the
locations of data within the file. This index allows for faster retrieval of data by
searching through the index rather than scanning the entire file.
B-Trees
B-Trees are a type of self-balancing tree data structure that maintains sorted
data and allows searches, insertions, deletions, and other operations in
logarithmic time. They are widely used in database indexing because they keep
data sorted and are efficient for disk-based storage.
Characteristics of B-Trees:
B-Trees are used in situations where the data is too large to fit into memory and
needs to be stored on disk, such as in databases and filesystems.
17
B+ Trees
B+ Trees are an extension of B-Trees, where all data records are stored in the
leaf nodes, and internal nodes only store keys (pointers to child nodes). The
main advantage of B+ Trees is that they allow efficient range queries since all
the data records are stored in leaf nodes and are linked sequentially.
Characteristics of B+ Trees:
• Leaf Nodes Linked: All leaf nodes are linked together, making range
queries faster and easier.
• Internal Nodes Store Keys: Internal nodes do not store data, only keys
that help in navigating the tree.
• Efficient for Range Queries: Since leaf nodes are linked in a sequence,
you can perform range queries by simply following the links between leaf
nodes.
18
Conclusion
In this seminar report on Database Management Systems (DBMS), we have
explored several fundamental concepts and modules that form the backbone of
modern database management. From understanding the core principles of
DBMS to diving deep into the technical aspects of Data Definition Language
(DDL), Data Manipulation Language (DML), Normalization, File Structures,
and more, this report aims to provide a comprehensive overview of how
databases are designed, managed, and optimized.
Through this exploration, we see that DBMS not only plays a crucial role in
organizing, storing, and retrieving data but also supports the smooth functioning
of various applications, ranging from small-scale systems to large enterprise-
level solutions. The knowledge gained from studying these topics allows us to
better understand the complexity of database design and management, preparing
us for real-world challenges.
19
Certificate
20