Create New Table by Selecting Data from Other Tables with CREATE TABLE AS Izveidot jaunu tabulu, atlasot datus no citām tabulām ar 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. Izmantojot SQL datu manipulācijas paziņojumu, jauna, īslaicīga, rezerves vai regulāru tabulu var izveidot un piepildīt, vai iekļauj ar datiem no citas tabulas vai tabulu atgūt ar 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 datu manipulācijas valoda CREATE TABLE AS ko var izmantot, lai izveidotu jaunu tabulu būvēta no satura dēļ, ko vaicājumu uz galda, kas jau pastāv saskaņā datubāzē. Both the column types, and row data for the new table, come from the SELECT command specified by select. Gan kolonnu tipus, un rindu dati par jaunu tabulu, nāk no SELECT komandu, ko izvēlēties.
CREATE TABLE AS has the following syntax or synopsis in simple form: CREATE TABLE AS ir šādu sintaksi vai konspekts vienkāršā veidā:
CREATE TABLE new_table_name [ ( column [, ...] ) ] AS SELECT [ ( column [, ...] ) ] FROM existing table_name CREATE TABLE new_table_name [(kolonnā [...])] AS SELECT [(kolonnā [...])] no esošajiem table_name
The SELECT statement can be in a complex form where data is been retrieved from several tables. SELECT var būt sarežģīts veidā, ja dati ir iegūti no vairākām tabulām. For the new table, column names can be specified by including the column names in a comma-delimited list. Par jaunu tabulu, kolonnu nosaukumus var noteikt, ietverot kolonnu nosaukumus komatu atdalīts saraksts. 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. Ļoti svarīgs jautājums, ņemt vērā, ka vajadzētu būt pašu kolonnu skaits norādīts slejā sarakstā pirms AS klauzula (pēc izvēles, ja norādīta) jauno tabulu skaits mērķa kolonnas, kas tiek atgriezti ar SELECT. 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: Ja izvēles saraksts kolonnu iekavās jaunus galda satur dažādas rindu skaitu, nekā rindas SELECT atgriež, šāds kļūdas ziņojums tiek parādīts:
ERROR: CREATE TABLE/AS SELECT has mismatched column count ERROR: CREATE TABLE / AS SELECT ir nesakritības kolonnu skaits
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 . Vienkāršākajā veidā CREATE TABLE AS paziņojums radīs pilnīgu dublējumu esošo tabulu, kurā visas kolonnas un datus, vienkārši izmantojot paziņojumu CREATE TABLE new_table_name AS SELECT * FROM existing_table_name.
IMPORTANT : The page is machine translated and provided "as is" without warranty. SVARĪGI: lapa mašīna iztulkot un pasniegts tàds, "kàds tas ir" bez garantijas. Machine translation may be difficult to understand. Mašīntulkošanas var būt grūti saprast. Please refer to Lūdzu, skatiet original English article oriģināls angļu rakstu whenever possible. kad vien iespējams.
Related Articles Saistītie raksti
- Easily Duplicate, Copy or Backup Tables in Oracle, PostgreSQL, DB2 and SQLite with Create Table As SQL Viegli Dublēt, kopēšana vai Backup tabulu Oracle, PostgreSQL, DB2 un SQLite ar tabulas izveidošanai, SQL
- ORA-02449 Oracle Drop Table Error ORA-02.449 Oracle Drop tabula Kļūda
- ORA-00942 Table or View Does Not Exist Oracle Error ORA-00.942 tabulā vai View neeksistē Oracle Kļūda
- Create Business Graphics Via VizLytics Data Visualization Tool Izveidot Business Graphics Via VizLytics datu vizualizācijas rīks
- Oracle ORA-14074 Create or Add New Partition Fails Error Oracle ORA-14.074 izveidošana vai Add New Partition nav kļūda
- Crack and Hack to Find, Reveal, Get, Recover and Retrieve All Windows Passwords with Ophcrack 2 and Rainbow Tables Kreka un Hack atrast, atklāt, Get, atjaunot un atkal Ielādēt Visi Windows paroles ar 2 Ophcrack un Rainbow Tables
- SLIC Table (SLIC.BIN or ACPISLIC.BIN) BIOS File for OEMs Download SLIC Tabula (SLIC.BIN vai ACPISLIC.BIN) BIOS failu OEM Download
- PDFtoExcel Online Tool Extract PDF Tables to Excel Format PDFtoExcel Online Tool Extract PDF tabulā Excel formātā
- How to Show and Display IP Routing Table in Windows or Linux Kā Show un Displeja IP maršrutizācijas tabulu Windows vai Linux
- Create, Add or Split Oracle Database Partition Fails with ORA-14080 Error Izveidot, pievienošana vai Split Oracle Database Partition neizdodas, ORA-14.080 Kļūda










































September 5th, 2009 14:30 5 septembris 2009 14:30
Check your select statement again and shuffle the joining conditions in where clause. Pārbaudiet savu SELECT atkal un shuffle pievienošanās nosacījumiem kur klauzulu. No need to change but change the position. Nav nepieciešams mainīt, bet mainīt nostāju. Try to equate id's first and contants latter. Mēģināt pielīdzināt id pirmā un contants pēdējām. Hope this will solve your problem. Ceru, ka tas atrisinās Jūsu problēmu.
January 28th, 2009 17:46 Janvāris 28, 2009 17:46
CREATE TABLE new_table_name [ ( column [, ...] ) ] AS SELECT [ ( column [, ...] ) ] FROM existing table_name CREATE TABLE new_table_name [(kolonnā [...])] AS SELECT [(kolonnā [...])] no esošajiem table_name
this query possible in MS-ACCESS or not iespējams šo vaicājumu MS-ACCESS vai ne
January 10th, 2008 13:31 Janvāris 10, 2008 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???? Dati tabulā, kas izveidots, izmantojot tabulas izveidošanai, kā izvēlēties "atšķiras no datiem, kas tiek atgriezta, ja pats izvēlēties, kas rada galda tiek izpildīts atsevišķi??
WE are using the tool PL/SQL Developer . Mēs esam izmantojot rīku PL / SQL Developer.
Any idea what this problem is due to? Jebkuru ideju, ko šī problēma ir saistīta ar?
April 1st, 2007 03:26 1 aprīlis 2007 03:26
We can do it also with the query, Mēs varam darīt arī ar vaicājumu,
SELECT * INTO newtable FROM existingtable SELECT * INTO newtable NO existingtable
I think its a little bit shorter. Es domāju, ka tā nedaudz īsāks.