Solution DS2201 - Database Systems MTE Paper March 2024
Solution DS2201 - Database Systems MTE Paper March 2024
Solution DS2201 - Database Systems MTE Paper March 2024
Enrolment No:
Customer Order
C_id C_Name
1 John O_id Amount C_id
2 Robert
1 200 10
3 David
2 500 3
4 John
5 Betty 3 300 6
Q B4 4 800 5 4 DS2201.3
5 150 8
Perform the following operations on both tables and show the result table for each,
1. Union
2. Full outer Join
3. Left outer Join
4. Right outer Join
SECTION C
Write SQL or Relational algebra statements for following:
Student ( Enrno, name, courseId, emailId, cellno)
Course (courseId, course_nm, duration)
i) Add a column city in student table. DS2201.2
Q C1 ii) Find out list of students who have enrolled in “computer” course. 8 ,
iii) List name of all courses with their duration. DS2201.3
iv) List name of all students start with „a‟.
v) List email Id and cell no of all mechanical engineering students.
Q A1 How Atomicity problems affect DBMS?
Solution: A computer system, like any other mechanical or electrical device, is subject to failure. In many
applications, it is crucial that, if a failure occurs, the data be restored to the consistent state that existed prior to
the failure. Consider a program to transfer $50 from account A to account B. If a system failure occurs during the
execution of the program, it is possible that the $50 was removed from account A but was not credited to account
B, resulting in an inconsistent database state. Clearly, it is essential to database consistency that either both the
credit and debit occur, or that neither occur. That is, the funds transfer must be atomic—it must happen in its
entirety or not at all. It is difficult to ensure atomicity in a conventional file-processing system.
Q A2 Define weak entity set in entity relationship model with example.
Solution: In an Entity-Relationship (ER) model, a weak entity set is an entity set that cannot be uniquely identified
by its attributes alone. Instead, it relies on a relationship with another entity set, known as the identifying or owner
entity set, to establish its identity.
Consider a database model for a library system. We have two entity sets: Book and Copy.
• Book represents a type of book and has attributes such as ISBN, Title, and Author.
• Copy represents individual physical copies of books in the library and has attributes like Copy_ID and
Status.
In this scenario, Copy is a weak entity set because it cannot be uniquely identified by its attributes alone; multiple
copies of the same book may exist, and their identity depends on the relationship with the Book entity set.
Q A3 Distinguish between an entity, an entity type, and an entity set.
Solution:
1. Entity:
• An entity is a real-world object or concept with a distinct and independent existence, which can be
uniquely identified.
• Entities typically correspond to nouns in the problem domain.
• Examples of entities include a person, a book, a customer, or an employee.
2. Entity Type:
• An entity type represents a category or class of similar entities. It defines a set of entities that have
the same attributes or properties.
• Entity type specifies the common characteristics shared by all entities belonging to that category.
• It serves as a template for creating individual entity instances.
• For example, "Student" can be an entity type that encompasses all individual students, each having
attributes like name, student ID, and address.
3. Entity Set:
• An entity set is a collection of similar entities of a particular entity type that exists at a specific
point in time.
• It is a set of instances of the same entity type.
• Entity sets are the actual instances or occurrences of entities in the database.
• For instance, if "Student" is an entity type, then the set of all students currently enrolled in a
university database would be an entity set.
Q B1 Explain the five responsibilities of a DBA with example.
Solution: The responsibilities of a DBA include:
• Schema definition. The DBA creates the original database schema by executing a set of data definition
statements in the DDL.
• Storage structure and access-method definition.
• Schema and physical-organization modification. The DBA carries out changes to the schema and physical
organization to reflect the changing needs of the organization, or to alter the physical organization to improve
performance.
• Granting of authorization for data access. By granting different types of authorization, the database administrator
can regulate which parts of the database various users can access. The authorization information is kept in a
special system structure that the database system consults whenever someone attempts to access the data in the
system.
• Routine maintenance. Examples of the database administrator’s routine maintenance activities are:
Q B2 Suppose you have a database containing employee information, including employee ID, name,
department, and salary. Explain how physical data independence might apply in this scenario.
Solution: Physical data independence refers to the ability to modify the physical storage structures or access
methods of a database system without affecting the conceptual or external schema. In the scenario of a database
containing employee information, including employee ID, name, department, and salary, physical data
independence might apply in the following ways:
1. Storage Structures: The database administrator might decide to change the underlying storage structures,
such as converting from a row-based storage format to a columnar storage format. With physical data
independence, this change can be implemented without requiring modifications to the logical or
conceptual schema. Applications and users interacting with the database will remain unaffected by this
change.
2. Indexing and Access Methods: The database administrator might optimize the database by implementing
different indexing or access methods to improve query performance. For example, they may choose to
create additional indexes on frequently queried columns like "employee ID" or "department". With
physical data independence, these changes can be made transparently without impacting the way users
interact with the database at the logical level.
3. Data Partitioning: In a large-scale database, the administrator may decide to partition the data across
multiple storage devices or servers for scalability and performance reasons. This partitioning can be
achieved without changes to the external schema, ensuring that applications continue to function
seamlessly without knowledge of the underlying physical implementation.
4. Replication and Backup: Physical data independence also allows for the implementation of data
replication and backup strategies. For instance, the administrator might choose to replicate certain tables
or databases for fault tolerance or create backups using different technologies or storage mediums. These
actions can be performed without affecting the logical or external views of the data.
Q B3 Draw ER diagram for university database consisting of four entities Student, Department, Class, and
Faculty. Student has a unique id; the student can enroll for multiple classes. Faculty must belong to a department
and faculty can teach multiple classes. Each class is taught by only faculty. Every student will get a grade for the
class he/she has enrolled in.
Solution: Follow the steps given below to draw an Entity Relationship (ER) diagram for a University database
application −
The relationship between instructor and student is not defined because of the following reasons −
There is no significance in the relationship.
We can always derive this relationship indirectly through course and instructors, and course and student.
Q B4 Consider the following two tables Customer and Order given below.
3 David 3 300 6
4 800 5
4 John
5 150 8
5 Betty
Perform the following operations on both tables and show the result table for each,
1. Union
2. Full outer Join
3. Left outer Join
4. Right outer Join
Solution: 1. Union of Customer and Order is not possible because they are not Union Compatible i.e for a union
operation r ∪ s to be valid, we require that two conditions hold:
a. The relations r and s must be of the same arity. That is, they must have the same number of attributes.
b. The domains of the ith attribute of r and the ith attribute of s must be the same, for all i.
2. Full outer Join
The full outer join does both of those operations, padding tuples from the left relation that did not match any from
the right relation, as well as tuples from the right relation that did not match any from the left relation, and adding
them to the result of the join.
C_id C_Name O_id Amount
3 David 2 500
5 Betty 4 800
1 John Null Null
2 Robert Null Null
4 John Null Null
10 Null 1 200
6 Null 3 300
8 Null 5 150