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.都柱的類型,和行數據為新表,來自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創建或添加新的分區失敗的錯誤
- Create, Add or Split Oracle Database Partition Fails with ORA-14080 Error創建,添加或分裂Oracle數據庫分區失敗,庫存- 14080錯誤
- Check and Optimize MySQL Database Automatically with Crontab/Cron檢查和優化MySQL數據庫自動與crontab /玉米
- How to Backup and Restore (Export and Import) MySQL Databases Tutorial如何備份和恢復(出口和進口)的MySQL數據庫補習
- SLIC Table (SLIC.BIN or ACPISLIC.BIN) BIOS File for OEMs Download slic表( slic.bin或acpislic.bin )的BIOS文件,為OEM廠商下載
- Oracle EXP-00091 Error When Export Database甲骨文進出口- 00091時發生錯誤,進出口數據庫
- Sun Table Transforms Solar Energy to Electricity to Power Up Home Appliances孫表變換太陽能電力,電力家電



















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 .我們正在使用的工具, PL / SQL的開發。
Any idea what this problem is due to?任何的想法是什麼這個問題是由於?