MySQL Questions and Answers – Using Views

This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “Using Views”.

1. Which of these is also known as a virtual table?
a) SCHEMA
b) DATABASE
c) JOIN
d) VIEW
View Answer

Answer: d
Explanation: In MySQL, a ‘View’ is also called a virtual table. It does not contain any data but only appears as a table. It is an alternative way to show or describe a table similar to the original table.

2. A View can be used to select a subset of the table columns.
a) True
b) False
View Answer

Answer: a
Explanation: In MySQL, a ‘View’ is used to present a table in the database. It is a virtual table. It is also used to present a subset of the columns that are present in the original table of the database.

3. What is xyz in the following MySQL statement?

advertisement
advertisement
CREATE VIEW xyz AS SELECT a, b FROM t;

a) table
b) column
c) view
d) database
View Answer

Answer: c
Explanation: A ‘View’ is created in MySQL by writing the clause ‘CREATE VIEW’ followed by the view name. Then follows the list of column names of the table that are to be presented as the view.
Note: Join free Sanfoundry classes at Telegram or Youtube

4. What is abc in the following MySQL statement?

CREATE VIEW xyz (abc) AS SELECT a FROM t;

a) row name
b) column name
c) view
d) database
View Answer

Answer: b
Explanation: Column names for a view can be explicitly provided in the ‘CREATE VIEW’ clause itself. It presents the table view with the aliased column names instead of the original column names.
advertisement

5. A view can refer to multiple tables via __________
a) UNION
b) JOIN
c) GROUP
d) SELECT
View Answer

Answer: b
Explanation: In MySQL, a ‘View’ can refer to multiple tables. This makes it a lot simpler to execute the queries involving joins. When a selection is made from the view, the join is executed producing the results.
advertisement

6. Views are not updatable.
a) True
b) False
View Answer

Answer: b
Explanation: In MySQL, some ‘Views’ are updatable. The operators ‘INSERT’, ‘DELETE’ and ‘UPDATE’ can be used. They can be operated on the ‘Views’ to make changes to it. A table can be created and set as a view.

7. A view can be deleted using the command __________
a) REMOVE
b) DELETE
c) CLEAR
d) DROP
View Answer

Answer: d
Explanation: In MySQL, ‘Views’ act as virtual tables. Many operations can be performed on views like the operations on tables. A view can be created, displayed and dropped. They can also be used to perform calculations.

8. What cannot be done on a view?
a) display
b) filter
c) index
d) drop
View Answer

Answer: c
Explanation: In MySQL, ‘Views’ act as virtual tables. It is not possible to create indexes on a view. However, they can be used for the views that are processed using the merge algorithm.

9. What can be used to check for views that have been invalidated by DROP or ALTER operations?
a) CREATE TABLE
b) VERIFY TABLE
c) DETAILS TABLE
d) CHECK TABLE
View Answer

Answer: d
Explanation: A ‘View’ is created in MySQL by writing the clause ‘CREATE VIEW’ followed by the view name. Once a view is dropped or altered after being created, it can be checked by the ‘CHECK TABLE’ clause.

10. Which of the following does not support a materialized view?
a) MySQL
b) Oracle
c) PostgreSQL
d) SybaseSQL
View Answer

Answer: a
Explanation: In MySQL, ‘Views’ are treated a little differently than Oracle, PostgreSQL and SybaseSQL since they support materialized views and MySQL does not use the materialized view.

Sanfoundry Global Education & Learning Series – MySQL Database.

To practice all areas of MySQL Database, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

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
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.