How to copy table between two models in Mysql workbench?

后端 未结 9 1950
小鲜肉
小鲜肉 2020-12-28 14:42

I am doing some databese thing, I need copy one table from one model to another, but i try many ways there no effect. Is there any way for doing this?

9条回答
  •  一向
    一向 (楼主)
    2020-12-28 15:24

    You can just use a select statement. Here I am creating a duplicate of "original_table" table from the "original_schema" schema/database to the "new_schema" schema :

    CREATE TABLE new_schema.duplicate_table AS
    Select * from original_schema.original_table;
    

    You can just put any select statement you need ,add a condition and select the columns :

    CREATE TABLE new_schema.duplicate_table AS
    SELECT column1, column2       
    FROM original_schema.original_table
    WHERE column2 < 11000000;
    

提交回复
热议问题