登录 注册
当前位置:主页 > 资源下载 > 使用多列子查询进行更新——SQL语言入门知识

使用多列子查询进行更新——SQL语言入门知识

  • 更新:2024-07-07 11:41:32
  • 大小:5.26MB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:Informix - 数据库
  • 格式:PPT

资源介绍

用多列子查询进行修改 * SQL> UPDATE emp 2 SET (job, deptno) = 3 (SELECT job, deptno 4 FROM emp 5 WHERE empno = 7499) 6 WHERE empno = 7698; 1 row updated. 更改第 7698号雇员的工作和部门,以与第 7499号雇员进行匹配. * UPDATE emp SET (job, deptno) = (SELECT job, deptno FROM emp WHERE empno = 7499) WHERE empno = 7698; Updating Rows with a Multiple-Column Subquery Multiple-column subqueries can be implemented in the SET clause of an UPDATE statement. Syntax Instructor Note It may be worth showing participants that the results would be the same for the example on the slide if two different subqueries were used in the SET clause as illustrated below: SQL> UPDATE emp 2 SET job = (SELECT job FROM emp 3 WHERE empno = 7499), 4 deptno = (SELECT deptno FROM dept 5 WHERE dname = 'SALES') 6 WHERE empno = 7698; UPDATE table SET (column, column, ...) = (SELECT column, column, ... FROM table WHERE condition) WHERE condition;