Database Questions and Answers – Set Operations

This set of Database Multiple Choice Questions & Answers (MCQs) focuses on “Set Operations”.

1. The union operation is represented by
a) ∩
b) U
c) –
d) *
View Answer

Answer: b
Explanation: Union operator combines the relations.

2. The intersection operator is used to get the _____ tuples.
a) Different
b) Common
c) All
d) Repeating
View Answer

Answer: b
Explanation: Intersection operator ignores unique tuples and takes only common ones.

3. The union operation automatically __________ unlike the select clause.
a) Adds tuples
b) Eliminates unique tuples
c) Adds common tuples
d) Eliminates duplicate
View Answer

Answer: d
Explanation: None.
advertisement

4. If we want to retain all duplicates, we must write ________ in place of union.
a) Union all
b) Union some
c) Intersect all
d) Intersect some
View Answer

Answer: a
Explanation: Union all will combine all the tuples including duplicates.

5.

Free 30-Day C Certification Bootcamp is Live. Join Now!
(SELECT course id
FROM SECTION
WHERE semester = ’Fall’ AND YEAR= 2009)
EXCEPT
(SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010);

This query displays
a) Only tuples from second part
b) Only tuples from the first part which has the tuples from second part
c) Tuples from both the parts
d) Tuples from first part which do not have second part
View Answer

Answer: d
Explanation: Except keyword is used to ignore the values.

6. For like predicate which of the following is true.

i) % matches zero OF more characters.
ii) _ matches exactly one CHARACTER.

a) i-only
b) ii-only
c) i & ii
d) None of the mentioned
View Answer

Answer: c
Explanation: The % wildcard matches zero or more characters, while the _ wildcard matches exactly one character. Together, they offer flexibility and precision in pattern matching within the like predicate.
advertisement

7. The number of attributes in relation is called as its
a) Cardinality
b) Degree
c) Tuples
d) Entity
View Answer

Answer: b
Explanation: None.

8. _____ clause is an additional filter that is applied to the result.
a) Select
b) Group-by
c) Having
d) Order by
View Answer

Answer: c
Explanation: Having is used to provide additional aggregate filtration to the query.

9. _________ joins are SQL server default
a) Outer
b) Inner
c) Equi
d) None of the mentioned
View Answer

Answer: b
Explanation: It is optional to give the inner keyword with the join as it is default.

10. The _____________ is essentially used to search for patterns in target string.
a) Like Predicate
b) Null Predicate
c) In Predicate
d) Out Predicate
View Answer

Answer: a
Explanation: Like predicate matches the string in the given pattern.

Sanfoundry Global Education & Learning Series – Database Management System.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
I’m Manish - Founder and CTO at Sanfoundry. I’ve been working in tech for over 25 years, with deep focus on Linux kernel, SAN technologies, Advanced C, Full Stack and Scalable website designs.

You can connect with me on LinkedIn, watch my Youtube Masterclasses, or join my Telegram tech discussions.

If you’re in your 40s–60s and exploring new directions in your career, I also offer mentoring. Learn more here.