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

DBMS

The document provides a comprehensive overview of Database Management Systems (DBMS), including definitions, applications, and advantages over file processing systems. It covers key concepts such as data models, normalization, keys, functional dependencies, and transaction properties (ACID). Additionally, it discusses ER diagrams, SQL commands, and issues related to concurrency control in databases.

Uploaded by

sipeji8490
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

DBMS

The document provides a comprehensive overview of Database Management Systems (DBMS), including definitions, applications, and advantages over file processing systems. It covers key concepts such as data models, normalization, keys, functional dependencies, and transaction properties (ACID). Additionally, it discusses ER diagrams, SQL commands, and issues related to concurrency control in databases.

Uploaded by

sipeji8490
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

1|Page

Section A

1. Define Database Management System.

A Database Management System (DBMS) is software that allows


users to create, retrieve, update, and manage data in a database. It serves
as an interface between the database and the end-users or application
programs, ensuring data is organized and easily accessible.

Example: MySQL, PostgreSQL, Oracle Database.

2. List any five applications of DBMS.

1. Banking: For account management, transaction processing, and


online banking.
2. Healthcare: Managing patient records and hospital information
systems.
3. Education: Maintaining student records, course management, and
attendance systems.
4. Retail: Inventory management and online shopping platforms.
5. Social Media: User account management and content delivery.

3. What are the disadvantages of the file processing system?


2|Page

1. Data Redundancy: Duplicate data storage leads to


inconsistencies.
2. Lack of Data Integrity: Inconsistent data can compromise system
reliability.
3. Poor Security: Difficult to implement robust security mechanisms.
4. Limited Data Sharing: Not easily shareable across systems.
5. Difficulty in Accessing Data: Complex to retrieve data from files.

4. Define Data Model.

A Data Model is an abstract framework for organizing and defining the


structure of a database, including its constraints and relationships.

Example: Entity-Relationship Model, Relational Model.

5. What are attributes? Give an example.

Attributes are properties or characteristics of an entity in a database.

Example:
Entity: Student
Attributes: Student_ID, Name, Date_of_Birth, Address.
3|Page

Section B

6. Compare generalization and specialization with examples.

Aspect Generalization Specialization


Combining multiple entities Creating sub-entities from a
Definition
into a single generalized entity. higher-level entity.
Adding detail or specific
Purpose Reducing redundancy.
attributes.
Entities: Car, Bike → Entity: Employee → Sub-
Example
Generalized Entity: Vehicle entities: Manager, Clerk.

Diagram:

7. Explain primary key, super key, and foreign key.

 Primary Key: A unique identifier for a record in a table.


Example: In a Student table, Student_ID is a primary key.
 Super Key: A set of one or more attributes that can uniquely
identify a record.
Example: {Student_ID, Email}.
 Foreign Key: An attribute in one table that refers to the primary
key of another table.
4|Page

Example: In an Enrollment table, Student_ID is a foreign key


referencing the Student table.

8. What is normalization?

Normalization is a process of organizing data in a database to reduce


redundancy and improve data integrity.

Steps:

1. 1NF: Eliminate repeating groups.


2. 2NF: Remove partial dependency.
3. 3NF: Eliminate transitive dependency.

Section C

9. Draw an ER diagram for a small marketing company database.

Requirements:

 Employees with details like Name, Employee_ID, and Department.


 Products with attributes like Product_ID and Price.
 Customers with Customer_ID and Name.
 Orders connecting Customers and Products.
5|Page

Diagram:

10. Describe the classification of database languages. Which type of


language is SQL?

1. Data Definition Language (DDL): Defines the structure of the


database.
Example: CREATE, ALTER, DROP.
2. Data Manipulation Language (DML): Manipulates data in the
database.
Example: INSERT, UPDATE, DELETE.
6|Page

3. Data Query Language (DQL): Queries data from the database.


Example: SELECT.
4. Data Control Language (DCL): Manages access permissions.
Example: GRANT, REVOKE.

SQL is a combination of DDL, DML, and DQL.

11. Explain the following:

1. DDL Commands:

Used for defining database schemas.

 CREATE: Creates a new table.


 ALTER: Modifies an existing table.
 DROP: Deletes a table.

2. DML Commands:

Used for data manipulation.

 INSERT: Adds new records.


 UPDATE: Modifies existing records.
 DELETE: Removes records.
7|Page

12. Explain data independence with its types.

Data Independence: The ability to change the schema at one level


without affecting the schema at another level.

 Logical Independence: Changes in the logical schema do not


affect the application.
 Physical Independence: Changes in the physical schema do not
affect the logical schema.

Who are Data Administrators?

They are professionals responsible for database management and


security.

Functions:

1. Database design and implementation.


2. Backup and recovery management.
3. Ensuring data security.
4. Performance tuning.
8|Page

Section A

1. What is functional dependency? Explain it briefly.

Functional Dependency describes the relationship between attributes in


a relation, where one attribute uniquely determines another attribute.

Example:
If A→BA \to BA→B, then the value of AAA uniquely determines BBB.
In a Student table, Roll_No→NameRoll\_No \to
NameRoll_No→Name, meaning the roll number uniquely identifies the
student's name.

2. What is a transaction? Explain it.

A transaction is a sequence of database operations that performs a


single logical unit of work.
Properties of Transactions (ACID):

1. Atomicity: All operations complete, or none do.


2. Consistency: The database remains consistent after the transaction.
9|Page

3. Isolation: Transactions do not interfere with each other.


4. Durability: Changes persist even after a system failure.

Example: Transferring money from one account to another.

3. Define primary key, NOT NULL key, and unique key.

 Primary Key: Uniquely identifies each row in a table. Cannot be NULL.


Example: Employee_IDEmployee\_IDEmployee_ID in an Employee table.
 NOT NULL Key: Ensures a column cannot have NULL values.
Example: Name column cannot be NULL in the Customer table.
 Unique Key: Ensures that all values in a column are unique. Allows one
NULL value.
Example: Email in a User table.

4. Explain hashing in brief.

Hashing is a technique to convert a key into a unique hash value using a


hash function, which is then used to locate the data in a hash table.

Example:
A hash function H(k)=kmod 10H(k) = k \mod 10H(k)=kmod10 maps
keys to a table of size 10.
10 | P a g e

5. Explain the advantages of DBMS over file-oriented systems.

1. Data Integrity: Ensures consistency and correctness.


2. Data Security: Provides controlled access to data.
3. Data Redundancy: Reduces duplicate data.
4. Concurrent Access: Supports multi-user environments.
5. Backup and Recovery: Automates data backup and restoration.

Section B

6. Explain specialization and generalization concepts in ER


diagrams with suitable examples.

Aspect Generalization Specialization

Combining multiple entities into a Creating sub-entities from a


Definition
single generalized entity. higher-level entity.

Adding detail or specific


Purpose Reducing redundancy.
attributes.

Entities: Car, Bike → Generalized Entity: Employee → Sub-


Example
Entity: Vehicle entities: Manager, Clerk.

Diagram:
11 | P a g e

7. Why should normalization be performed on a table, and what are


its benefits? Explain 3NF.

Normalization organizes data to minimize redundancy and dependency.

Benefits:

1. Reduces data redundancy.


12 | P a g e

2. Enhances data integrity.


3. Simplifies database maintenance.

3NF (Third Normal Form): A table is in 3NF if:

1. It is in 2NF.
2. It has no transitive dependency.

Example:

Student_ID Course_ID Instructor_Name

101 CSE101 Dr. Smith

102 CSE102 Dr. Brown

Here, Instructor_Name depends transitively on Course_ID.

8. What are the pitfalls of lock-based protocols?

1. Deadlock: Circular wait among transactions.


2. Starvation: Some transactions may never get access to resources.
3. Overhead: Managing locks increases processing time.
4. Concurrency Issues: May reduce system performance due to high lock
contention.
13 | P a g e

Section C

9. Write SQL queries for the given tables:

Given Tables:

1. Employee (ENO, NAME, DOB, ADDRESS (CITY), SALARY, GENDER,


DNUMBER)
2. Dept (DNUMBER, DNAME, MEMPNO, M-START DATE)

SQL Queries:

1. Display the age of 'male' employees.

sql
Copy code
SELECT NAME, YEAR(CURDATE()) - YEAR(DOB) AS AGE
FROM Employee
WHERE GENDER = 'male';

2. Display the name of the highest salary paid 'female' employee.

sql
Copy code
SELECT NAME
FROM Employee
WHERE GENDER = 'female'
ORDER BY SALARY DESC
LIMIT 1;

3. Display the name of the department of employee 'xyz'.


14 | P a g e

sql
Copy code
SELECT DNAME
FROM Dept
WHERE DNUMBER = (SELECT DNUMBER FROM Employee WHERE NAME =
'xyz');

4. Display all employees belonging to the same address (city).

sql
Copy code
SELECT *
FROM Employee
GROUP BY ADDRESS(CITY)
HAVING COUNT(*) > 1;

5. Which employee is the oldest manager in the company?

sql
Copy code
SELECT NAME, MIN(DOB)
FROM Employee
WHERE ENO IN (SELECT MEMPNO FROM Dept);

10.1 Why is concurrency control needed? Explain it.

Concurrency control ensures multiple transactions occur without


conflicts, preserving ACID properties.
15 | P a g e

10.2 Describe different methods of indexing.

1. Single-Level Index: Maps key values to data blocks.


2. Multi-Level Index: Index of indexes for large datasets.
3. Clustered Index: Orders table rows by key values.
4. Hash Index: Uses hash functions for fast access.

11. Define ER Diagram. Draw an ER diagram for a library


management system.

ER Diagram: A diagram representing entities, attributes, and


relationships in a database.

Library System ER Diagram:

Entities:

 Books (ISBN, Title, Author)


 Members (Member_ID, Name, Address)
 Transactions (Issue_Date, Return_Date)

Diagram:
16 | P a g e

12. Explain the three-level architecture of DBMS.

1. External Level: User's view of the data.


2. Conceptual Level: Logical structure of the database.
3. Internal Level: Physical storage of data.

Diagram:
17 | P a g e
18 | P a g e

Section A

1. What are the advantages of file processing systems that are


removed by DBMS?

1. Data Redundancy and Inconsistency: DBMS minimizes duplication by


centralizing data.
2. Difficulty in Data Access: DBMS provides structured query languages for
easier data retrieval.
3. Data Isolation: DBMS integrates data for efficient access.
4. Security: File systems lack advanced access controls; DBMS ensures data
security.
5. Backup and Recovery: DBMS automates backups, unlike file systems.

2. Give examples of a simple and composite attribute of an entity.

 Simple Attribute: Cannot be divided further.


Example: Employee_NameEmployee\_NameEmployee_Name in an
Employee entity.
 Composite Attribute: Can be divided into smaller parts.
Example: Full_AddressFull\_AddressFull_Address → Street,City,StateStreet,
City, StateStreet,City,State.

3. What do you mean by referential integrity?


19 | P a g e

Referential Integrity ensures that foreign key values in a table


correspond to primary key values in the related table.

Example:
If DNUMBERDNUMBERDNUMBER in the Employee table
references DNUMBERDNUMBERDNUMBER in the Department
table, any value in Employee.DNUMBER must exist in
Department.DNUMBER.

4. What do you mean by DML and DDL?

 DML (Data Manipulation Language): Manages data in a database.


Examples: INSERT, UPDATE, DELETE.
 DDL (Data Definition Language): Defines and manages database schema.
Examples: CREATE, ALTER, DROP.

5. What are anomalies in 1NF?

Anomalies in 1NF arise when a table is not properly normalized:

1. Insertion Anomaly: Cannot add data without redundant information.


2. Deletion Anomaly: Deleting data unintentionally removes critical
information.
3. Update Anomaly: Changing data in one place requires updates everywhere.
20 | P a g e

Section B

6. What do you mean by a key to a relation? Explain the difference


between super key, candidate key, and primary key.

 Key: An attribute or set of attributes that uniquely identifies a row in a


relation.

Type Definition Example

A set of attributes that uniquely {Student_ID}, {Student_ID,


Super Key
identifies a row. Name}.

Candidate Minimal super key; no subset can


{Student_ID}.
Key uniquely identify a row.

Primary Key A candidate key chosen as the main key. {Student_ID}.

7. Define functional dependency. What do you mean by lossless


decomposition?

 Functional Dependency: Describes a relationship where one


attribute uniquely determines another.
Example: Roll_No→NameRoll\_No \to NameRoll_No→Name.
21 | P a g e

 Lossless Decomposition: Ensures decomposing a relation does not


lose data when joined.

Example:
If Relation RRR is split into R1R1R1 and R2R2R2, joining R1R1R1 and
R2R2R2 must yield RRR.

8. Define normal forms. List the definitions of first, second, and


third normal forms.

 Normal Forms: Guidelines to reduce redundancy and improve data


integrity.

1. 1NF: No repeating groups or arrays.


2. 2NF: In 1NF and no partial dependency.
3. 3NF: In 2NF and no transitive dependency.

Section C

9. What is a transaction? Draw a state diagram of a transaction


showing its states.

A transaction is a sequence of operations representing a single logical


task.
22 | P a g e

Transaction States:

1. Active: Transaction is executing.


2. Partially Committed: Final operation executed.
3. Committed: Changes are permanent.
4. Failed: Transaction aborted due to an error.
5. Aborted: Rolled back to the previous state.

Diagram:

10. Explain ACID properties of a transaction with suitable


examples.
23 | P a g e

1. Atomicity: All operations succeed or fail together.


Example: Fund transfer between two accounts.
2. Consistency: Database remains consistent after a transaction.
Example: Balance in both accounts remains correct post-transfer.
3. Isolation: Concurrent transactions do not interfere.
Example: Two users accessing the same database simultaneously.
4. Durability: Changes persist despite system crashes.
Example: Record updates remain after power loss.

11. What are schedules? What are the differences between conflict
serializability and view serializability?

 Schedules: The order in which transactions are executed.

Aspect Conflict Serializability View Serializability

No conflicting operations Equivalent result as serial


Definition
between transactions. execution.

Conflict Does not consider conflicts


Considers read/write conflicts.
Consideration directly.

Performance Easier to determine. Harder to determine.

12. What are distributed databases?


24 | P a g e

A Distributed Database is a collection of interconnected databases


spread across different locations, appearing as a single system to users.

Advantages:

1. Reliability and availability.


2. Faster data access.
3. Scalability.

Example: Banking systems with databases in multiple branches.

13. Describe the major problems associated with concurrent


processing with examples.

1. Lost Updates: Two transactions overwrite each other's changes.


Example: Concurrently updating the same account balance.
2. Dirty Reads: Transaction reads uncommitted data.
Example: Reading data from a failed transaction.
3. Non-Repeatable Reads: Data changes between two reads of the same
transaction.
Example: Stock quantity changing during order placement.
4. Phantom Reads: New data added during a transaction.
Example: Counting rows while new rows are added.

You might also like