0% found this document useful (0 votes)
20 views6 pages

Batch 1 - Set A-Answer Key

The document describes a test for a database management systems course. It includes questions about database concepts like keys, relationships and SQL statements. It also provides details about converting an ER diagram to tables and writing queries.

Uploaded by

eswar.p210
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views6 pages

Batch 1 - Set A-Answer Key

The document describes a test for a database management systems course. It includes questions about database concepts like keys, relationships and SQL statements. It also provides details about converting an ER diagram to tables and writing queries.

Uploaded by

eswar.p210
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Register

Number

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY Batch 1 Set - A


SRM Nagar, Kattankulathur – 603203, Chengalpattu District, Tamil Nadu
College of Engineering and Technology
School of Computing
Academic Year: 2022-23 (Even)

Test : CLA-T2 Date : 12-04-2023


Course Code & Title : 18CSC303J – DATABASE MANAGEMENT SYSTEMS Duration : 8am to 9:40 am
Year & Sem : III Year / VI Sem Max Marks : 50
Instruction: MCQs to be collected within first 15 minutes

Course Articulation Matrix:


Course
S.No. PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
Outcome
1 CO2 H M L - - - - - - - - -

2 CO3 H M L - - - - - - - - -

3 CO4 H M L - - - - - - - - -

Part – A (10 x 1 = 10 Marks)


Instructions: 1) Answer ALL questions.
Q. No Question Marks BL CO PO PI Code
1 __ key is not generated from the table data.
A. super key B. surrogate key
C. null key D. candidate key 1 1 2 1 1.6.1

Answer: B
2 ______ is the standard SQL order of execution
A. from, where, group by, select, order by
B. from, where, select, order by, group by
C. group by, order by. from, where, select 1 2 2 1 1.6.1
D. select, from, where, order by, group by
Answer: A

3 If E1, E2,..., En are entity sets, then a relationship set R is a ______of


{(e1,e2,...,en) | e1 ∈ E1,e2 ∈ E2,...,en ∈ En} where (e1,e2,...,en) is a
relationship. 1 1 2 1 1.6.1
A. superset B. union C. subset D. intersection
Answer: C
4 _________ is a condition to manage the consistency as well integrity of the
values stored in an attribute.
A. Assertion B. Dependency C. Constraint D. Relationship 1 2 2 1 1.6.1

Answer: C
5 A ___ in a table represents a relationship among a set of values A. row
B. column
C. key D. entity 1 1 2 1 1.6.1

Answer: A
6 ________ returns the smallest integer value that is greater than or equal to a
number.
A.ceil() B. abs()
1 2 4 2 2.7.2
C.pos() D. floor()

Answer: A
7 Transaction Control Language (TCL) Commands are_____
A.Commit,Rollback,Savepoint B.grant,revoke C.Commit,revoke
D.revoke,rollback,savepoint 1 1 4 1 1.6.1

Answer : A
8 ______ Statement is used to remove a SAVEPOINT that you have created.
1 1 4 2 2.6.1
A.Remove Savepoint B.Delete Savepoint
C.Release Savepoint D.Drop Savepoint

Answer: C
9 _____ are automatically created by Oracle whenever an SQL statement is
executed
A.Stored Procedure B.VIEWS C.Implicit Cursors D.Explicit Cursors 1 2 4 2 2.6.1

Answer: C
10 _____ runs the query and display the required result.
A.Execution Engine B. Parser C.Optimizer D.Compiler
1 1 4 2 2.6.1
Answer: A
Register Batch 1 Set - A
Number

Part – B (4 x 4 = 16 Marks) Instructions: Answer ANY FOUR questions


Q. No Question Marks BL CO PO PI
Code
11 Compare strong and weak entity with an example. 4 3 2 2 2.7.2
Strong Entity:
A strong entity is not dependent on any other entity in the schema. A
strong entity will always have a primary key. Strong entities are
represented by a single rectangle. The relationship of two strong entities
is represented by a single diamond.
Weak Entity:
A weak entity is dependent on a strong entity to ensure its existence.
Unlike a strong entity, a weak entity does not have any primary key. It
instead has a partial discriminator key. A weak entity is represented by a
double rectangle.

12 Define entity set and relationship set 4 3 2 1 1.6.1


 An entity refers to any object having-
Either a physical existence such as a particular person, office, house or
car.
Conceptual existence such as a school, a university, a company or a job.

 A relationship set is a set of relationships of same type.


13 Create a view from the table Employee to display the names of employee 4 3 2 2 2.6.1
who are all coming from the city ‘Chennai’.

Create view view_name as select name from employee where city =


‘Chennai’.

14 You are appointed as a Project head and in need of granting database 4 3 4 2 2.6.1
privileges to a user. Write the SQL queries to
I. Grant the user system privilege to log into the “project” database
to give all permissions. (2marks)

GRANT ALL
ON PROJECT
TO OTHER_USER;

II. Revoke all privilges from the user.(2 marks)


REVOKE ALL PRIVILEGES FROM OTHER_USER;
15 Given below are the two tables, Table1(id,name) and Table2(id,city). 4 3 4 2 2.6.1
Table 1 Table 2

Write the query and result of cross


join and natural join operation.

cross join:

select *from t1 cross join t2;


Natural join:

select *from t1 natural join t2;

Part – C Answer all ( 2 x 12 = 24 Marks)


16 a. You are working as a database designer in an University project. The objective is to design 12 4 3 3 3.6.2
the schema to store student, instructor, department, course, building details.
i) Design the ER diagram with the entities and relationships (6 marks)
ii) Illustrate the keys, and mapping cardinalities.(6 marks)

(OR)
16 b Convert the ER diagram into tabular form using the standard rules and brief them. 12 4 3 3 3.6.2
 Rules specification-4 marks
 Conversion into tables- 6 marks

1. Patients(ss , namr, insurance, date-admitted, date-checked-out) [Simple


attributes]
2. Doctors (dss, name, specialization) [Simple attributes]
3. Test (test-id,ss, test-name, date, time, result) [For Binary Relationship With
Cardinality Constraint and Total Participation Constraint From One Side]
4. Dr-patient(ss, dss) [For Binary Relationship With Cardinality Ratio m:n]
5. Performed_by(test_id, dss) [For Binary Relationship With Cardinality Ratio m:n]

17 i.a Employee : (Emp_id, Empname,Dept, Salary) 12 4 4 3 3.6.2


ii. Department: (D_id,Dept_name,location)
iii. Each query 3 marks
I. Write a Query to display the employee name which includes the characters ‘dh’.
Select name from employee where name like ‘%dh%’.
II. Write a Query to Order the salary field in descending order for the employees who
are all working at location ‘Mumbai.
Select * from employees where location = ‘Mumbai’ order by salary desc.

III. Write a Query to Display the employees whose salary is more than the minimum
salary of the ‘IT’ department.
select * from employees where salary>(select min(salary) from employees
group by dept having(dept='IT'));
IV. Display employee details who are getting the Second highest Salary in the
Employee table?
SELECT name, MAX(salary) AS salary
FROM employee
WHERE salary IN
(SELECT salary FROM employee MINUS SELECT MAX(salary)
FROM employee);

Or

SELECT name, MAX(salary) AS salary


FROM employee
WHERE salary <> (SELECT MAX(salary)
FROM employee);

(OR)
17b I. Create a stored procedure in PL/SQL to display the old salary and new salary 12 4 4 3 3.6.2
when the salary gets updated in the Employee Table. (6 marks)
create or replace trigger salarychanges
before insert or update on employee
for each row
when (new.eno>0)
declare
sal_diff number;
begin
sal_diff:=:new.salary - :old.salary;
dbms_output.put_line(‘Old Salary = ‘|| :old.salary);
dbms_output.put_line(‘New Salary = ‘|| :new.salary);
dbms_output.put_line(‘Salary Difference = ‘|| sal_diff);
end;
/

II. Illustrate and explain the various steps in SQL query processing by Query
optimizer . (6 marks)

Basic Steps in Query Processing

1. Parsing and translation


2. Optimization
3. Evaluation
Course Outcome (CO) and Bloom’s level (BL) Coverage in Questions

You might also like