{"id":747,"date":"2007-07-20T06:03:56","date_gmt":"2007-07-20T09:03:56","guid":{"rendered":"http:\/\/blog.decade.com.br\/?p=747"},"modified":"2011-06-10T15:08:08","modified_gmt":"2011-06-10T18:08:08","slug":"question-03","status":"publish","type":"post","link":"https:\/\/blog.decade.com.br\/?p=747","title":{"rendered":"QUESTION: 03"},"content":{"rendered":"<p align=justify>\nThe employee table contains these columns:<\/p>\n<p align=justify>\n<code><\/p>\n<blockquote><p>\nLAST_NAME VARCHAR2(25)<br \/>\nFIRST_NAME VARCHAR2(25)<br \/>\nSALARY NUMBER(7,2)\n<\/p><\/blockquote>\n<p><\/code><\/p>\n<p align=justify>\nYou need to display the names of employees on more than an average salary of all employees. Evaluate the SQL statement.<\/p>\n<p align=justify>\n<code><\/p>\n<blockquote><p>\nSELECT last_name, first_name FROM employee WHERE salary < AVG(salary);\n<\/p><\/blockquote>\n<p><\/code><\/p>\n<p align=justify>\nWhich change should you make to achieve the desired results?<\/p>\n<p align=justify>\n<strong>A:<\/strong> Change the function in the Where clause.<br \/>\n<strong>B:<\/strong> Move the function to the select clause and add a group clause.<br \/>\n<strong>C:<\/strong> Use a sub query in the where clause to compare the average salary value.<br \/>\n<strong>D:<\/strong> Move the function to the select clause and add a group by clause and a having clause.<\/p>\n<p align=justify>\nANSWER: <strong>C<\/strong><\/p>\n<p align=justify>\nEXPLANATION: <strong>Answer C shows the correct way to change query, because function AVG can not be used in WHERE clause.<\/strong><\/p>\n<p align=justify>\nINCORRECT ANSWERS:<\/p>\n<p align=justify>\n<strong>A:<\/strong> Usage of function AVG is correct.<br \/>\n<strong>B:<\/strong> This query does not require grouping to extract correct information from the table.<br \/>\n<strong>D:<\/strong> This query does not require to use GROUP BY and HAVING clauses to extract correct information from table.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The employee table contains these columns: LAST_NAME VARCHAR2(25) FIRST_NAME VARCHAR2(25) SALARY NUMBER(7,2) You need to display the names of employees on more than an average salary of all employees. Evaluate the SQL statement. SELECT last_name, first_name FROM employee WHERE salary < AVG(salary); Which change should you make to achieve the desired results? A: Change the [&hellip;]\n<\/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-747","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\/747","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=747"}],"version-history":[{"count":0,"href":"https:\/\/blog.decade.com.br\/index.php?rest_route=\/wp\/v2\/posts\/747\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.decade.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=747"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.decade.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=747"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.decade.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=747"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}