SQL Views MCQ Questions & Answers
Views MCQs : This section focuses on the "Views" in SQL. These Multiple Choice Questions (MCQ) should be practiced to improve the SQL skills required for various interviews (campus interview, walk-in interview, company interview), placements and other competitive examinations.
1. Views can be created for?
A. One table
B. Many table
C. another view
D. All of the above
View Answer
Ans : D
Explanation: Views can be created from a single table, multiple tables or another view.
2. A view is actually a?
A. composition of a table
B. decomposition of a table
C. associated to a table
D. None of the above
View Answer
Ans : A
Explanation: A view is actually a composition of a table in the form of a predefined SQL query.
3. A view can contain all rows of a table?
A. TRUE
B. FALSE
C. Not all rows but all columns
D. Can't say
View Answer
Ans : A
Explanation: A view can contain all rows of a table or select rows from a table.
4. What is true about view?
A. Database views are created using the CREATE VIEW statement.
B. To create a view, a user must have the appropriate system privilege according to the specific implementation.
C. Both A and B are true
D. Both A and B are false
View Answer
Ans : C
Explanation: Both A and B statement are true.
5. Which option in view is to ensure that all UPDATE and INSERTs satisfy the condition(s) in the view definition?
A. Uncheck
B. With Check
C. Check
D. With
View Answer
Ans : B
Explanation: The purpose of the WITH CHECK OPTION is to ensure that all UPDATE and INSERTs satisfy the condition(s) in the view definition.
6. What is true statement while Updating a View?
A. The SELECT clause may not contain the keyword DISTINCT.
B. The SELECT clause may not contain summary functions.
C. The SELECT clause may not contain set functions.
D. All of the above
View Answer
Ans : D
Explanation: All the statement are true.
7. Can we insert and delete rows into a View?
A. Yes
B. No
C. Rows of data can be inserted but can not deleted
D. Rows of data can be deleted but cacn not inserted
View Answer
Ans : A
Explanation: Yes, we insert and delete rows into a View.
8. What is syntax for delete the view?
A. DELETE VIEW view_name;
B. DROP VIEW view_name/table_name;
C. DROP VIEW view_name;
D. DROP VIEW table_name;
View Answer
Ans : C
Explanation: The syntax is very simple and is given below : DROP VIEW view_name;
9. Rules of UPDATE command and INSERT command are same as?
A. Inserting Rows into a View
B. Deleting Rows into a View
C. Both A and B
D. None of the above
View Answer
Ans : C
Explanation: Rules of UPDATE command and INSERT command are same as insert and delete rows into a View
10. All NOT NULL columns from the base table must be included in the view in order for the INSERT query to function.
A. TRUE
B. FALSE
C. All NULL columns from the base table must be included in the view in order for the INSERT query to function.
D. None of the above
View Answer
Ans : A
Explanation: All NOT NULL columns from the base table must be included in the view in order for the INSERT query to function.
11. Find the error in this query.
A. View …as
B. Scholar
C. Select
D. None of the above
View Answer
Ans : D
Explanation: Syntax is : create view v as ;.
12. For the view Create view student_info as : If we insert tuple into the view as insert into instructor info values (’69987’, ’White’, ’CS’);
What will be the values of the other attributes in instructor and department relations?
A. Default value
B. Null
C. Error
D. 0
View Answer
Ans : B
Explanation: The values take null if there is no constraint in the attribute else it is an Erroneous statement.
13. Which of the following is the syntax for views where v is view name?
A. Create view v as "query name";
B. Create "query expression" as view;
C. Create view v as "query expression";
D. Create view "query expression";
View Answer
Ans : C
Explanation: is any legal query expression. The view name is represented by v.
14. Which of the following creates a virtual relation for storing the query?
A. Function
B. View
C. Procedure
D. All of the above
View Answer
Ans : B
Explanation: Any such relation that is not part of the logical model, but is made visible to a user as a virtual relation, is called a view.
15. Here the tuples are selected from the view.Which one denotes the view.
A. Course_id
B. Building
C. Watson
D. physics_fall_2009
View Answer
Ans : C
Explanation: View names may appear in a query any place where a relation name may appear.
16. Which of the following is false?
A. We can update a view if it has multiple database relations in the from clause
B. One view can be used in the expression defining another view
C. Both A and B
D. None of the above
View Answer
Ans : A
Explanation: We can update a view only if it has a single database relation in the "from" clause.
17. The process of maintaining views up to date is called?
A. View materialization
B. View isolation
C. View updating
D. View maintenance
View Answer
Ans : D
Explanation: The process of maintaining views up to date is called View maintenance. View maintenance can be done immediately when any of the views is updated.
18. _______ views help to keep the database up-to-date.
A. View materialization
B. View isolation
C. View updating
D. View maintenance
View Answer
Ans : A
Explanation: Materialized views help to keep the database up-to-date.
19. You can perform ______ operation(s) on SQL Views?
A. Filter
B. Sort
C. Join
D. All of the above
View Answer
Ans : D
Explanation: All of the above operation(s) can perform on SQL Views.
20. In Oracle SQL no insert, update, or delete modifications on views are allowed that use one of the following constructs in the view definition:
A. Joins
B. Aggregate function such as sum, min, max etc.
C. group by clause or distinct clause
D. All of the above
View Answer
Ans : D
Explanation: All of the above.
Discussion