DBMS File Bhavya
DBMS File Bhavya
DBMS: A Database Management System (DBMS) is a software tool designed to create, manage, and
interact with databases. It serves as an interface between the database and the end-users, allowing for
efficient data storage, retrieval, and manipulation.
● Data Management: DBMS helps in storing, managing, and scaling data, which is essential for
data-driven workflows and analysis.
● Data Integrity and Security: It ensures the accuracy and quality of data while providing
mechanisms for data security and concurrent access.
● User Interaction: Users can perform various operations on the data, such as querying, updating, and
deleting records, through the DBMS.
Advantages of DBMS
A Database Management System (DBMS) offers numerous advantages that enhance data management and
operational efficiency. Here are some key benefits:
● Data Independence: DBMS provides a level of abstraction that separates data from the applications
that use it. This means users can work with data without needing to know its exact location or
structure, which enhances adaptability and reduces the risk of data corruption due to changes in
hardware or software.
● Improved Data Integrity and Consistency: DBMS enforces rules and constraints on data, ensuring
that all information is accurate and consistent. For instance, it can restrict certain fields to unique
values, preventing duplicate entries.
● Efficient Data Access and Sharing: DBMS facilitates quick and efficient access to data, allowing
multiple users to retrieve and manipulate data simultaneously without conflicts. This is particularly
beneficial in collaborative environments.
● Reduced Data Redundancy: By centralizing data storage, DBMS minimizes data duplication,
which helps maintain data consistency and reduces storage costs.
Disadvantages of DBMS
While Database Management Systems (DBMS) offer numerous advantages, they also come with certain
disadvantages that organizations should consider:
● Cost of Hardware and Software: Implementing a DBMS often requires significant investment in
both hardware and software. High-speed processors and large memory capacities are essential to
handle the data efficiently, which can increase overall costs significantly.
● Performance Issues: As the size and complexity of a database grow, performance can become a
concern. Queries may slow down, especially if the database is not optimized or if it experiences high
traffic from multiple users.
● Complexity: DBMS can be complex to set up and manage. This complexity requires specialized
knowledge and training for database administrators and users, which can lead to inefficiencies if not
handled properly.
● Banking: For managing transactions, customer accounts, and financial records, ensuring data
integrity and security.
● E-commerce: To handle product inventories, customer data, and order processing, facilitating
smooth online transactions.
● Healthcare: In medical records systems to store patient information, treatment histories, and billing
details, ensuring compliance with regulations.
● Telecommunications: For managing customer data, call records, and billing information, enabling
efficient service delivery.
SQL: SQL, or Structured Query Language, is a domain-specific language used for managing and
manipulating data in relational database management systems (RDBMS). It is particularly effective for
handling structured data, which is organized into tables consisting of rows and columns.
● Data Querying: SQL allows users to retrieve data from databases using queries, making it easy to
access specific information.
● Data Manipulation: Users can insert, update, and delete records in a database, enabling dynamic
data management.
● Data Definition: SQL provides commands to define and modify database structures, such as creating
or altering tables.
● Data Control: It includes features for controlling access to data, ensuring that only authorized users
can perform certain operations.
Types of SQL
SQL commands are categorized into several types, each serving a specific purpose in database management.
The main types of SQL are:
● Data Definition Language (DDL): This type includes commands that define and manage all
database objects. Common DDL commands are:
○ CREATE: To create new tables or databases.
● Data Manipulation Language (DML): DML commands are used for managing data within the
database. Key DML commands include:
○ INSERT: To add new records to a table.
● Data Control Language (DCL): DCL commands are used to control access to data within the
database. Important DCL commands include:
○ GRANT: To provide user access privileges.
● Transaction Control Language (TCL): TCL commands manage transactions in the database,
ensuring data integrity. Key TCL commands are:
○ COMMIT: To save all changes made during the current transaction.
Syntax- COMMIT;
Syntax- ROLLBACK;
Database Architecture: Database architecture refers to the design, structure, and organization of a database
system. It defines how data is stored, managed, and accessed within the system. There are different types of
database architectures, including one-tier, two-tier, and three-tier, each with its own configuration and use
cases
One-Tier Architecture: All components (UI, logic, database) on one system. Simple, but not scalable.
Two-Tier Architecture: Client (UI) directly communicates with server (database). Better performance, but
server can be a bottleneck.
Three-Tier Architecture: Client, middle tier (handles logic), and database server. Offers scalability,
flexibility, and maintainability, but more complex to develop.
Bhavya Gupta (02814802723)
Program- 1
Aim: The Institute offers multiple B. Tech Courses. Students can take admission in any Course offered by
the Institute. Multiple subjects are taught in each branch. The institute has a Director and Hod of each B.
Tech Course. The HoD of another branch may be given additional responsibility to take charge of one more
department for a limited period in the absence of Hod of that branch. Faculties recruited in each B. Tech
Course can teach only a single same subject to students of different B.Tech Courses. For each subject, there
is a faculty coordinator responsible for coordinating all the faculties teaching the same subject. A batch of 20
students is assigned a faculty mentor. The mentor takes counsellor meetings twice a month.
Data to be recorded in the database include:
Student – enrollment no, name, date of birth, address, contact no, email – id, qualifying exam rank, Course
Faculty – Faculty name, contact no, email id, course
Parents data – Parents name, contact no, email id, Profession
Draw the ER diagram (Conceptual design) of the given problem statement.
Theory: The Entity Relationship Model is a model for identifying entities (like student, car or company) to
be represented in the database and representation of how those entities are related. The ER data model
specifies an enterprise schema that represents the overall logical structure of a database graphically.
3. Relationship- A Relationship Type represents the association between entity types. For example,
‘Enrolled in’ is a relationship type that exists between entity type Student and Course. In the ER
diagram, the relationship type is represented by a diamond and connects the entities with lines.
Degree of a Relationship
The degree of a relationship refers to the number of entity types that participate in that relationship.
It's like counting how many different "things" are involved in the connection.
a. Unary Relationship: Only one entity type participates. Imagine a "Person" entity where a
person can be married to another person (within the same "Person" entity). This is a degree 1
relationship.
b. Binary Relationship: Two entity types participate. This is the most common type. For
example, a "Student" entity can be related to a "Course" entity (students enroll in courses).
This is a degree 2 relationship.
c. Ternary Relationship: Three entity types participate. For example, a "Student," "Course,"
and "Professor" entity might be related in a "Student takes a course taught by a professor"
scenario. This is a degree 3 relationship.
d. N-ary Relationship: More than three entity types participate. These are less common and
can be more complex to represent.
Cardinality of a Relationship
Cardinality describes the number of instances of one entity that can be associated with instances of
another entity. It's like specifying the limits on how many connections can exist.
a. One-to-One (1:1): One instance of entity A is related to at most one instance of entity B, and
vice-versa. Think of a "Person" and their "Passport" - one person usually has one passport,
and one passport belongs to one person.
b. One-to-Many (1:M): One instance of entity A can be related to many instances of entity B,
but one instance of entity B is related to only one instance of entity A. For example, a
"Teacher" can teach many "Students," but a "Student" has one "Teacher" (in a specific class).
c. Many-to-One (M:1): Many instances of entity A can be related to one instance of entity B,
but one instance of entity B is related to many instances of entity A. This is the reverse of
one-to-many. For example, many "Students" can belong to one "Class," but one "Class" has
many "Students."
E-R Diagram-
Entities-
Student, Faculty, Parents, Course, Subject, Director, Hod, Faculty_coordinator and Mentor.
Attributes-
1. Student– enrollment no, name, date of birth, address, contact no, email – id, qualifying exam rank,
Course, mentor_id
2. Parents– Parents name, contact no, email id, Profession
3. Faculty– Faculty name, contact no, email id
4. Course– course name, course_id, hod_id
5. Subject– subject name, subject_id, faculty_coordinator_id
6. Director– director name, director_id
7. Hod- hod name, hod_id, course_id
8. Faculty_coordinator– faculty_coordinator_id, faculty_coordinator_name, subject_id
9. Mentor— mentor_id, mentor_name
Relationships-
1. Student — has — Parents
2. Student — enrolled in — Course
3. Subject — belongs to — Course
4. Faculty_coordinator — coordinates — Subject
5. Hod — manages — course
6. Director — manages — hod
7. Mentor — mentors — Student
8. Faculty — teaches — Subject
The Railway Management System is designed to efficiently manage train schedules, passenger bookings,
ticket payments, and cancellations. Below is a detailed description of the database, including its entities,
attributes, and relationships.
Attributes-
1. Stations- stations_id (primary key, auto increment), name, location, state and zipcode.
2. Trains- train_id (primary key, auto increment), train_name, train_type (ex- Express, Passenger,
Freight), source_station_id (foreign key => stations.station_id), destination_station_id (foreign key
=> stations.station_id) and total_seats.
3. Passengers- passenger_id, name, age, gender, email, phone.
4. Tickets- ticket_id (primary key, auto increment), passenger_id (foreign key =>
passengers.passenger_id), train_id (foreign key => trains.train_id), source_station_id (foreign key =>
stations.station_id), destination_station_id (foreign key => stations.station_id), seat_number,
booking_date, travel_date, status, price
Relationships-
1. passengers (passenger_id) ---< tickets (passenger_id)
2. trains (train_id) ---< tickets (train_id)
3. stations (station_id) ---< trains (source_station_id, destination_station_id)
4. stations (station_id) ---< tickets (source_station_id, destination_station_id)
WHERE condition;