{"id":1575,"date":"2007-07-20T06:11:18","date_gmt":"2007-07-20T09:11:18","guid":{"rendered":"http:\/\/blog.decade.com.br\/?p=1575"},"modified":"2011-10-03T14:21:22","modified_gmt":"2011-10-03T17:21:22","slug":"question-11","status":"publish","type":"post","link":"https:\/\/blog.decade.com.br\/?p=1575","title":{"rendered":"QUESTION: 11"},"content":{"rendered":"<p align=justify>\nThe view EMP_VIEW is created based on the EMP table as follows:<\/p>\n<p align=justify>\n<code><\/p>\n<blockquote><p>\nCREATE OR REPLACE VIEW emp_view AS<br \/>\nSELECT deptno<br \/>\n,      SUM(sal) TOT_SAL<br \/>\n,      COUNT(*) TOT_EMP<br \/>\nFROM emp;<br \/>\nGROUP BY deptno;\n<\/p><\/blockquote>\n<p><\/code><\/p>\n<p align=justify>\nWhat happens when the command is used?<\/p>\n<p align=justify>\n<code><\/p>\n<blockquote><p>\nUPDATE emp_view<br \/>\nSET tot_sal = 20000<br \/>\nWHERE deptno = 10;\n<\/p><\/blockquote>\n<p><\/code><\/p>\n<p align=justify>\n<strong>A:<\/strong> The base table cannot be updated through this view.<br \/>\n<strong>B:<\/strong> The TOT_SAL column in the EMP table is updated to 20000 for department 10.<br \/>\n<strong>C:<\/strong> The TOT_EMP column in the EMP table is updated to 20000 for department 10.<br \/>\n<strong>D:<\/strong> The SAL column in the EMP table is updated to 20000 for employees in department 10.<\/p>\n<p align=justify>\nANSWER: <strong>A<\/strong><\/p>\n<p align=justify>\nEXPLANATION: <strong>Answer A is correct because the user may not INSERT, DELETE, or UPDATE data on the table underlying the sample view if the SELECT statement creating the view contains GROUP BY, or a single-row operation.<\/strong><\/p>\n<p align=justify>\nINCORRECT ANSWERS:<\/p>\n<p align=justify>\n<strong>B:<\/strong> TOT_SAL column in the EMP table will not be updated.<br \/>\n<strong>C:<\/strong> TOT_EMP column in the EMP table will not be updated for any rows.<br \/>\n<strong>D:<\/strong> UPDATE command does not contain SAL column for update.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The view EMP_VIEW is created based on the EMP table as follows: CREATE OR REPLACE VIEW emp_view AS SELECT deptno , SUM(sal) TOT_SAL , COUNT(*) TOT_EMP FROM emp; GROUP BY deptno; What happens when the command is used? UPDATE emp_view SET tot_sal = 20000 WHERE deptno = 10; A: The base table cannot be updated [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,13,8],"tags":[],"class_list":["post-1575","post","type-post","status-publish","format-standard","hentry","category-1z0-001","category-oca-plsql-developer","category-oracle"],"_links":{"self":[{"href":"https:\/\/blog.decade.com.br\/index.php?rest_route=\/wp\/v2\/posts\/1575","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.decade.com.br\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.decade.com.br\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.decade.com.br\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.decade.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1575"}],"version-history":[{"count":0,"href":"https:\/\/blog.decade.com.br\/index.php?rest_route=\/wp\/v2\/posts\/1575\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.decade.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.decade.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.decade.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}