Create New Table by Selecting Data from Other Tables with CREATE TABLE AS创建新的表选取的数据来自其他表,创建表
By using SQL data manipulation statement, a new, temporary, backup or regular table can be created and filled or inserted with data from another table or tables retrieved by SELECT statement.使用SQL数据操作声明中,一个新的,暂时的,备份或定期表可以创建和填充或插入数据从另一个表或表格检索SELECT语句。 The SQL data manipulation language is CREATE TABLE AS which can be used to create a new table built from contents of result set by a query on a table that already exists within the database.在SQL数据操纵语言是建立表,可用于创建一个新表从内容建设的结果集的查询表上已经存在的数据库。 Both the column types, and row data for the new table, come from the SELECT command specified by select.这两种类型的列,并连续数据的新表中,来自选择的命令所指明的选择。
CREATE TABLE AS has the following syntax or synopsis in simple form:创建表具有下列语法或大纲在简单的形式:
CREATE TABLE new_table_name [ ( column [, ...] ) ] AS SELECT [ ( column [, ...] ) ] FROM existing table_name创建表new_table_name [ (栏[ , ... ] ) ]精选[ (栏[ , ... ] ) ] 从现有table_name
The SELECT statement can be in a complex form where data is been retrieved from several tables. SELECT语句可以是一个复杂的形式下得到的数据是从几个检索表。 For the new table, column names can be specified by including the column names in a comma-delimited list.对于新的表,列的名称可以被指定的包括列名在一个逗号分隔的列表。 Very important point to take note is that there should be the same number of columns specified in the column list preceding the AS clause (optional, if specified) for new table as the number of target columns that are returned by the select statement.很重要的一点注意的是,应该有相同数目的列中指定的列清单作为前条第(可选,如果指定的话)的新表的人数指标列返回的选择发言。 If the optional list of columns in parentheses of new table contains different number of rows than the rows the SELECT statement returns, the following error message will be displayed:如果可选的清单栏括号中的新表中包含不同的行数比列的SELECT语句返回,下面的错误信息会显示:
ERROR: CREATE TABLE/AS SELECT has mismatched column count错误:创建表/精选了不匹配的列计数
In its simplest form, CREATE TABLE AS statement will create a complete backup of an existing table including all columns and data simply by using the statement CREATE TABLE new_table_name AS SELECT * FROM existing_table_name .最简单的形式,创建表的声明将建立一个完整的数据备份现有的表包括所有数据列和使用简单的声明创建表new_table_name选定*从existing_table_name 。
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要说明:这是一台机器翻译网页这是“原样”提供,无保修。 Machine translation may be difficult to understand.机器翻译可能很难理解。 Please refer to请参阅 original English article英文原文的文章 whenever possible.只要有可能。
Share and contribute or get technical support and help at共享和贡献或获得技术支持和帮助 My Digital Life Forums 我的数字生活论坛 . 。
Related Articles相关文章
- Easily Duplicate, Copy or Backup Tables in Oracle, PostgreSQL, DB2 and SQLite with Create Table As SQL很容易复制,拷贝或备份表在Oracle和PostgreSQL , DB2和SQLite与创建表的SQL
- ORA-00942 Table or View Does Not Exist Oracle Error奥拉- 00942表或视图不存在Oracle错误
- ORA-02449 Oracle Drop Table Error口腔02449甲骨文下降表误差
- Oracle ORA-14074 Create or Add New Partition Fails Error甲骨文口腔14074创设或增加新的分区失败的错误
- Crack and Hack to Find, Reveal, Get, Recover and Retrieve All Windows Passwords with Ophcrack 2 and Rainbow Tables裂纹和哈克寻找,发现,获取,恢复和检索所有的Windows密码与Ophcrack 2和彩虹表
- Create, Add or Split Oracle Database Partition Fails with ORA-14080 Error创建,添加或分裂甲骨文数据库划分失败与口腔14080错误
- SLIC Table (SLIC.BIN or ACPISLIC.BIN) BIOS File for OEMs Download SLIC表( SLIC.BIN或ACPISLIC.BIN )的BIOS文件为OEM下载
- Recover Lost Data with Unistal Data Recovery恢复丢失的数据与数据恢复Unistal
- Oracle PL/SQL ORA-00947 Not Enough Values Error甲骨文特等/数据库口腔00947不够值误差
- Data Recovery and Data Protection via Undelete 2009数据恢复和数据保护通过取消2009年

































April 1st, 2007 03:26 2007年4月1号3点26分
We can do it also with the query,我们可以做到这一点也与查询,
SELECT * INTO newtable FROM existingtable选择*导入newtable从existingtable
I think its a little bit shorter.我认为它有点短。
January 10th, 2008 13:31 2008年1月10号13:31
Data in the table that is created using create table as select” is different from the data that is returned when the same select that creates the table is executed separately????数据表中创建使用创建表,选择“是不同的数据,返回时同样的选择,创造的表单独执行? ? ? ?
WE are using the tool PL/SQL Developer .我们正在使用的工具特等/数据库开发人员。
Any idea what this problem is due to?任何知道这个问题是因为?