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.


4 Responses to “Create New Table by Selecting Data from Other Tables with CREATE TABLE AS” 4 Atbildes uz "Izveidot jaunu tabulu, atlasot datus no citām tabulām ar CREATE TABLE AS"

  1. Imran Aziz Khan Imran Aziz Khan
    September 5th, 2009 14:30 5 septembris 2009 14:30
    4 4

    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.

  2. Dinesh Dinesh
    January 28th, 2009 17:46 Janvāris 28, 2009 17:46
    3 3

    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

  3. tariq Tariq
    January 10th, 2008 13:31 Janvāris 10, 2008 13:31
    2 2

    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?

  4. ikarus Ikarus
    April 1st, 2007 03:26 1 aprīlis 2007 03:26
    1 1

    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.

Leave a Reply Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> Jūs varat izmantot šos tagus: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. Parakstīties uz komentāriem iezīme ir atspējota. To receive notification of latest comments posted, subscribe to Saņemt informāciju par jaunāko komentārus, parakstīties uz My Digital Life Comments RSS feed Mana Digital Life Comments RSS feed or vai register to receive reģistrēties, lai saņemtu new comments in daily email digest. jauni komentāri ikdienas e-pasta sagremot.
Custom Search

New Articles Jauns pants

Incoming Search Terms for the Article Ienākošo Meklēt noteikumi pants

create table as select izveidot tabulu, izvēlieties - -- create table select tabulas izveidošanai izvēlētos - -- create table as select from izveidot tabulu, izvēlieties no - -- create table with select izveidot tabulu ar izv - -- create table from select izveidot tabulu no izv - -- db2 create table as select DB2 izveidot tabulu, izvēlieties - -- create table from select statement izveidot tabulu no SELECT - -- create table select from tabulas izveidošanai izvēlieties no - -- db2 create table from select DB2 izveidot tabulu no izv - -- create new table izveidot jaunu tabulu - -- access create table piekļuve tabulas izveidošanai - -- create table as select DB2 izveidot tabulu, atlasiet DB2 - -- select create table Izvēlieties tabulas izveidošanai - -- db2 create table select DB2 tabulas izveidošanai izvēlētos - -- create table as select izveidot tabulu, izvēlieties - -- CREATE TABLE USING SELECT STATEMENT CREATE TABLE izmantojot SELECT STATEMENT - -- create table with data izveidot tabulu ar datiem - -- db2 create table as DB2 izveidot tabulu, - -- oracle select into new table Oracle izvēlēties jaunu tabulu - -- all viss - -- create table select into tabulas izveidošanai izvēlieties vērā - -- create table select tabulas izveidošanai izvēlētos - -- create a data table izveidot datu tabula - -- create table into izveidot tabulu - -- MS Access Create table as select MS Access Izveidot tabulu, izvēlieties - -- create table as select in db2 izveidot tabulu, atlasiet in DB2 - -- access create table as select piekļuve izveidot tabulu, izvēlieties - -- create table as select ms access izveidot tabulu, atlasiet MS Access - -- MS ACCESS CREATE TABLE SELECT MS Access CREATE TABLE SELECT - -- sqlite create table as select SQLite izveidot tabulu, izvēlieties - -- create table select db2 tabulas izveidošanai izvēlieties DB2 - -- access create table select piekļuve tabulas izveidošanai izvēlētos - -- db2 create table from another table DB2 izveidot tabulu no citas tabulas - -- sql create table from select statement sql tabulas izveidošanai no SELECT - -- Creating tables thru union query in MS access + select into Veidojot tabulu ar savienība vaicājumu MS Access + izv vērā - -- oracle create table as select Oracle izveidot tabulu, izvēlieties - -- create table access izveidot tabulu pieeja - -- create table+select tabulas izveidošanai + izv - -- how to create a data table Kā izveidot datu tabulu - -- create table using select tabulas izveidošanai izmantojot izv - -- CREATE TABLE SELECT ACCESS CREATE TABLE SELECT ACCESS - -- create table with data from another table izveidot tabulu ar datiem no citas tabulas - -- create table select as tabulas izveidošanai izvēlēties kā - -- create table from existing table in Db2 tabulas izveidošanai no esošās tabulas DB2 - -- create table as select access izveidot tabulu, izvēlieties piekļuves - -- SQL Insert table data via select statement SQL Insert table datus, izmantojot SELECT - -- access create table from select piekļuve izveidot tabulu no izv - -- oracle create backup table Oracle izveidot rezerves tabula - -- db2 create table as select from DB2 izveidot tabulu, izvēlieties no - -- db2 create table as select * from DB2 izveidot tabulu SELECT * FROM - -- create table (select tabulas izveidošanai (select - -- select into new table oracle Izvēlieties jaunu tabulu Oracle - -- create table from another table in db2 izveidot tabulu no citas tabulas DB2 - -- create table using select db2 tabulas izveidošanai izmantojot izv DB2 - -- access create table as piekļuve izveidot tabulu, - -- oracle create table backup Oracle tabulas izveidošanai rezerves - -- create table as (select izveidot tabulu, (select - -- create backup table sql izveidot rezerves galda sql - -- create table from select izveidot tabulu no izv - -- create table from select statement oracle izveidot tabulu no SELECT Oracle - -- create table with select izveidot tabulu ar izv - -- ms access create table from select MS Access tabulas izveidošanai no izv - -- db2 create table as DB2 izveidot tabulu, - -- oracle create table select Oracle tabulas izveidošanai izvēlētos - -- microsoft access create table as select Microsoft Access izveidot tabulu, izvēlieties - -- create table another table db2 tabulas izveidošanai citā tabulā DB2 - -- CREATE TABLE INTO SELECT CREATE TABLE INTO SELECT - -- make a data table online veikt datu tabula online - -- create data table izveidot datu tabula - -- CREATE TABLE AS SELECT ORACLE CREATE TABLE AS SELECT ORACLE - -- create table + select tabulas izveidošanai + izv - -- create a backup table in SQL izveidot rezerves tabulu SQL - -- create a table from select statement izveidot tabulu no SELECT - -- create table from other table izveidot tabulu no citas tabulas - -- create backup table in sql izveidot rezerves tabulas sql - --