Create New Table by Selecting Data from Other Tables with CREATE TABLE AS Criar uma nova tabela, selecionando dados de outras tabelas com criar tabela como

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. Ao usar dados SQL manipulação declaração, uma nova e temporária, backup ou regular tabela podem ser criados e preenchidos com os dados inseridos ou de outra tabela ou tabelas recuperadas pelo 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. A linguagem é manipulação dados SQL CREATE TABLE AS, que pode ser usado para criar uma nova tabela construída a partir de conteúdos do resultado fixado por uma consulta em uma tabela que já existe no banco de dados. Both the column types, and row data for the new table, come from the SELECT command specified by select. Ambos os tipos de coluna, ea linha de dados para o novo quadro, provêm do SELECT comando especificado pela escolha.

CREATE TABLE AS has the following syntax or synopsis in simple form: CREATE TABLE AS tem a seguinte sintaxe ou sinopse de forma simples:

CREATE TABLE new_table_name [ ( column [, ...] ) ] AS SELECT [ ( column [, ...] ) ] FROM existing table_name CREATE TABLE new_table_name [(coluna [, ...])] AS SELECT [(coluna [, ...])] FROM table_name existentes

The SELECT statement can be in a complex form where data is been retrieved from several tables. A declaração pode ser SELECT complexas em um formulário onde foram extraídos os dados são provenientes de diversos quadros. For the new table, column names can be specified by including the column names in a comma-delimited list. Para o novo quadro, coluna pode ser especificado por nomes, incluindo os nomes das colunas em uma lista delimitada-vírgula. 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. Ponto muito importante a tomar nota é que deveria haver o mesmo número de colunas especificado na lista da coluna que precede a cláusula AS (opcional, se especificado) para a nova tabela como alvo o número de colunas que são retornados pelo 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: Se a lista de opcionais, entre parênteses e colunas da nova tabela contém um número diferente de linhas do que as linhas da declaração SELECT retorna, com a seguinte mensagem de erro será exibida:

ERROR: CREATE TABLE/AS SELECT has mismatched column count ERRO: CREATE TABLE / AS SELECT tem adaptado coluna contar

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 . Na sua forma mais simples, como declaração CREATE TABLE irá criar um backup completo de uma tabela existente, incluindo todas as colunas e os dados simplesmente usando a declaração CREATE TABLE new_table_name AS SELECT * FROM existing_table_name.

IMPORTANT : This is a machine translated page which is provided "as is" without warranty. IMPORTANTE: Esta é uma página traduzida máquina que é fornecida "como está" sem garantia. Machine translation may be difficult to understand. A tradução automática pode ser difícil de compreender. Please refer to Por favor, consulte a original English article Inglês original article whenever possible. sempre que possível.

Share and contribute or get technical support and help at Compartilhe e contribuir ou obter suporte técnico e ajudar a My Digital Life Forums Minha vida digital Fóruns .



2 Responses to “Create New Table by Selecting Data from Other Tables with CREATE TABLE AS” 2 Responses para "Criar uma nova tabela com Selecionando dados de outros quadros com CREATE TABLE AS"

  1. ikarus
    April 1st, 2007 03:26 1 de abril de 2007 03:26
    1

    We can do it also with the query, Podemos fazê-lo também com a consulta,

    SELECT * INTO newtable FROM existingtable INTO newtable SELECT * FROM existingtable

    I think its a little bit shorter. Acho um pouco a sua mais curto.

  2. tariq Tariq
    January 10th, 2008 13:31 10 de janeiro de 2008 13:31
    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???? Os dados na tabela que é criada usando criar tabela como selecionar "é diferente a partir dos dados que é retornado quando a mesma seleção que cria a tabela é executada em separado?
    WE are using the tool PL/SQL Developer . Estamos usando a ferramenta PL / SQL Developer.
    Any idea what this problem is due to? Qualquer ideia do que é devido a este problema?

Leave a Reply Deixe uma resposta

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> Você pode usar estas tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q Cite=""> <strike> <strong>

Subscribe without commenting Subscreva sem comentar


Custom Search

New Articles Novos Artigos

Incoming Search Terms for the Article Incoming Termos de pesquisa para o artigo

create table as select criar tabela como selecionar - -- create table select criar tabela selecionar - -- create table from select criar tabela de escolha - -- create new table criar uma nova tabela - -- DB2 create table as select DB2 criar tabela como selecionar - -- make a new section on myspace fazer uma nova secção no myspace - -- create table with select criar tabela com selecionar - -- create table select criar tabela selecionar - -- db2 create table as DB2 como criar tabela - -- create table from select statement criar tabela de selecionar declaração - -- create table as select criar tabela como selecionar - -- new table myspace nova tabela MySpace - -- create table as select access criar tabela como selecionar acesso - -- how to make a new section on myspace como fazer uma nova secção no myspace - -- Create table using select Criar uma tabela utilizando selecionar - -- oracle create table as select Oracle cria tabela como selecionar - -- create table select access criar tabela selecionar acesso - -- db2 create table from select DB2 criar tabela de escolha - -- db2 create table select DB2 criar tabela selecionar - -- access create table as select acesso criar tabela como selecionar - -- access create table select acesso criar tabela selecionar - -- new section on myspace nova secção no MySpace - -- oracle create table select Oracle cria tabela selecionar - -- create table as select db2 criar tabela como selecionar DB2 - -- create table from other tables criar tabela de outros quadros - -- create table with data criar tabela com dados - -- myspace create new table MySpace criar nova tabela - -- DB2 create table from another table DB2 criar tabela de outra tabela - -- create new myspace table criar uma nova tabela MySpace - -- ORACLE CREATE TABLE SELECT * FROM ORACLE criar tabela SELECT * FROM - -- create table from select * criar tabela de selecionar * - -- access create table from select acesso criar tabela de escolha - -- create table select as criar tabela como selecionar - -- add new section on myspace adicionar nova secção no MySpace - -- create table select db2 criar tabela selecione DB2 - -- access create table as acesso criar tabela como - -- myspace new table MySpace nova tabela - -- CREATE TABLE AS SELECT IN ACCESS Criará SELECIONAR tabela como no acesso - -- create table select from criar tabela de escolha - -- create table from another table in db2 criar tabela de outra tabela em db2 - -- create a table in myspace criar uma tabela no MySpace - -- create table as select oracle criar tabela como seleccionar Oracle - -- create table from other table criar outra tabela de mesa - -- make another table on myspace fazer outra tabela no MySpace - -- ms access create table select ms acesso criar tabela selecionar - -- create new section criar uma nova secção - -- oracle create table from select Oracle cria quadro de selecionar - -- create table with select statement criar tabela com selecionar declaração - -- create new table from existing table in oracle criar uma nova tabela de tabela existente no oracle - -- add tables myspace adicionar tabelas MySpace - --