View the Exhibit to examine the description for the SALES table. Which views can have all DML operations
performed on it? (Choose all that apply.)
A.
CREATE VIEW v3
AS SELECT * FROM SALES
WHERE cust_id = 2034
WITH CHECK OPTION;
B.
CREATE VIEW v1
AS SELECT * FROM SALES
WHERE time_id <= SYSDATE – 2*365
WITH CHECK OPTION;
C.
CREATE VIEW v2
AS SELECT prod_id, cust_id, time_id FROM SALES
WHERE time_id <= SYSDATE – 2*365
WITH CHECK OPTION;
D.
CREATE VIEW v4
AS SELECT prod_id, cust_id, SUM(quantity_sold) FROM SALES
WHERE time_id <= SYSDATE – 2*365
GROUP BY prod_id, cust_id
WITH CHECK OPTION;
Explanation:
Creating a View
You can create a view by embedding a subquery in the CREATE VIEW statement.
In the syntax:
CREATE [OR REPLACE] [FORCE|NOFORCE] VIEW view
[(alias[, alias]…)]
AS subquery
[WITH CHECK OPTION [CONSTRAINT constraint]]
[WITH READ ONLY [CONSTRAINT constraint]];
OR REPLACE Re-creates the view if it already exists
FORCE Creates the view regardless of whether or not the base tables exist
NOFORCE Creates the view only if the base tables exist (This is the default.)
View Is the name of the view alias Specifies names for the expressions selected by the view’s query (The
number of aliases must match the number of expressions selected by the view.)
subquery Is a complete SELECT statement (You can use aliases for the columns in the SELECT list.)
WITH CHECK OPTION Specifies that only those rows that are accessible to the view can be inserted or
updated ANSWER D constraint Is the name assigned to the CHECK OPTION constraint
WITH READ ONLY Ensures that no DML operations can be performed on this view
Rules for Performing DML Operations on a View
You cannot add data through a view if the view includes:
Group functions
A GROUP BY clause
The DISTINCT keyword
The pseudocolumn ROWNUM keyword
Columns defined by expressions
NOT NULL columns in the base tables that are not selected by the view – ANSWER C
You cannot add data through a view if the view includes:
Group functions
A GROUP BY clause — D
The DISTINCT keyword
The pseudocolumn ROWNUM keyword
Columns defined by expressions
NOT NULL columns in the base tables that are not selected by the view – ANSWER C