Engineering Questions with Answers - Multiple Choice Questions

MCQs on Views

1 - Question

Which of the following creates a virtual relation for storing the query?
a) Function
b) View
c) Procedure
d) None of the mentioned

View Answer

Answer: 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.




2 - Question

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

Answer: c
Explanation: <query expression> is any legal query expression. The view name is represented by v.




3 - Question

SELECT course_id
FROM physics_fall_2009
WHERE building= ’Watson’;

Here the tuples are selected from the view.Which one denotes the view.
a) Course_id
b) Watson
c) Building
d) physics_fall_2009

View Answer

Answer: c
Explanation: View names may appear in a query any place where a relation name may appear.




4 - Question

Materialised views make sure that
a) View definition is kept stable
b) View definition is kept up-to-date
c) View definition is verified for error
d) View is deleted after specified time

View Answer

Answer: b
Explanation: None.




5 - Question

Updating the value of the view
a) Will affect the relation from which it is defined
b) Will not change the view definition
c) Will not affect the relation from which it is defined
d) Cannot determine

View Answer
Answer: a
Explanation: None.

 




6 - Question

SQL view is said to be updatable (that is, inserts, updates or deletes can be applied on the view) if which of the following conditions are satisfied by the query defining the view?
a) The from clause has only one database relation
b) The query does not have a group by or having clause
c) The select clause contains only attribute names of the relation and does not have any expressions, aggregates, or distinct specification
d) All of the mentioned

View Answer

Answer: d
Explanation: All of the conditions must be satisfied to update the view in sql.




7 - Question

Which of the following is used at the end of the view to reject the tuples which do not satisfy the condition in where clause?
a) With
b) Check
c) With check
d) All of the mentioned

View Answer

Answer: c
Explanation: Views can be defined with a with check option clause at the end of the view definition; then, if a tuple inserted into the view does not satisfy the view’s where clause condition, the insertion is rejected by the database system.




8 - Question

Consider the two relations instructor and department
Instructor:

ID Name Dept_name Salary
1001 Ted Finance 10000
1002 Bob Music 20000
1003 Ron Physics 50000

Department:

Dept_name Building Budget
Biology Watson 40000
Chemistry Painter 30000
Music Taylor 50000

Which of the following is used to create view for these relations together?
a)

CREATE VIEW instructor_info AS
SELECT ID, name, building
FROM instructor, department
WHERE instructor.dept name= department.dept name;

b)

CREATE VIEW instructor_info
SELECT ID, name, building
FROM instructor, department;

c)

CREATE VIEW instructor_info AS
SELECT ID, name, building
FROM instructor;

d)

CREATE VIEW instructor_info AS
SELECT ID, name, building
FROM department;
View Answer

Answer: a
Explanation: None.




9 - Question

For the view Create view instructor_info as

                SELECT ID, name, building
                FROM instructor, department
                WHERE instructor.dept name= department.dept name;

If we insert tuple into the view as insert into instructor info values (’69987’, ’White’, ’Taylor’);
What will be the values of the other attributes in instructor and department relations?
a) Default value
b) Null
c) Error statement
d) 0

View Answer

Answer: b
Explanation: The values take null if there is no constraint in the attribute else it is an Erroneous statement.




10 - Question

CREATE VIEW faculty AS
    SELECT ID, name, dept name
    FROM instructor;

Find the error in this query.
a) Instructor
b) Select
c) View …as
d) None of the mentioned

View Answer

Answer: d
Explanation: Syntax is – create view v as <query expression>;.

Get weekly updates about new MCQs and other posts by joining 18000+ community of active learners