【OCP】Oracle 11g OCP 1Z0-051 002
2. 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;
答案: AB
考點:透過檢視對基表進行insert操作時,基表中帶有not null約束的列須出現在檢視中。
關鍵字:SELECT * FROM
【解析實驗】
題意要求可以對檢視進行所有DML操作(insert 、update、delete),
如果透過檢視對基表進行insert操作,建立檢視的語句必須包含基表中所有帶有not null約束限制的列
本題基表上各列均有not null約束限制,所以建立檢視時必須包含基表所有列。CD選項錯誤.
語法上看ABC選項檢視均可以正常建立,但C選項檢視v2不可以進行insert操作。
對C選項中檢視v2執行insert操作時,相當於對基表SALES部分列執行insert操作,其他列由於有not null約束,會報錯。
SH@PROD>insert into v2 values (20,2411,to_date('26-JUN-98','DD-MON-RR'));
D選項帶有group by子句,使用了sum函式,是複雜檢視,不能對複雜檢視進行DML操作更新基表。D錯誤
D選項本身語法也有錯誤, SUM(quantity_sold) 後需要使用別名才能正常建立檢視
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;
答案: AB
考點:透過檢視對基表進行insert操作時,基表中帶有not null約束的列須出現在檢視中。
關鍵字:SELECT * FROM
【解析實驗】
題意要求可以對檢視進行所有DML操作(insert 、update、delete),
如果透過檢視對基表進行insert操作,建立檢視的語句必須包含基表中所有帶有not null約束限制的列
本題基表上各列均有not null約束限制,所以建立檢視時必須包含基表所有列。CD選項錯誤.
語法上看ABC選項檢視均可以正常建立,但C選項檢視v2不可以進行insert操作。
對C選項中檢視v2執行insert操作時,相當於對基表SALES部分列執行insert操作,其他列由於有not null約束,會報錯。
SH@PROD>insert into v2 values (20,2411,to_date('26-JUN-98','DD-MON-RR'));
D選項帶有group by子句,使用了sum函式,是複雜檢視,不能對複雜檢視進行DML操作更新基表。D錯誤
D選項本身語法也有錯誤, SUM(quantity_sold) 後需要使用別名才能正常建立檢視
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29475508/viewspace-2065229/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【OCP】Oracle 11g OCP 1Z0-051 003Oracle
- 【OCP】Oracle 11g OCP 1Z0-051 004Oracle
- 【OCP】Oracle 11g OCP 1Z0-051 005Oracle
- 【OCP】Oracle 11g OCP 1Z0-051 006Oracle
- 【OCP】Oracle 11g OCP 1Z0-051 007Oracle
- 【OCP】Oracle 11g OCP 1Z0-051 001Oracle
- Oracle 11G OCP 1Z0-051 所有題目解析Oracle
- Oracle?認證專家 (OCP) 11GOracle
- 11g oracle OCP 047題庫解析Oracle
- 11G oracle OCP 047題庫解析Oracle
- 【Oracle】-【OCP】-“滾燙”的OCP經歷Oracle
- Oracle OCP(56)Oracle
- Oracle 11G OCP 1Z0-052 14Oracle
- Oracle 11G OCP 1Z0-052 88Oracle
- Oracle 11G OCP 1Z0-052 89Oracle
- Oracle 11G OCP 1Z0-052 90Oracle
- Oracle 11G OCP 1Z0-052 92Oracle
- Oracle 11G OCP 1Z0-052 93Oracle
- Oracle 11G OCP 1Z0-052 94Oracle
- Oracle 11G OCP 1Z0-052 95Oracle
- Oracle 11G OCP 1Z0-052 96Oracle
- Oracle 11G OCP 1Z0-052 97Oracle
- Oracle 11G OCP 1Z0-052 98Oracle
- Oracle 11G OCP 1Z0-052 99Oracle
- Oracle 11G OCP 1Z0-052 71Oracle
- Oracle 11G OCP 1Z0-052 73Oracle
- Oracle 11G OCP 1Z0-052 74Oracle
- Oracle 11G OCP 1Z0-052 75Oracle
- Oracle 11G OCP 1Z0-052 76Oracle
- Oracle 11G OCP 1Z0-052 77Oracle
- Oracle 11G OCP 1Z0-052 78Oracle
- Oracle 11G OCP 1Z0-052 79Oracle
- Oracle 11G OCP 1Z0-052 80Oracle
- Oracle 11G OCP 1Z0-052 81Oracle
- Oracle 11G OCP 1Z0-052 82Oracle
- Oracle 11G OCP 1Z0-052 83Oracle
- Oracle 11G OCP 1Z0-052 84Oracle
- Oracle 11G OCP 1Z0-052 85Oracle