IBM认证考试

Application A is designed to execute the following SQL statements within a single Unit of Work (UOW). UPDATE employee SET salary = salary * 1.1 WHERE empno='000010' UPDATE department SET deptname = 'NEW dept' WHERE deptno='A00'Application B is designed t

题目

Application A is designed to execute the following SQL statements within a single Unit of Work (UOW). UPDATE employee SET salary = salary * 1.1 WHERE empno='000010' UPDATE department SET deptname = 'NEW dept' WHERE deptno='A00'Application B is designed to execute the following SQL statements within a single Unit of Work (UOW). UPDATE department SET deptname = 'OLD DEPT' WHERE deptno='A00' UPDATE employee SET salary = salary * 0.5 WHERE empno='000010' Application A and application B execute their first SQL statement at the same time. When application A and application B try to execute their second SQL statement, a deadlock occurs. What will happen?()

  • A、The database manager will rollback the transaction in both applications.
  • B、The database manager will rollback the transaction in one of the two applications.
  • C、Application B will successfully update the EMPLOYEE and DEPARTMENT tables; Application A will be placed in a lock wait state.
  • D、Application A will successfully update the EMPLOYEE and DEPARTMENT tables; Application B will terminate when the lock timeout value is reached.
参考答案和解析
正确答案:B
如果没有搜索结果,请直接 联系老师 获取答案。
相似问题和答案

第1题:

对于学生信息表:student(sno,sname,sex,age,dept),如果把学生“张明”的姓名改为“张岩”,则正确的语句是

A.UPDATE SET sname='张明'WHERE sname='张岩'

B.UPDATE student SET shame='张明'WHERE shame='张岩'

C.UPDATE student SET sname='张岩'

D.UPDATE student SET sname='张岩'WHERE sname='张明'


正确答案:D
解析:A) 选项没有写出所要操作的表名;B) 选项把姓名写反了。C) 选项没有写明条件。

第2题:

Given the following table definition: STOCK: item VARCHAR(30) status CHAR(1) quantity INT price DEC(7,2) If items are indicated to be out of stock by setting STATUS to NULL and QUANTITY and PRICE to zero, which of the following statements would be used to update the STOCK table to indicate that all the items whose description begins with the letter "S" are out of stock?()

  • A、UPDATE stock SET (status = NULL; quantity, price = 0) WHERE item LIKE S%
  • B、UPDATE stock SET (status, quantity, price) = (NULL, 0, 0) WHERE item LIKE S%
  • C、UPDATE stock SET status = NULL, SET quantity = 0, SET price = 0 WHERE item LIKE 'S%'
  • D、UPDATE stock SET (status = NULL), (quantity = 0), (price = 0) WHERE item LIKE S%

正确答案:B

第3题:

将订单号为"0060"的订单金额改为169元,正确的SQL语句是A)UPDATE订单SET金额=169 WHERE订单号="0060"B)UPDATE订单SET金额WITH 169 WHERE订单号="0060"C)UPDATE FROM订单SET金额=169 WHERE订单号="0060"D)UPDATE FROM订单SET金额WITH 169 WHERE订单号="0060"


正确答案:A
本题考查的是对SQL语句的更新表书写格式的掌握。SQL语句的更新表书写格式为:
  UPDATE<表名> SET<列名1>=<表达式1>[<列名2>=<表达式2>…]
  [WHERE 条件表达式]
只有选项A符合语法格式。

第4题:

A number of applications issue the following SQL statement:SELECT d.deptno, e.empno, e.salary FROM department d INNER JOIN employee e ON d.deptno = e.deptnoA database administrator wishes to store this query within the database. Which of the following database objects can be used to accomplish this?()

  • A、Alias
  • B、View
  • C、Schema
  • D、Trigger

正确答案:B

第5题:

Given the following stored procedure:CREATE PROCEDURE increase_salary ( IN p_workdept CHAR(6), OUT p_sum DECIMAL(9,2) ) SET p_sum = (SELECT SUM(salary) FROM employee WHERE workdept=p_workdept);How can this stored procedure be called from the Command Line Processor?()

  • A、CALL increase_salary('A00')
  • B、VALUES increase_salary('A00')
  • C、CALL increase_salary('A00', ?)
  • D、VALUES increase_salary('A00', ?)

正确答案:C

第6题:

Examine the structure of the EMPLOYEES table:EMPLOYEE_ID NUMBER NOT NULLEMP_NAME VARCHAR2(30)JOB_ID VARCHAR2(20) DEFAULT ‘SA_REP‘SAL NUMBERCOMM_PCT NUMBERMGR_ID NUMBERDEPARTMENT_ID NUMBERYou need to update the records of employees 103 and 115. The UPDATE statement you specify should update the rows with the values specified below:JOB_ID: Default value specified for this column definition.SAL: Maximum salary earned for the job ID SA_REP.COMM_PCT: Default value specified for this commission percentage column, if any. If no default value is specified for the column, the value should be NULL. DEPARTMENT_ID: Supplied by the user during run time through substitution variable.Which UPDATE statement meets the requirements?()

A. UPDATE employees SET job_id = DEFAULT AND Sal = (SELECT MAX(sal) FROM employees WHERE job_id = ‘SA_REP‘) AND comm_pct = DEFAULT AND department_id = &did WHERE employee _id IN (103,115);

B. UPDATE employees SET job_id = DEFAULT AND Sal = MAX(sal) AND comm_pct = DEFAULT OR NULL AND department_id = &did WHERE employee_id IN (103,115) AND job _ id = ‘SA_ REP‘;

C. UPDATE employees SET job_id = DEFAULT, Sal = (SELECT MAX(sal) FROM employees WHERE job_id = ‘SA_REP‘), comm_pct = DEFAULT, department_id = &did WHERE employee_id IN (103,115);

D. UPDATE employees SET job_id = DEFAULT, Sal = MAX(sal), comm_pct = DEFAULT, department_id = &did WHERE employee_id IN (103,115) AND job _ id = ‘SA_ REP‘;

E. UPDATE employees SET job_id = DEFAULT, Sal = (SELECT MAX(sal) FROM employees WHERE job_id = ‘SA_REP‘) comm_pct = DEFAULT OR NULL, department_id = &did WHERE employee_id IN (103,115);


参考答案:C

第7题:

若update emp set salary=1000 中缺少where 条件:()

  • A、更改表中所有记录
  • B、更改第一条记录
  • C、记录未更改。
  • D、提示错误:缺少where字句

正确答案:A

第8题:

对于学生信息表:student(sno,sname,sex,age,dept),如果把学生“小明”的姓名改为“小强”,则正确的语句是( )。

A)UPDATE SET sname=‘小明’WHERE sname=‘小强’

B)UPDATE student SET sname=‘小明’WHERE sname=‘小强’

C)UPDATE student SET sname=‘小强’

D)UPDATE student SET sname=‘小强’WHERE sname=‘小明’


正确答案:D
更新操作语句的一般格式为:

更新指定表中满足谓词的记录,把这些记录按照SET子句中的表达式更新相应字段上的值。本题所选的记录应当满足谓词WHERE sname=‘小明’,要更新成sname=‘小强’。

第9题:

Given table T1 has column I1 containing the following data: I1 1 2 3 4 If the following sequence of SQL statements is applied within a single unit of work: UPDATE t1 SET i1 = 3 WHERE i1 = 2; S AVEPOINT s1 ON ROLLBACK RETAIN CURSORS; UPDATE t1 SET i1 = 5 WHERE i1 = 3; SAVEPOINT s2 ON ROLLBACK RETAIN CURSORS;INSERT INTO t1 (i1) VALUES (6); ROLLBACK TO SAVEPOINT s1; UPDATE t1 SET i1 = 2 WHERE i1 = 4; COMMIT; What is the expected sequence of values returned from?() SELECT i1 FROM t1 ORDER BY i1

  • A、1, 2, 3, 3
  • B、1, 2, 2, 4
  • C、1, 2, 3, 3, 6
  • D、1, 2, 2, 5, 6

正确答案:A

第10题:

You are working as a DBA at NetFx Corporation. A user, Scott, is maintaining the records of all the employees in the EMPLOYEEtable. Initially, the salary of the employee, ’E0025’, was $1800. On 1 May 2004, the salary of the employee, ’E0025’, was increased by $200.   The user, Scott, issued the following statement to modify the record of the employee, ’E0025’:   SQL>UPDATE EMPLOYEE  SET SALARY = 2000   WHERE EMPNO = ’E0025’;   SQL>COMMIT;   On December 1, 2004, the salary of the employee, ’E0025’, was increased by $400. The user, Scott, issued the following statement to modify the record of the employee, ’E0025’:   SQL>UPDATE EMPLOYEE  SET SALARY = 2400   WHERE EMPNO = ’E0025’;   SQL>COMMIT;   On July 1, 2005, the salary of the employee, ’E0025’, was increased by $500. The user, Scott, issued the following statement to modify the record of the employee, ’E0025’   SQL>UPDATE EMPLOYEE  SET SALARY = 2900   WHERE EMPNO = ’E0025’;   SQL>COMMIT;   On July 5, 2005, the HR manager asked you to generate the increment report of the employee, ’E0025’, for the period between 1 May 2004 and 1 July 2005. Which flashback feature will you use to generate the increment report?()

  • A、 Flashback Drop
  • B、 Flashback Table
  • C、 Flashback Database
  • D、Flashback Version Query

正确答案:D

更多相关问题