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

Quiz 2

The document contains a series of SQL-related questions and answers, focusing on queries, candidate keys, and normalization forms. It includes multiple-choice questions regarding SQL queries on employee and department tables, functional dependencies, and relational schemas. The answers to the questions are also provided, indicating the correct options for each query.

Uploaded by

muskanshukla343
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)
33 views6 pages

Quiz 2

The document contains a series of SQL-related questions and answers, focusing on queries, candidate keys, and normalization forms. It includes multiple-choice questions regarding SQL queries on employee and department tables, functional dependencies, and relational schemas. The answers to the questions are also provided, indicating the correct options for each query.

Uploaded by

muskanshukla343
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

1.

How many rows will be fetched when the above query is executed?
a) 6
b) 3
c) 5
d) 7

3. Consider the tables EMP and DEPARTMENT:

SELECT * FROM emp e INNER JOIN dept d ON e.deptno = d.deptno WHERE hiredate between
'04/01/1981' AND '04/01/1982' AND LENGTH(JOB)<8;
How many employees’ data will be displayed in output on execution of above query?
a) 2
b) 6
c) 8
d) 9
Answer: B

4. Find the SQL statements below that is equal to the following for the types of product may be –
Goods, Services, Experiences, Convenience, Shopping, Specialty Goods, Industrial Goods and
Consumer Goods.
SELECT city FROM salesman WHERE product = 'Services' OR product = 'Specialty Goods';

Q1. SELECT city FROM salesman WHERE product IN ('Services', 'Specialty Goods');
Q2. SELECT city FROM salesman WHERE product LIKE 'S%s';
Q3. SELECT city FROM salesman WHERE product LIKE 'S%' AND product LIKE '%s';
Q4. SELECT city FROM salesman WHERE product LIKE 'S%' OR product LIKE '%s';

a) Q1 only
b) Q1 and Q2
c) Q1, Q2 and Q3
d) All

5. Find out the candidate key(s) and the highest normal form in the given relation:
trainee (traineeid, traineename, classroomid, pcid)

Consider the following functional dependencies:


traineeid -> traineename
{classroomid, pcid} -> traineename
traineeid -> classroomid, pcid
{classroomid, pcid} -> traineename

a) traineeid, 2NF
b) {classroomid, pcid}, 3 NF
c) traineeid, {classroomid, pcid}, 2NF
d) traineeid, {classroomid, pcid}, 3NF

6.
a) 2
b) 1
c) 3
d) 4

7. Consider the tables EMP and DEPARTMENT:

SELECT EMPNO, ENAME FROM EMP WHERE DEPTNO NOT IN (SELECT DEPTNO FROM DEPT WHERE LOC
NOT IN (SELECT MAX(LOC) FROM DEPT)) ORDER BY ENAME DESC;
Which employee name will be present at the third location from top after execution of above query?
a) KING
b) CLARK
c) MILLER
d) SMITH

Answer: B

8. Consider the given relation R( X, Y, Z, W, P) and the set of Functional Dependencies


FD = { X → Y, Y → P, and Z → W}. To convert the given relation R in 3NF, it has to decompose into how
many tables.

a) 3
b) 4
c) 5
d) 6

9.

Which is the best primary key for the sales table from following?
a- Desc
b- Store_id
c- {productid,store_id}

10. Table employee has 10 records. It has a non-NULL SALARY column which is also UNIQUE.
The SQL statement
SELECT COUNT(*) FROM employee WHERE SALARY > ALL (SELECT SALARY FROM EMPLOYEE);
prints
A. 10
B. 9
C. 5
D. 0

Qn 11: For the given data find the candidate keys.

A B C D
A1 B1 C1 D1
A1 B2 C2 D2
A2 B3 C2 D3

A2

B3

C4

D0

Qn 12: Consider the following relational schema along with functional dependencies:
ProductDetails (ProdId, ProdName, Color, Cost, CategoryId, CategoryName)
ProdId -> ProdName;
{ProdId, Color} -> Cost;
ProdId -> CategoryId;
CategoryId -> CategoryName
What would be the total number of relational schema/s after converting to 3NF?

A1

B2

C3

D4

Qn 14: Find the suitable option to identify number of candidate keys can be form in the given below
Table.

T
A B C D
a1 b1 c1 d1
a2 b2 c2 d1
a3 b3 c3 d2
a4 b3 c3 d3
a5 b1 c4 d4
A, BD, CD
a) 1
b) 3
c) 4
d) 2

Qn 15 : A relation R(A, B, C, D, E, F, G, H)and set of functional dependencies are


CH → G,
A → BC,
DA, DE, DB, DF
B → CFH,
E → A,
F → EG
Then how many possible candidate keys are present ?
a) 4
b) 3
c) 2
d) 1

You might also like