DBMS Module 1 Q&A
DBMS Module 1 Q&A
● Education System
● Industry
● Airlines
3 A student is having record in college library and Examination department. Then his CO K2
name, roll number, fathers name and class will be same in both the departments. 1
Also these departments are not dependent on each other. When he needs any change
for his name or class then he has to go to both the departments to make these
changes happen otherwise it will create problem for him.
State the Disadvantage in terms of File systems.
Answer:
Disadvantage is Data Redundancy. Because data is stored in two different files, that
means duplication. Since two files are independent on each other so it is very
difficult to overcome this error and if anyone finds this error then it will take time
and effort to solve this issue.
4 Give the levels of Data abstraction. CO K1
Answer: 1
There are mainly 3 levels of data abstraction:
● Physical: This is the lowest level of data abstraction. ...
● Logical: This level comprises of the information that is actually stored in the
database in the form of tables.
● View: This is the highest level of abstraction.
Pincod
e
Addres
s
9 When a user fills an online application, mistakenly the user entered phone number CO K2
with 9 digits. How the data integrity rule plays a major role here? 1
Answer:
The term data integrity refers to the accuracy and consistency of data. ... A good
database will enforce data integrity whenever possible. For example, a user could
accidentally try to enter a phone number into a date field. If the system enforces data
integrity, it will prevent the user from making these mistakes
10 The rules in the Fast track watch showroom are given below : CO K2
Rule 1 : Basic salary for all the salesman is 10000. 1
Rule 2 : Phone number should not be same for all salesman.
Write suitable constraint for the above rules.
Answer:
Rule 1 – Constraint – Default
Rule 2 – Constraint - Unique
11 The ____ connective tests for set membership, where the set is a collection of values CO K1
produced by a select clause. The ____ connective tests for the absence of set 1
TCS
membership. ION
Answer:
i) in
ii) Not in
12 Write the alternate query for the given query ? CO K2
SELECT name FROM instructor WHERE salary <= 100000 AND salary >= 2
90000;
Answer :
SELECT name FROM instructor WHERE salary BETWEEN 100000 AND
90000;
13 What are the various types of the attributes? CO K1
Answer: 1
● Single Valued Attribute
● Key attribute
● Derived attribute
● Composite attribute
14 State the difference between Single valued attribute and multi valued attributes. CO K1
Answer: 1
Single Valued attribute – can take only one value for an entity.
Multi Valued attribute - can take more than one specific value for each entity.
15 Write a command to view the Employee table structure CO K1
Answer: 1
DESC employee;
16 Consider the following ER-Diagram depicting a banking scenario and answer the CO K2
question below: 1
INFYT
Q
● Many to Many
17 Debug the given query if any error: CO K2
SELECT * FROM department WHERE increment = NULL; 2
Answer:
SELECT * FROM department WHERE increment IS NULL;
18 Enlist the various relationships of database. CO K2
Answer: 2
The various relationships of database are:
● One-to-one: Single table having drawn relationship with another table having
similar kind of columns.
● One-to-many: Two tables having primary and foreign key relation.
SQL Developer offers complete GUI based end-to-end development of your PL/SQL
applications, a worksheet for running queries and scripts, a DBA console for
managing the database, a reports interface, a complete data modeling solution, and a
migration platform for moving your 3rd party databases to Oracle.
20 Match the following : CO K1
a) SELECT - TCL 1
TCS
b) REVOKE - DDL
c) CREATE - DCL
d) UPDATE - DML
Answer:
a) SELECT - TCL(b)
b) REVOKE - DDL(c)
c) CREATE – DCL(d)
d) UPDATE - DML (a)
Answer:
i) ii)
Phone Country_Code
25 Create a report using SQL query to display the last name and job title of all CO K2
employees who do not have a manager. 2
Employee{fname,lname,email,jobid,salary,commission,mgr_id,dep_id }
Answer:
SELECT fname,lname,jobid
FROM employee
WHERE mgr_id IS NULL;
26 Consider the following ER-Diagram depicting employee management scenario and CO1 K2
INFYT
answer the question below: Q
What type of cardinality and notation depicts in the given ER-Diagram.
Answer:
Cardinality : One to One
Notation : Crow Foot Notation
27 A relation customer ( cid,cname,salary,commission ) retrieved with two queries: CO1 K2
Query 1: SELECT * FROM customer;
Query 2: DESC customer;
Does both query yields same output? Justify.
Answer:
Query 1 and query 2 are not same both will yield different output. Query 1 will give
the entire data from the table customer. But whereas query 2 will give only the
structure of the table which includes column name, data type and constraints.
28 Consider an application for Club membership. There are many clubs at different CO1 INFYT
K3
locations. A club can have many members. Each member belonging to a particular Q
club has a unique identity number. The member id can be same for different clubs.
The below relations are created.
● Club (ClubId, Name, Location)
iii) (6
e) Display the name of department number of the employee ‘SMITH’. )
Answer: (3 Marks)
SELECT dNumber
FROM employee
WHERE name=’SMITH’;
i) The Database Administrator takes Cell phone number as the primary key (6
for Student table. Is it possible or Not and Why? )
Answer:
No. Cellphone Number cannot be the primary key. Because the rule of
Primary key is should be unique and not null. Some students may not
have the cell phone number, possibly can have rollno in the student
database.
ii) Which key is suitable to map the course of a particular student from the
above two schemas? (6
Answer: )
The common column from the given two database is Course Id and can
easily identify or map which student can take which course. So Course
Id is the suitable foreign key in student database and course id is primary
key in course database.
iii)
i)Answer: Hierarchical model
● A type of database that organises the data into a tree-like structure.
● The data are stored as records which are connected to one another
through links.
● Data retrieval is difficult as whole tree needs to be traversed starting from (4
the root node. )
● This model is based on normalizing data in the rows and columns of the
(8
tables.
)
Relational model stored in fixed structures and manipulated using SQL.
7 Consider the following database schema to write queries in SQL (4 CO K2
Supplier (id, name, city) ) 2
Parts(pno, pname, pdescription)
Supply(id, pno, cost)
i)
a) Display the supplier name whose city consists of Coimbatore,chennai
and trichy.
Answer: (2 Marks)
SELECT name
FROM supplier
WHERE city IN(‘Coimbatore’, ‘chennai’, ‘trichy’);
b) Display the supplier id whose cost is not in the range of 12000 to
15000.
Answer: (2 Marks)
SELECT id
FROM supply
WHERE cost BETWEEN 12000 AND 15000;
ii) K2
c) Concatenate the part name and part description separated by * using (6 CO
alternate quote. ) 2
Answer: (3 Marks)
SELECT pname || q ‘[*]’ || pdescription
FROM Parts;
d) Find the part name whose pno is 110 or 119.
Answer: (3 Marks)
SELECT pname
FROM Parts
WHERE pno=110 OR pno=119;
iii)
e) Find the part name which doesn't have any part description. K2
Answer: (3 Marks)
SELECT pname (6 CO
FROM Parts ) 2
WHERE pdescription IS NULL;
f) Display the supplier name whose city is not Chennai and Trichy.
Answer: (3 Marks)
SELECT name
FROM supplier
WHERE city NOT IN(‘Chennai’,’Trichy’);
b) Display the names and ages of sailors with a rating between 7 to 10.
Answer : ( 2Marks)
SELECT sname,age
FROM sailors
WHERE rating BETWEEN 7 AND 10;
ii) K2
c) Select the Boat id where the boat colour is red. (6 CO
Answer : ( 3Marks) ) 2
SELECT bid
FROM boats
WHERE color=’red’;
iii) K2
e) Display the name of sailors whose age is above 20.
Answer : ( 3Marks) (6 CO
SELECT sname ) 2
FROM sailors
WHERE age>20;
f) Display the boat names where colour is not black, brown and Blue.
Answer : ( 3Marks)
SELECT bname
FROM boats
WHERE color NOT IN(‘black’,’brown’,’Blue’);
Hierarchical model:
Object oriented data model is based upon real world situations. These situations
are represented as objects, with different attributes. All these object have
multiple relationships between them.
Elements of Object oriented data model
Objects
The real world entities and situations are represented as objects in the Object
oriented database model.
Attributes and Method
Every object has certain characteristics. These are represented using Attributes.
The behaviour of the objects is represented using Methods.
Class
Similar attributes and methods are grouped together using a class. An object can
be called as an instance of the class.
Inheritance
A new class can be derived from the original class. The derived class contains
attributes and methods of the original class as well as its own.
Answer :
15 Assume in a university 1 CO K3
i)(5 Marks) 6 1
● There are multiple libraries and each library has multiple student
members
● Students can become members to multiple libraries by paying
appropriate membership fee.
ii) (5 Marks)
● Each library has its own set of books. Within the library these books are
identified by a unique number
● Students can borrow multiple books from subscribed library
iii) (6 Marks)
● Students can order books using inter-library loan. This can be useful if a
student wishes to borrow books from a library where s/he is not a
member. The
● student orders the books through a library where s/he is a member
Draw the ER model for the university database system and transform it into
physical database design.