create table ,create table as 与create like三种建表方式的使用详解

a、create table like方式会完整地克隆表结构,但不会插入数据,需要单独使用insert into或load data方式加载数据
b、create table as  方式会部分克隆表结构,完整保留数据
c、create table as select .. where 1=0 会克隆部分表结构,但不克隆数据。
d、如果启用了gtid,create table as方式不被支持。收到ERROR 1786 (HY000): CREATE TABLE ... SELECT is forbidden when @@GLOBAL.ENFORCE_GTID_CONSISTENCY = 1.

posted on 2019-08-08 10:11  王玉琪6688  阅读(1992)  评论(0编辑  收藏  举报

导航