MySQL中create table as 与like的区别分析
2017-03-28 14:13
495 查看
这篇文章主要介绍了MySQL中create table as 与like的区别,结合实例分析了二者在使用中的具体区别与主要用途,需要的朋友可以参考下,具体如下:
对于mysql的复制相同表结构方法,有create table as 和create table like 两种,区别是什么呢?
代码如下:
create table t2 as select * from t1 where 1=2;
as创建出来的t2表(新表)缺少t1表(源表)的索引信息,只有表结构相同,没有索引。
代码如下:
create table t2 like t1 ;
like 创建出来的新表包含源表的完整表结构和索引信息
二者的用途:
as用来创建相同表结构并复制源表数据
like用来创建完整表结构和全部索引
oracle支持as,也是只有表结构没有索引
oracle不支持like。
Thanks!!!
对于mysql的复制相同表结构方法,有create table as 和create table like 两种,区别是什么呢?
代码如下:
create table t2 as select * from t1 where 1=2;
as创建出来的t2表(新表)缺少t1表(源表)的索引信息,只有表结构相同,没有索引。
代码如下:
create table t2 like t1 ;
like 创建出来的新表包含源表的完整表结构和索引信息
二者的用途:
as用来创建相同表结构并复制源表数据
like用来创建完整表结构和全部索引
oracle支持as,也是只有表结构没有索引
oracle不支持like。
Thanks!!!
相关文章推荐
- MySQL中create table as 与like的区别分析
- MySQL的create table as 与 like区别(转)
- MySQL的create table as 与 like区别
- mysql复制表结构create table as和like的区别
- MySQL的create table as 与 like区别
- Mysql create table tb as select 和create table tb like的区别
- MySQL create table as 与 like区别
- mysql复制表结构create table as和like的区别
- MySQL中表结构复制:create table like 与 create table as
- MySQL中表复制:create table like 与 create table as select
- MySQL中表复制:create table like 与 create table as select
- MySQL 5.6 create table like 同步异常问题分析与总结
- create table tb as select 和create table tb like的区别
- MySQL中表复制:create table like 与 create table as select
- mysql表复制create table like和create table as比较
- MySQL中表复制:create table like 与 create table as select
- mysql表复制create table like和create table as比较
- MySQL中表复制:create table like 与 create table as select
- MySQL的create table as 与 like区别
- postgres create table as select & create table like