📄 que_113.htm
字号:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>Ocp test </title>
</head>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<p align="left" color="black" style="font-size:16pt;">
<b>QUESTION 113
</b></p><hr color="#99CCFF">
EMPLOYEES and DEPARTMENTS data: </p><table border="1" bordercolor="gray" width="534">
<span style="font-size:18pt;">
<tr>
<td align="center" bgcolor="#99CCFF" width="112">
<p><b>EMPLOYEE_ID</b></p></b>
</td>
<td align="center" bgcolor="#99CCFF" width="84">
<p><b>EMP_NAME</b></p></b>
</td>
<td align="center" bgcolor="#99CCFF" width="67">
<p><b>DEPT_ID</b></p></b>
</td>
<td align="center" bgcolor="#99CCFF" width="57">
<p><b>MGR_ID</b></p></b>
</td>
<td align="center" bgcolor="#99CCFF" width="92">
<p><b>JOB_ID</b></p></b>
</td>
<td align="center" bgcolor="#99CCFF" width="80">
<p><b>SALA</b></p></b>
</td>
</tr>
<tr>
<td align="center" bgcolor="white" width="112">
<p><b>101</b></p></b>
</td>
<td align="center" bgcolor="white" width="84">
<p><b>Smith</b></p></b>
</td>
<td align="center" bgcolor="white" width="67">
<p><b>20</b></p></b>
</td>
<td align="center" bgcolor="white" width="57">
<p><b>120</b></p></b>
</td>
<td align="center" bgcolor="white" width="92">
<p><b>SA_REP</b></p></b>
</td>
<td align="center" bgcolor="white" width="80">
<p><b>4000</b></p></b>
</td>
</tr>
<tr>
<td align="center" bgcolor="white" width="112">
<p><b>102</b></p></b>
</td>
<td align="center" bgcolor="white" width="84">
<p><b>Martin</b></p></b>
</td>
<td align="center" bgcolor="white" width="67">
<p><b>10</b></p></b>
</td>
<td align="center" bgcolor="white" width="57">
<p><b>105</b></p></b>
</td>
<td align="center" bgcolor="white" width="92">
<p><b>CLERK</b></p></b>
</td>
<td align="center" bgcolor="white" width="80">
<p><b>2500</b></p></b>
</td>
</tr>
<tr>
<td align="center" bgcolor="white" width="112">
<p><b>103</b></p></b>
</td>
<td align="center" bgcolor="white" width="84">
<p><b>Chris</b></p></b>
</td>
<td align="center" bgcolor="white" width="67">
<p><b>20</b></p></b>
</td>
<td align="center" bgcolor="white" width="57">
<p><b>120</b></p></b>
</td>
<td align="center" bgcolor="white" width="92">
<p><b>IT_ADMIN</b></p></b>
</td>
<td align="center" bgcolor="white" width="80">
<p><b>4200</b></p></b>
</td>
</tr>
<tr>
<td align="center" bgcolor="white" width="112">
<p><b>104</b></p></b>
</td>
<td align="center" bgcolor="white" width="84">
<p><b>John</b></p></b>
</td>
<td align="center" bgcolor="white" width="67">
<p><b>30</b></p></b>
</td>
<td align="center" bgcolor="white" width="57">
<p><b>108</b></p></b>
</td>
<td align="center" bgcolor="white" width="92">
<p><b>HR_CLERK</b></p></b>
</td>
<td align="center" bgcolor="white" width="80">
<p><b>2500</b></p></b>
</td>
</tr>
<tr>
<td align="center" bgcolor="white" width="112">
<p><b>105</b></p></b>
</td>
<td align="center" bgcolor="white" width="84">
<p><b>Diana</b></p></b>
</td>
<td align="center" bgcolor="white" width="67">
<p><b>30</b></p></b>
</td>
<td align="center" bgcolor="white" width="57">
<p><b>108</b></p></b>
</td>
<td align="center" bgcolor="white" width="92">
<p><b>IT_ADMIN</b></p></b>
</td>
<td align="center" bgcolor="white" width="80">
<p><b>5000</b></p></b>
</td>
</tr>
<tr>
<td align="center" bgcolor="white" width="112">
<p><b>106</b></p></b>
</td>
<td align="center" bgcolor="white" width="84">
<p><b>Smith</b></p></b>
</td>
<td align="center" bgcolor="white" width="67">
<p><b>40</b></p></b>
</td>
<td align="center" bgcolor="white" width="57">
<p><b>110</b></p></b>
</td>
<td align="center" bgcolor="white" width="92">
<p><b>AD_ASST</b></p></b>
</td>
<td align="center" bgcolor="white" width="80">
<p><b>3000</b></p></b>
</td>
</tr>
<tr>
<td align="center" bgcolor="white" width="112">
<p><b>108</b></p></b>
</td>
<td align="center" bgcolor="white" width="84">
<p><b>Jennifer</b></p></b>
</td>
<td align="center" bgcolor="white" width="67">
<p><b>30</b></p></b>
</td>
<td align="center" bgcolor="white" width="57">
<p><b>110</b></p></b>
</td>
<td align="center" bgcolor="white" width="92">
<p><b>HR_DIR</b></p></b>
</td>
<td align="center" bgcolor="white" width="80">
<p><b>6500</b></p></b>
</td>
</tr>
<tr>
<td align="center" bgcolor="white" width="112">
<p><b>110</b></p></b>
</td>
<td align="center" bgcolor="white" width="84">
<p><b>Bob</b></p></b>
</td>
<td align="center" bgcolor="white" width="67">
<p><b>40</b></p></b>
</td>
<td align="center" bgcolor="white" width="57">
<p><b> </b></p></b>
</td>
<td align="center" bgcolor="white" width="92">
<p><b>EX_DIR</b></p></b>
</td>
<td width="80"> <p align="center"><b>8000</b></p></td>
</tr>
<tr>
<td align="center" bgcolor="white" width="112">
<p><b>120</b></p></b>
</td>
<td align="center" bgcolor="white" width="84">
<p><b>Ravi</b></p></b>
</td>
<td align="center" bgcolor="white" width="67">
<p><b>20</b></p></b>
</td>
<td align="center" bgcolor="white" width="57">
<p><b>110</b></p></b>
</td>
<td align="center" bgcolor="white" width="92">
<p><b>SA_DIR</b></p></b>
</td>
<td align="center" bgcolor="white" width="80">
<p><b>6500</b></p></b>
</td>
</tr>
</span>
</table>
<br>DEPARTMENTS<br><br><table border="1" bordercolor="gray" width="392">
<span style="font-size:18pt;">
<tr>
<td align="center" bgcolor="#99CCFF" width="148">
<p><b>DEPARTMENT_ID</b></p></b>
</td>
<td align="center" bgcolor="#99CCFF" width="227">
<p><b>DEPARTMENT_NAME</b></p></b>
</td>
</tr>
<tr>
<td align="center" bgcolor="white" width="148">
<p><b>10</b></p></b>
</td>
<td align="center" bgcolor="white" width="227">
<p><b>Admin</b></p></b>
</td>
</tr>
<tr>
<td align="center" bgcolor="white" width="148">
<p><b>20</b></p></b>
</td>
<td align="center" bgcolor="white" width="227">
<p><b>Education</b></p></b>
</td>
</tr>
<tr>
<td align="center" bgcolor="white" width="148">
<p><b>30</b></p></b>
</td>
<td align="center" bgcolor="white" width="227">
<p><b>IT</b></p></b>
</td>
</tr>
</span>
</table>
<p>On the EMPLOYEES table, EMPLOYEE_ID is the primary key. <br>MGR_ID is the ID
managers and refers to the EMPLOYEE_ID.
<br>On the DEPARTMENTS table DEPARTMENT_ID is the primary key.
<br><br>Evaluate this UPDATE statement.
<br><br>UPDATE employees
<br>SET mgr_id =
(SELECT mgr_id
<br> FROM employees
<br> WHERE dept_id=
(SELECT department_id
<br> FROM departments
<br> WHERE department_name = 'Administration')),
<br> Salary = (SELECT salary
<br> FROM employees
<br> WHERE emp_name = 'Smith')
<br>WHERE job_id = 'IT_ADMIN';
<br><br>What happens when the statement is executed? </p><table border="1" bordercolor="gray" width="665">
<form name="youAnsForm">
<span style="font-size:18pt;">
<tr>
<td align="center" width="89">
<p><b><input type="radio" name="AN" value="A"> A.</b></p>
</td>
<td align="left" width="566">
<p> The statement executes successfully, leaves the manager ID as the existing value, and changes the salary to 4000 for the employees with ID 103 and 105.
</p>
</td>
</tr>
<tr>
<td align="center" width="89">
<p><b><input type="radio" name="AN" value="B"> B.</b></p>
</td>
<td align="left" width="566">
<p> The statement executes successfully, changes the manager ID to NULL, and changes the salary to 4000 for the employees with ID 103 and 105.
</p>
</td>
</tr>
<tr>
<td align="center" width="89">
<p><b><input type="radio" name="AN" value="C"> C.</b></p>
</td>
<td align="left" width="566">
<p> The statement executes successfully, changes the manager ID to NULL, and changes the salary to 3000 for the employees with ID 103 and 105.
</p>
</td>
</tr>
<tr>
<td align="center" width="89">
<p><b><input type="radio" name="AN" value="D"> D.</b></p>
</td>
<td align="left" width="566">
<p> The statement fails because there is more than one row matching the employee name Smith.
</p>
</td>
</tr>
<tr>
<td align="center" width="89">
<p><b><input type="radio" name="AN" value="E"> E.</b></p>
</td>
<td align="left" width="566">
<p> The statement fails because there is more than one row matching the IT_ADMIN job ID in the EMPLOYEES table.
</p>
</td>
</tr>
<tr>
<td align="center" width="89">
<p><b><input type="radio" name="AN" value="F"> F.</b></p>
</td>
<td align="left" width="566">
<p> The statement fails because there is no 'Administration' department in the DEPARTMENTS table.</p>
</td>
</tr>
</span>
</form>
</table>
<p> </p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -