MySQL中createtableas與like的區(qū)別分析_MySQL
來源:懂視網(wǎng)
責編:小采
時間:2020-11-09 20:17:38
MySQL中createtableas與like的區(qū)別分析_MySQL
MySQL中createtableas與like的區(qū)別分析_MySQL:本文分析了MySQL中create table as 與like的區(qū)別。分享給大家供大家參考,具體如下: 對于mysql的復制相同表結(jié)構(gòu)方法,有create table as 和create table like 兩種,區(qū)別是什么呢? 代碼如下:create table t2 as select * f
導讀MySQL中createtableas與like的區(qū)別分析_MySQL:本文分析了MySQL中create table as 與like的區(qū)別。分享給大家供大家參考,具體如下: 對于mysql的復制相同表結(jié)構(gòu)方法,有create table as 和create table like 兩種,區(qū)別是什么呢? 代碼如下:create table t2 as select * f

本文分析了MySQL中create table as 與like的區(qū)別。分享給大家供大家參考,具體如下:
對于mysql的復制相同表結(jié)構(gòu)方法,有create table as 和create table like 兩種,區(qū)別是什么呢?
代碼如下:
create table t2 as select * from t1 where 1=2;
或者
代碼如下:
limit 0;
as創(chuàng)建出來的t2表(新表)缺少t1表(源表)的索引信息,只有表結(jié)構(gòu)相同,沒有索引。
代碼如下:
create table t2 like t1 ;
like 創(chuàng)建出來的新表包含源表的完整表結(jié)構(gòu)和索引信息
二者的用途:
as用來創(chuàng)建相同表結(jié)構(gòu)并復制源表數(shù)據(jù)
like用來創(chuàng)建完整表結(jié)構(gòu)和全部索引
oracle支持as,也是只有表結(jié)構(gòu)沒有索引
oracle不支持like。
希望本文所述對大家MySQL數(shù)據(jù)庫設(shè)計有所幫助。
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
MySQL中createtableas與like的區(qū)別分析_MySQL
MySQL中createtableas與like的區(qū)別分析_MySQL:本文分析了MySQL中create table as 與like的區(qū)別。分享給大家供大家參考,具體如下: 對于mysql的復制相同表結(jié)構(gòu)方法,有create table as 和create table like 兩種,區(qū)別是什么呢? 代碼如下:create table t2 as select * f