ADVERTISEMENT
ADVERTISEMENT

MCQ | SQL – Sub Queries, Views Clause

SQL Sub Queries, Views Clause MCQ: This section contains the Multiple-Choice Questions & Answers on SQL Sub Queries, Views Clause.
Submitted by Anushree Goswami, on October 28, 2021

1. A Sub query is an SQL expression that is placed ________ another SQL statement.

  1. Before
  2. After
  3. Inside
  4. Outside

Answer: C) Inside

Explanation:

A Sub query is an SQL expression that is placed inside another SQL statement.


2. With which of the following statement(s) can the SQL sub queries be used?

  1. SELECT
  2. UPDATE
  3. INSERT
  4. All of the above

Answer: D) All of the above

Explanation:

SQL sub queries can be used with SELECT, UPDATE, INSERT and DELETE statements.


3. Whenever a sub query appears in SQL, it is enclosed within ___________ and placed to the _____ of the SQL operators.

  1. Brackets, Left
  2. Brackets, Right
  3. Parenthesis, Left
  4. Parenthesis, Right

Answer: D) Parenthesis, Right

Explanation:

Whenever a sub query appears in SQL, it is enclosed within parenthesis and placed to the right of the SQL operators.


4. Which of the following clause cannot be used in SQL sub queries?

  1. GROUP BY
  2. ORDER BY
  3. DELETE
  4. FROM

Answer: B) ORDER BY

Explanation:

ORDER BY clause cannot be used in SQL sub queries.


5. In order to prevent multiple records from being returned by the sub query, _______ must be used before the sub query.

  1. Many Value Operators
  2. Multiple Value Operators
  3. Single Value Operator
  4. Unique Value Operator

Answer: B) Multiple Value Operators

Explanation:

In order to prevent multiple records from being returned by the sub query, multiple value operators must be used before the sub query.


6. The _________ operator cannot be used with the sub query, but within it.

  1. IN
  2. INTO
  3. BETWEEN
  4. JOIN

Answer: C) BETWEEN

Explanation:

The BETWEEN operator cannot be used with the sub query, but within it.


7. An SQL ____ is a virtual table, whose contents are based on the SQL statement's results.

  1. Concatenate
  2. Virtual
  3. View
  4. None of the above

Answer: C) View

Explanation:

An SQL View is a virtual table, whose contents are based on the SQL statement's results.


8. We can create View in SQL using –

  1. CREATE statement
  2. CREATE VIEW statement
  3. VIEW CREATE statement
  4. SQL VIEW statement

Answer: B) CREATE VIEW statement

Explanation:

We can create View in SQL using CREATE VIEW statement.


9. What is TRUE about UPDATE in SQL VIEW?

  1. Views that depend on a single table can be updated.
  2. An update of a view created from more than one table will not be allowed by SQL.
  3. There should be no NULL values in the fields of view.
  4. All of the above

Answer: D) All of the above

Explanation:

UPDATE in SQL VIEW states that-

  1. Views that depend on a single table can be updated.
  2. An update of a view created from more than one table will not be allowed by SQL.
  3. There should be no NULL values in the fields of view.

10. When SELECT statements used to create Views contain ______________ clauses, the views cannot be updated.

  1. JOIN
  2. HAVING
  3. GROUP BY
  4. All of the above

Answer: D) All of the above

Explanation:

When SELECT statements used to create Views contain JOIN, HAVING, or GROUP BY clauses, the views cannot be updated.


ADVERTISEMENT
ADVERTISEMENT


Comments and Discussions!



ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.