从另一个表中拷贝行-SQL语言基础

时间:2021-04-25 19:38:25
【文件属性】:
文件名称:从另一个表中拷贝行-SQL语言基础
文件大小:5.26MB
文件格式:PPT
更新时间:2021-04-25 19:38:25
SQL 基础 从另一个表中拷贝行 * 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.

网友评论