登录 注册
当前位置:主页 > 资源下载 > 在SQL语言基础中,涉及到从另一个表中复制行的操作

在SQL语言基础中,涉及到从另一个表中复制行的操作

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

资源介绍

从另一个表中拷贝行 * SQL> INSERT INTO managers(id, name, salary, hiredate) 2 SELECT empno, ename, sal, hiredate 3 FROM emp 4 WHERE job = 'MANAGER'; 3 rows created. 创建带有子查询的 INSERT语句。 不要使用 VALUES 子句. 子查询中的列要与INSERT子句中的列相匹配. * Copying Rows from Another Table You can use the INSERT statement to add rows to a table where the values are derived from existing tables. In place of the VALUES clause, you use a subquery. Syntax INSERT INTO table [ column (, column) ] subquery; where: table is the table name column is the name of the column in the table to populate subquery is the subquery that returns rows into the table For more information, see Oracle Server SQL Reference, Release 8, “SELECT,” Subqueries section. The number of columns and their datatypes in the column list of the INSERT clause must match the number of values and their datatypes in the subquery. Instructor Note Please run the script lab9_12.sql to create the managers table. Do not get into too many details on copying rows from another table.