DBMS CS2004 Spring Mid 2019 Solution
DBMS CS2004 Spring Mid 2019 Solution
A logical data model should be used as the blueprint for designing and
creating a physical database. But the physical database cannot be created
properly with a simple logical to physical mapping. Many physical design
decisions need to be made by the DBA before implementing physical
database structures.
JOIN is used to combine related tuples from two relations depending on join
condition. JOIN allows to evaluate a join condition between the attributes of
DBMS/CS-2004/B Tech (CSE, IT, CSCE, CSSE & ECS)/4Th Semester/ 2019
two relations on which the join is undertaken. The notation used is R JOINjoin
condition S, which is a subset of its cross product.
2. Describe the three-schema architecture. Why do we need mappings between 5
schema levels? Also, differentiate between logical data independence and
physical data independence.
Scheme: Three Schema Architecture- 2 marks, Mapping- 1 mark, Difference
between logical and physical data independence: 2 marks.
Three schema Architecture: This framework is used to describe the
structure of a specific database system. The three schema architecture is also
used to separate the user applications and physical database. The three
schema architecture contains three-levels. It breaks the database down into
three different categories.
The three-schema architecture is as follows:
Fundamental Operations
SELECT
PROJECT
UNION
SET DIFFERENCE
CARTESIAN PRODUCT
RENAME
Select and project operations are unary operation as they operate on a single
relation.Union, set difference, Cartesian product and rename operations are
binary operations as they operate on pairs of relations.
Other Operations
SET INTERSECTION
NATURAL JOIN
DIVISION
ASSIGNMENT
Examples
4. Draw the entity-relationship diagram for the hospital as given below: 5
The database maintains the details of doctors (identified by unique docid
along with docname, desgn and specialization) who are enrolled to
departments; one doctor can enrol to one department only. Employees
(identified by unique empid along with empname and mobno) are working in
the departments; one employee can work in a single department only. Each
department is identified through unique deptno along with deptname and
location. There is a registration process required for all patients to a
department before they treated by any doctor. Patient details must contain
DBMS/CS-2004/B Tech (CSE, IT, CSCE, CSSE & ECS)/4Th Semester/ 2019
unique pid, pname, address (can be decomposed to street, city and pin), age
and contactno. Employees are managing the patients. One patient can be
treated by multiple doctors; also one doctor can treat multiple patients.
Make necessary assumptions. Also, convert the E/R diagram into relational
schema.
Scheme: ER diagram 3 marks, relational Schema 2 marks.
deptname
docid deptno
docname
location
desgn
M 1
Doctor Enrol Department
spec
M 1 1
Treat Work
Register
M
contact N
M
M N
pid Patient Manage Employee
mobno
pname
address
pin
age empid empname
city
street
Relational Schema
ALGEBRA
th
th h h n t M ng hg
th ݄ t M ng hg t )
M ng nt ݄ th ݄ n݄ ǡ݄ t t 完ht h M ng hg
th h thM 晦䁡 M ng hg
SQL