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

本文分析了MySQL中create table as 與like的區別。分享給大家供大家參考,具體如下:
對于mysql的復制相同表結構方法,有create table as 和create table like 兩種,區別是什么呢?
代碼如下:create table t2 as select * from t1 where 1=2;或者 代碼如下:limit 0;
as創建出來的t2表(新表)缺少t1表(源表)的索引信息,只有表結構相同,沒有索引。
代碼如下:create table t2 like t1 ;
like 創建出來的新表包含源表的完整表結構和索引信息
二者的用途:
as用來創建相同表結構并復制源表數據
like用來創建完整表結構和全部索引
oracle支持as,也是只有表結構沒有索引
oracle不支持like。
希望本文所述對大家MySQL數據庫設計有所幫助。
您可能感興趣的文章:
MySQL中表復制:create table like 與 create table as selectmysql模糊查詢like和regexp小結MySQL Like語句的使用方法mysql like查詢字符串示例語句mysql正則表達式 LIKE 通配符MySQL中VARCHAR與CHAR格式數據的區別Mysql存儲引擎InnoDB和Myisam的六大區別
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
MySQL中createtableas與like的區別分析
MySQL中createtableas與like的區別分析:本文分析了MySQL中create table as 與like的區別。分享給大家供大家參考,具體如下: 對于mysql的復制相同表結構方法,有create table as 和create table like 兩種,區別是什么呢? 代碼如下:create table t2 as select * f