Question : View the Exhibit and examine the structures of the employees and departments tables. You want to update the employees table as follows: -Update only those employees who work in Boston or Seattle (locations 2900 and 2700). -Set department_id for these employees to the department_id corresponding to London (location_id 2100). -Set the employees' salary in iocation_id 2100 to 1.1 times the average salary of their department. -Set the employees' commission in iocation_id 2100 to 1.5 times the average commission of their department. You issue the given (left side) command: What is the outcome? 1. It executes successfully and gives the correct result. 2. It executes successfully but does not give the correct result. 3. It generates an error because a subquery cannot have a join condition in an update statement. 4. It generates an error because multiple columns (SALARY, COMMISSION) cannot be specified together in an update statement.
Correct Answer : 2 Explanation: - Set the employees’ salary in location_id 2100 to 1.1 times the average salary of their department. - Set the employees’ commission in location_id 2100 to 1.5 times the average commission of their These two conditions requires to update in location_id 2100 whereas -Update only those employees who work in Boston or Seattle (locations 2900 and 2700). Says update only in 2900 and 2700 so it won’t work
Because of this set clause: (salary, commission) = (SELECT 1.1*AVG(salary), 1.5*AVG(commission) FROM employees, departments WHERE departments.location_id IN(2900,2700,2100)) So salary and commission would be set to average of those from three locations whereas you need to use average only from their (2100) location
Question : You need to produce a report where each customer's credit limit has been incremented by $. In the output, the customer's last name should have the heading Name and the incremented credit limit should be labeled New credit Limit. The column headings should have only the first letter of each word in uppercase. Which statement would accomplish this requirement? 1. A 2. B 3. C 4. D
Correct Answer : 3
Explanation: A column alias: - Renames a column heading - Is useful with calculations - Immediately follows the column name (There can also be the optional AS keyword between the column name and the alias.) - Requires double quotation marks if it contains spaces or special characters, or if it is case sensitive.
Question : View the Exhibit and examine the data in the costs table. You need to generate a report that displays the IDs of all products in the costs table whose unit price is at least 25% more than the unit cost. The details should be displayed in the descending order of 25% of the unit cost. You issue the given query: Which statement is true regarding the above query? 1. It executes and produces the required result. 2. It produces an error because an expression cannot be used in the order by clause. 3. It produces an error because the DESC option cannot be used with an expression in the order by clause. 4. It produces an error because the expression in the ORDER by clause should also be specified in the SELECT clause.