Handling tables between different databases
To duplicate a table, we can do several things:
Copy only the structure :
SELECT * Into <DestinationTableName>
From <SourceTableName>
Where 1 = 2
Either make an exact duplicate of it:
SELECT * INTO <MyNewTable>
FROM <MyTable>
with the exception that, constraints or indexes will not be copied.
To send a table from a BD_1 to BD_2 , cut and paste :
RENAME TABLE <bd_1.tabla> to <bd_2.tabla_copia>
Note : Remove the table from BD_1
Create a table in the destination DB and store the tuples of the table contained in the source DB:
CREATE TABLE <BD_destino>.<nombre_tabla_copiada>
SELECT * FROM <BD_origen>.<tabla>
Note : Do not delete the table from the Source DB
Create a table in the destination DB and copy the structure but it will not store the tuples of the table contained in the source DB:
CREATE TABLE <BD_destino>.<nombre_tabla_copiada>
LIKE <BD_origen>.<tabla>