0% found this document useful (0 votes)
2 views

DBMS sheet

A Database Management System (DBMS) is software that facilitates the creation, organization, storage, retrieval, and management of data in databases, ensuring data security and integrity. Key constraints in the relational model include primary keys, foreign keys, and unique keys, which maintain data accuracy and consistency, while DBMS offers advantages over file-based systems such as reduced data redundancy and improved data integrity. The document also discusses normalization, the three-schema architecture, and various components and roles of a DBMS.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

DBMS sheet

A Database Management System (DBMS) is software that facilitates the creation, organization, storage, retrieval, and management of data in databases, ensuring data security and integrity. Key constraints in the relational model include primary keys, foreign keys, and unique keys, which maintain data accuracy and consistency, while DBMS offers advantages over file-based systems such as reduced data redundancy and improved data integrity. The document also discusses normalization, the three-schema architecture, and various components and roles of a DBMS.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

What is a Database Management System (DBMS)? Explain Attributes: Describe properties or characteristics of an entity.

tics of an entity. What are the key constraints in the relational model? Explain
its advantages over file-based systems. Example: Attributes for "Student" can include "Student_ID", primary key, foreign key, and unique key.
A Database Management System (DBMS) is software that "Name", and "DOB". Constraints ensure the accuracy, consistency, and integrity of
enables the creation, organization, storage, retrieval, and Primary Key: A unique attribute that identifies each record in an data in a relational database. The major constraints include:
management of data in databases. It allows multiple users and entity. 1. Primary Key: A set of one or more attributes that
applications to efficiently access and manipulate data while Example: "Student_ID" for the "Student" entity. uniquely identifies each tuple in a relation.
maintaining data security and integrity. Examples of DBMS Relationship: Represents the association between entities. Example: In a "Student" table, "Student_ID" can be a
include MySQL, Oracle, and PostgreSQL. Example: "Enrolls" relationship between "Student" and "Course". primary key as it uniquely identifies each student.
Advantages over file-based systems: Cardinality: Defines the number of instances of one entity that 2. Foreign Key: An attribute in one relation that references
Data Redundancy: Minimizes duplication of data. can be associated with instances of another entity. the primary key of another relation.
Data Consistency: data remains consistent across the system. Example: One "Student" can enroll in multiple "Courses" (1:N), Example: In an "Enrollment" table, "Student_ID" may be
Data Integrity: Enforces rules to maintain accuracy and and each "Course" can have many "Students" (N:M). a foreign key referencing the "Student" table's primary
reliability. Strong Entity Weak Entity key.
Data Security: Provides access control and encryption. 3. Unique Key: Ensures that all values in a column or
Data Sharing: Allows multiple users to access data An entity that can be An entity that cannot be uniquely combination of columns are unique across the relation.
simultaneously. uniquely identified by its identified by its own attributes and Example: "Email" in a "User" table can be a unique key
Backup and Recovery: Offers mechanisms for data recovery in own attributes. depends on a strong entity. as no two users can have the same email address.
case of failure. Has a primary key that Does not have a primary key; uses a DELETE TRUNCATE
Differentiate between data, information, and metadata. uniquely identifies each partial key and a foreign key from the
Data Information Metadata record. related strong entity. Removes specific rows from a table Removes all rows from
based on a condition. a table.
Raw, Processed or Data about data, Can exist independently
Depends on a relationship with a
unprocessed structured data providing context, without relying on other Can use WHERE clause to filter Cannot filter rows; deletes
strong entity for identification.
facts and that has structure, or entities. rows for deletion. all rows.
figures without meaning and description of the Represented by a Slower due to row-by-row Faster because it deallocates
Represented by a double rectangle in
context. relevance. data. rectangle in ER deletion and logging. entire pages of data.
ER diagrams.
diagrams.
"123", "Data type: Can be rolled back if Cannot be rolled back (partially
"John scored 123 Independent existence in Existence depends on the associated
"John", Integer, Date within a transaction. reversible in some databases).
marks in the test on the database. strong entity.
"2025-02- format: YYYY-
February 10, 2025." Fully logged in the transaction Minimal logging for better
10" MM-DD" "Dependent" (with attributes
"Student" (with log. efficiency.
Dependent_Name, Relationship)
Helps in decision- attributes Student_ID,
Collected for Helps organize, dependent on "Employee" Retains table structure, Retains table structure but resets
making by Name)
storage, interpret, and (Employee_ID) constraints, and indexes. identity columns (if present).
providing
processing, or manage the What are cardinality and participation constraints in an ER
meaningful
future analysis. primary data. model? Explain with examples. DELETE FROM Students WHERE TRUNCATE TABLE
insights.
Cardinality Constraints: Define the number of instances of one Age > 18; Students;
Unorganized and Organized, entity that can be associated with instances of another entity.
Descriptive Explain the purpose of the GROUP BY and HAVING clauses
often lacks contextual, and One-to-One (1:1): Each instance of an entity is related to only in SQL with examples.
and structural.
meaning. meaningful. one instance of another entity. GROUP BY Clause:Used to group rows that have the same
Example: A "Person" has one "Passport." values in specified columns and apply aggregate functions (like
Needs Used to One-to-Many (1:N): One instance of an entity is related to
Already SUM, COUNT, AVG, etc.) on each group.
processing to describe or multiple instances of another entity.
processed and Example:
gain manage Example: A "Teacher" teaches multiple "Students."
meaningful. SELECT Department, COUNT(*) AS Employee_Count
significance. data. Many-to-Many (M:N): Multiple instances of one entity are FROM Employees
Independent; does Derived Exists only related to multiple instances of another entity. GROUP BY Department;
not require from when there is Example: "Students" enroll in multiple "Courses," and each Explanation: Groups employees by department and counts the
information to processed associated "Course" has multiple "Students." number of employees in each department.
exist. data. data. HAVING Clause:Used to filter groups after aggregation based
Participation Constraints: Define whether all instances of an on aggregate function conditions.
Describe the three-schema architecture of a DBMS.
entity must participate in a relationship or if participation is Example:
The three-schema architecture is a framework for organizing
optional. SELECT Department, COUNT(*) AS Employee_Count
the structure of a database system. It separates database design
Total Participation: Every instance of the entity is involved in FROM Employees
into three levels to provide data abstraction and independence.
the relationship. Represented by a double line in ER diagrams. GROUP BY Department
External Schema (View Level):
Example: Every "Employee" must be assigned to a HAVING COUNT(*) > 5;
This level provides different user-specific views of the database.
"Department." Explanation: Groups employees by department and shows only
Ensures data security by restricting access to specific parts of the
Partial Participation: Some instances of the entity may not departments with more than 5 employees.
database.
participate in the relationship. Represented by a single line in ER What is normalization? Why is it important in database
Conceptual Schema (Logical Level):
diagrams. design?
It defines entities, relationships, constraints, and data types
Example: Not every "Customer" needs to place an "Order." Normalization is the process of organizing data in a database to
without focusing on physical storage details.
What is aggregation in the ER model? When is it used? minimize redundancy and dependency issues. It involves
Provides a unified view of the database, independent of physical
Aggregation is an abstraction in an ER model that treats a dividing large tables into smaller, related tables and defining
considerations.
relationship between entities as a single higher-level entity. It is relationships between them using primary and foreign keys.
Internal Schema (Physical Level):
represented by enclosing the relationship and related entities Importance of Normalization in Database Design:
Describes the physical storage of data in the database.
within a box. 1. Eliminates Data Redundancy: Reduces duplicate data,
Defines file structures, indexing, and storage paths.
Aggregation is used when: leading to efficient storage and easier updates.
Importance of the Three-Schema Architecture:
Relationships Depend on Other Relationships: 2. Ensures Data Integrity: Maintains consistency by
Data Abstraction: Allows users to interact with the database
When one relationship participates in another relationship, avoiding anomalies during insert, update, and delete
without knowing its internal complexities.
aggregation is necessary to represent this scenario. operations.
Data Independence: Changes in one schema do not affect other
Complex Relationship Modeling: 3. Improves Data Access Efficiency: Structured tables with
layers (logical and physical data independence).
When simple relationships between entities are insufficient to relationships make data retrieval more streamlined.
What are the key components of a DBMS? Explain each
capture the full semantics of the data, aggregation provides 4. Facilitates Maintenance: Smaller, organized tables are
briefly.
clarity. easier to maintain and modify when requirements change.
Storage Engine: Manages how data is stored and retrieved.
Avoid Redundant Entities: 5. Enhances Flexibility: Normalized databases can adapt
Query Processor: Interprets and executes SQL queries.
Aggregation helps reduce redundancy by representing complex better to future changes and extensions.
Transaction Manager: Ensures ACID properties of transactions.
relationships concisely.
Catalog Manager: Stores metadata about the database.
Define the relational model. Explain the concepts of tuples,
Concurrency Control Manager: Manages simultaneous access Explain 1NF, 2NF, and 3NF with examples.
attributes, and relations. The Relational Model is a data model
to data. First Normal Form (1NF) requires that all table columns store
that organizes data into tables (relations) consisting of rows and
User Interface:Provides interfaces for users to interact with the atomic values without multiple values in a single field. For
columns. Each table represents an entity or relationship, and
database. example, storing "Math, Physics" in one cell violates 1NF and
operations like insert, update, and query can be performed using
Discuss the roles of a Database Administrator (DBA). must be separated into multiple rows.
relational algebra or SQL.
DBA) is responsible for managing and maintaining an Second Normal Form (2NF) builds upon 1NF by removing
Concepts of the Relational Model:
organization's database systems to ensure their optimal partial dependencies, ensuring non-key attributes depend on the
Tuples (Rows): A tuple represents a single record in a relation
performance, security, and availability. The key roles of a DBA entire primary key. If "Student_Name" depends only on
(table).Each tuple contains values for all attributes in the relation.
include: "Student_ID" instead of "Student_ID + Course_ID," it
Example: In a "Student" table, a tuple could be (101, John Doe,
Installation and Configuration: Sets up the DBMS. violates 2NF and must be normalized into separate tables.
20, "BCA").
Backup and Recovery: Ensures data is backed up and can be Third Normal Form (3NF) eliminates transitive dependencies,
Attributes (Columns):An attribute is a property or characteristic
restored. where non-key attributes depend on other non-key attributes
of an entity, represented by a column in the relation.Each
Performance Tuning: Optimizes database performance. rather than the primary key. For instance, if
attribute has a specific data type (e.g., integer, text, date).
Security Management: Manages user access and permissions. "Instructor_Phone" depends on "Instructor" instead of the
Example: In a "Student" table, attributes could be "Student_ID,"
Schema Design: Designs and maintains the database structure. primary key, it must be moved to a separate table.
"Name," "Age," and "Course."
What is an Entity-Relationship Diagram (ERD)? Explain its By applying 1NF, 2NF, and 3NF, databases achieve better
Relations (Tables): A relation is a table that contains a set of
components with examples. consistency, reduced redundancy, and more efficient data
tuples and is defined by a schema specifying the attributes.
An Entity-Relationship Diagram (ERD) is a graphical management.
Relations must satisfy the properties of a relational database,
representation used to model the relationships between entities in What is Boyce-Codd Normal Form (BCNF)? How is it
such as unique rows and attribute ordering.
a database. It visually depicts the data structure, helping different from 3NF?
Example: A "Student" relation might store data as follows:
designers and developers understand the logical relationships BCNF is a higher form of database normalization used to
between data elements. Student_ID Name Age Course
eliminate redundancy and dependency anomalies.
Components of an ERD: BCNF ensures that all non-trivial functional dependencies are
Entity: Represents an object, person, place, or event in the 101 John Doe 20 BCA
based on super keys, leading to a more robust and consistent
database. 102 Jane Smith 21 BBA database design.
Example: "Student", "Course", "Department".
Difference between 3NF and BCNF: What is concurrency control? Why is it necessary in a Clustered Index Non-Clustered Index
Boyce-Codd Normal DBMS?
Third Normal Form (3NF) Concurrency control refers to the mechanisms and protocols used Data rows are stored in the Index is stored separately from
Form (BCNF) order of the index. the data rows.
to ensure that database transactions are executed in a way that
Allows non-super key dependencies preserves the integrity of the database while allowing multiple Only one clustered index per
All dependencies must be Multiple non-clustered indexes
if the dependent attribute is a prime transactions to run concurrently. The goal is to manage table, as data can be sorted
based on a super key. can be created on a table.
attribute. simultaneous operations on the database, preventing issues like only in one way.
May still have some dependency Completely removes data inconsistency or conflicts between transactions.
Best for range queries or Faster for searching specific
anomalies. dependency anomalies. Necessity:
queries that require sorting. columns in large tables.
1. Data Consistency: Prevents conflicts and ensures
Less strict than BCNF. More strict than 3NF. The index has pointers to data
accurate data. The index and data are
Satisfies 2NF and has no transitive 2. Isolation: Keeps transactions independent until rows, but the data is not organized
Satisfies 3NF and resolves physically organized together.
dependency unless involving a committed. in any specific order.
all dependency issues.
prime attribute. 3. Deadlock Prevention: Avoids situations where Ideal for primary key or Used for secondary columns or
Functional dependencies transactions are stuck waiting for each other. frequently sorted columns. non-sequential searches.
Not always required for functional 4. Performance: Allows multiple transactions to run
must involve super keys
dependencies. efficiently in parallel.
only. What is B-tree indexing? How does it improve search
5. Atomicity and Durability: Ensures changes are
May require additional committed only when valid, preserving transaction performance?
Easier to achieve from 2NF. A B-tree (Balanced Tree) is a self-balancing tree data structure
decomposition steps. properties.
What are functional dependencies? How do they help in used in DBMS for indexing. It maintains sorted data and allows
normalization? Explain the concepts of serializability and conflict efficient searching, insertion, and deletion operations. The B-tree
A functional dependency (FD) is a relationship where the value serializability. is structured in such a way that it keeps the data in a balanced
of one attribute (or set of attributes) uniquely determines the Serializability is the concept that ensures the correctness of manner, ensuring that the tree remains shallow, thus improving
value of another attribute. It is denoted asX→YX meaning if concurrent transactions. It is a property that guarantees that the the search performance.
two rows have the same value for X, they must have the same outcome of executing concurrent transactions is equivalent to How B-tree Improves Search Performance:
value for Y executing them serially, one after another, without overlap. In  Efficient Searching: Search time is logarithmic (O(log n)),
Example: other words, the final state of the database should be the same as reducing the time to find a value. The tree structure ensures quick
In a Student table, Student_ID→Name means Student_ID if the transactions were executed in some sequential order. navigation from root to leaf nodes.
uniquely determines the Name. Conflict serializability is a specific type of serializability. It  Balanced Structure: All leaf nodes are at the same level,
Role in Normalization: ensures that transactions can be reordered without changing the ensuring consistent search time. The balanced structure
Identify redundancies in tables. final outcome, as long as the order of conflicting operations minimizes the depth of the tree, reducing traversal steps.
Guide decomposition to avoid anomalies. (operations that access the same data item) is maintained. Two  Fewer Disk Reads: B-trees reduce disk I/O by storing
Help achieve normal forms (like 3NF and BCNF). operations conflict if they meet all of the following conditions: multiple keys in each node. Less data needs to be accessed,
Ensure data integrity by maintaining consistent attribute 1. They access the same data item. improving performance.
relationships. 2. At least one of the operations is a write.  Efficient Range Queries: Sorted data allows fast execution
What is a transaction in DBMS? Explain the ACID If the conflicting operations' order can be rearranged in such a of range queries. Leaf nodes can be sequentially traversed for
properties. way that the transactions' final effects are the same as if executed efficient range search.
A transaction in DBMS is a sequence of one or more database serially, then the schedule is conflict serializable. Explain the concept of hashing in file organization.
operations (like insert, update, delete, or read) executed as a Hashing is a technique used to efficiently organize and retrieve
single logical unit. Transactions ensure the database remains What are locks in DBMS? Differentiate between shared and data in a file system. It uses a hash function to map keys (data
consistent even in the presence of failures or concurrent access exclusive locks. values) to specific locations (buckets or slots) in a hash table.
by multiple users. Locks in DBMS are mechanisms used to control access to The goal is to allow quick access to data records by directly
Example: Transferring money from one bank account to another database resources (such as rows, tables, or columns) by calculating the location based on the key, rather than sequentially
involves deducting from one account and adding to the other, concurrent transactions. They ensure that transactions do not searching through the data.
which forms a single transaction. interfere with each other in a way that could cause data How Hashing Works:
ACID Properties: inconsistencies or corruption. By locking a resource, a Hash Function: Converts data keys into hash values (indexes) to
1. Atomicity: Ensures all operations in a transaction are transaction prevents other transactions from accessing it in determine where records are stored.
fully completed or rolled back. Prevents partial changes if conflicting ways, ensuring data integrity. Ensures quick access to data by calculating the location directly.
a failure occurs. Buckets (Slots): The hash table contains buckets where data
2. Consistency: Shared Lock (S Lock) Exclusive Lock (X Lock) records are stored. The hash function assigns records to these
Ensures database rules and constraints are maintained. buckets based on their key values.
Moves the database from one valid state to another. Allows multiple transactions Prevents other transactions Benefits:
3. Isolation: to read the resource. from reading or writing. Fast Data Access:
Concurrent transactions do not affect each other. Enables constant-time (O(1)) retrieval by directly calculating the
Multiple transactions can acquire Only one transaction can data's location.
Results are as if transactions were executed sequentially.
shared locks simultaneously. acquire an exclusive lock. Efficient Space Utilization:
4. Durability:
Committed changes are permanently stored. Organizes data efficiently and minimizes memory overhead with
Allows read access but not write Allows both read and write
Ensures recovery of changes even after system crashes. proper collision handling.
access. access.

Describe the states of a transaction with a diagram. Can coexist with other shared Conflicts with both Sequential File Organization Indexed File Organization
States of a Transaction: locks but conflicts with exclusive shared and exclusive
locks. locks. Data is accessed in a linear, Data is accessed using an index,
A transaction in a DBMS goes through several states during its
sequential manner. allowing faster lookup.
lifecycle. The states are as follows: Used when a transaction only Used when a transaction
1. New: needs to read data. needs to modify data. Not efficient for random access;
The transaction has been initiated but not yet started More efficient for searches
slow for searching specific
executing. as index allows direct access.
records.
2. Active: What is indexing in DBMS? Explain its types with examples.
The transaction is currently executing, performing Indexing in DBMS is a technique used to speed up the retrieval Insertion requires sorting and Insertions and updates are
database operations like insert, update, or delete. of rows from a database table. An index is a data structure that may require reorganizing the easier and faster due to
improves the performance of query operations by providing entire file. indexed structure.
3. Partially Committed:
The transaction has executed all its operations but has not quick access to data. It works similarly to an index in a book,
which allows fast navigation to the desired page. Requires less storage overhead, as no Requires additional
yet been committed to the database. The system is in the additional data structures are needed. storage for the index.
process of confirming the transaction. Types of Indexes:
4. Committed: 1. Single-Level Index: Suitable for read-only files or Suitable for files with frequent
The transaction has successfully completed, and all its  Simple index with all entries at one level. files with frequent sequential updates or searches on specific
changes have been permanently recorded in the database.  Improves performance for basic queries on a single access. records.
5. Failed: column.
2. Multi-Level Index: Slower for large datasets due Faster for large datasets with
The transaction cannot proceed due to some error or
 Contains multiple levels of indexes, each pointing to the need for sequential frequent search or update
failure. The transaction is no longer able to continue.
to the next. access. operations.
6. Aborted:
The transaction has been rolled back, and all changes  Enhances performance for large databases with
made during the transaction are undone. The system hierarchical query structures.
restores the database to its state before the transaction 3. Clustered Index:
began.  Data rows are stored in the order of the index.
 Only one clustered index is allowed per table, ideal
for range queries.
4. Non-Clustered Index:
 Index is stored separately from the data rows.
 Multiple non-clustered indexes can exist per table,
useful for specific column queries.

You might also like