简体   繁体   English

在SQL中将数据从旧表复制到新表(ORACLE)

[英]Copying data from old table to new table in SQL (ORACLE)

I'm aware that copying data will only copy the data and no constraints, I'll lose my pk and fk etc. 我知道复制数据只会复制数据而没有约束,我会丢失pk和fk等。

But what if i were to copy the data back into a table with primary keys and foreign. 但是,如果我要将数据复制回具有主键和外键的表中,该怎么办? because i want to remodel my db on workbench but don't want to lose the data i have imput into my tables so i was thinking of making a copy deleting the original remodelling the db and forward engineering and copying the data back into the table will this work? 因为我想在工作台上重塑数据库,但又不想丢失输入到表中的数据,所以我在考虑制作一份副本,删除原来的重塑数据库,然后进行工程设计并将数据复制回到表中。这项工作?

Not sure if I gut your question right but from what it looks you only need a new table with the data to mass with. 不知道我是否正确回答了您的问题,但是从它的外观看,您只需要一个带有数据的新表即可。 have you tried using CREATE TABLE AS SELECT? 您是否尝试过使用CREATE TABLE AS SELECT?

http://dev.mysql.com/doc/refman/5.0/en/create-table-select.html http://dev.mysql.com/doc/refman/5.0/en/create-table-select.html

CREATE TABLE t AS SELECT * from old_t

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM