0% found this document useful (0 votes)
9 views8 pages

Questions Set - 2

The document contains 15 multiple choice questions about SQL and database normalization. The questions cover topics like functional dependencies, candidate keys, joins, and aggregations.

Uploaded by

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

Questions Set - 2

The document contains 15 multiple choice questions about SQL and database normalization. The questions cover topics like functional dependencies, candidate keys, joins, and aggregations.

Uploaded by

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

1.

2.
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

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

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}
d- Productid

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 13:

Which functional dependency types is/are present in the following dependencies?


Empid -> EName, Salary, DeptNo, DName,Dlocation
DeptNo -> DName

A Full functional dependency & Partial functional dependency


B Full functional dependency & Transitive functional dependency
C Partial functional dependency & Transitive functional dependency
D Only Transitive functional dependency

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
a b c d
1 1 1 1
a b c d
2 2 2 1
a b c d
3 3 3 2
a b c d
4 3 3 3
a b c d
5 1 4 4

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,
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