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 .
Related Articles Artigos relacionados
- Easily Duplicate, Copy or Backup Tables in Oracle, PostgreSQL, DB2 and SQLite with Create Table As SQL Facilmente duplicar, copiar ou fazer backup Quadros em Oracle, PostgreSQL, e DB2 com SQLite Como Criar tabela SQL
- ORA-00942 Table or View Does Not Exist Oracle Error ORA-00942 Ver tabela ou não existe erro Oracle
- ORA-02449 Oracle Drop Table Error ORA-02449 Oracle gota tabela erro
- Oracle ORA-14074 Create or Add New Partition Fails Error Oracle ORA-14074 criar ou adicionar novas partições falhar erro
- Create, Add or Split Oracle Database Partition Fails with ORA-14080 Error Criar, Adicionar ou Split Oracle Database Partição falhe com Erro ORA-14080
- Check and Optimize MySQL Database Automatically with Crontab/Cron Verificar e otimizar automaticamente com o banco de dados MySQL crontab / cron
- How to Backup and Restore (Export and Import) MySQL Databases Tutorial Como a Backup e Restauração (de Importação e Exportação) Bancos de dados MySQL Tutorial
- SLIC Table (SLIC.BIN or ACPISLIC.BIN) BIOS File for OEMs Download SLIC Quadro (SLIC.BIN ou ACPISLIC.BIN) BIOS File Download para OEMs
- Oracle EXP-00091 Error When Export Database Oracle EXP-00091 erro ao exportar Database
- Sun Table Transforms Solar Energy to Electricity to Power Up Home Appliances Sun tabela transforma a energia solar para a electricidade a potência até eletrodomésticos

































April 1st, 2007 03:26 1 de abril de 2007 03:26
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.
January 10th, 2008 13:31 10 de janeiro de 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???? 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?