Create New Table by Selecting Data from Other Tables with CREATE TABLE AS Crear una nueva tabla de selección de datos de otras tablas con crear mesa 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. Mediante el uso de la manipulación de datos de SQL declaración, un nuevo temporal, copia de seguridad o regular el cuadro se pueden crear y llena o se inserta con datos de otro cuadro o cuadros recuperados por 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. La manipulación de datos SQL el lenguaje es CREATE TABLE AS que pueden utilizarse para crear una nueva tabla de contenidos construido de conjunto de resultados de una consulta en una tabla que ya existe dentro de la base de datos. Both the column types, and row data for the new table, come from the SELECT command specified by select. Ambos tipos de la columna, fila y datos para la nueva tabla, vienen de comando SELECT especificada por seleccionar.
CREATE TABLE AS has the following syntax or synopsis in simple form: CREATE TABLE AS tiene la siguiente sintaxis o sinopsis en forma sencilla:
CREATE TABLE new_table_name [ ( column [, ...] ) ] AS SELECT [ ( column [, ...] ) ] FROM existing table_name CREATE TABLE new_table_name [(columna [, ...])] AS SELECT [(columna [, ...])] DE existente table_name
The SELECT statement can be in a complex form where data is been retrieved from several tables. La sentencia SELECT pueden estar en una compleja forma que los datos se han recuperado de varias tablas. For the new table, column names can be specified by including the column names in a comma-delimited list. Para la nueva tabla, nombres de columna pueden especificarse mediante la inclusión de los nombres de columna en una coma-delimitada lista. 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. Punto muy importante a tener en cuenta es que debe haber el mismo número de columnas especificado en la lista de columnas anteriores a la cláusula AS (opcional, si se ha especificado) para la nueva tabla como el número de columnas objetivo que son devueltos por la sentencia 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: Si el facultativo lista de columnas en paréntesis de la nueva tabla contiene un número distinto de filas de las filas de la sentencia SELECT devuelve el siguiente mensaje de error se mostrará:
ERROR: CREATE TABLE/AS SELECT has mismatched column count ERROR: CREATE TABLE / AS SELECT tiene columnas coincidentes
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 . En su forma más simple, CREATE TABLE AS declaración se creará una copia de seguridad completa de una tabla existente entre ellos y todas las columnas de datos utilizando simplemente la declaración 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: Se trata de una máquina que traduzca la página se proporciona "tal cual" sin garantía. Machine translation may be difficult to understand. La traducción automática puede resultar difícil de entender. Please refer to Por favor, consulte original English article artículo original Inglés whenever possible. siempre que sea posible.
Share and contribute or get technical support and help at Compartir y contribuir o recibir apoyo técnico y ayudar a My Digital Life Forums Mi vida digital Foros .
Related Articles Artículos relacionados
- Easily Duplicate, Copy or Backup Tables in Oracle, PostgreSQL, DB2 and SQLite with Create Table As SQL Fácilmente duplicar, copiar o de copia de seguridad en los cuadros Oracle, PostgreSQL, DB2 y con SQLite Crear Tabla En SQL
- ORA-00942 Table or View Does Not Exist Oracle Error ORA-00942 tabla o vista no existe error de Oracle
- ORA-02449 Oracle Drop Table Error ORA-02449 Oracle caída cuadro de error
- Oracle ORA-14074 Create or Add New Partition Fails Error Oracle ORA-14074 crear o añadir nuevas particiones no error
- Create, Add or Split Oracle Database Partition Fails with ORA-14080 Error Crear, Añadir o base de datos Oracle Split partición falla con ORA-14080 Error
- Check and Optimize MySQL Database Automatically with Crontab/Cron Comprobar y optimizar automáticamente la base de datos MySQL con crontab / cron
- How to Backup and Restore (Export and Import) MySQL Databases Tutorial Como copia de seguridad y restaurar (exportaciones e importaciones) Bases de datos MySQL Tutorial
- SLIC Table (SLIC.BIN or ACPISLIC.BIN) BIOS File for OEMs Download Cuadro SLIC (SLIC.BIN o ACPISLIC.BIN) BIOS del archivo de descarga para OEMs
- Oracle EXP-00091 Error When Export Database Oracle EXP-00091 de error cuando la exportación de bases de datos
- Sun Table Transforms Solar Energy to Electricity to Power Up Home Appliances Sun mesa transforma la energía solar para electricidad su puesta en marcha de electrodomésticos





April 1st, 2007 03:26 1 de abril de 2007 03:26
We can do it also with the query, Podemos hacerlo también con la consulta,
SELECT * INTO newtable FROM existingtable SELECT * EN newtable DE existingtable
I think its a little bit shorter. Creo que es un poco más corto.
January 10th, 2008 13:31 10 de enero 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???? Los datos de la tabla que se crea utilizando la tabla como crear seleccione "es diferente de los datos que se muestra al seleccionar la misma que crea la tabla se ejecuta por separado?
WE are using the tool PL/SQL Developer . Estamos utilizando la herramienta PL / SQL Developer.
Any idea what this problem is due to? Cualquier idea de lo que este problema se debe a?