
- 類型:數(shù)據(jù)庫(kù)類大。1.7M語(yǔ)言:英文 評(píng)分:6.6
- 標(biāo)簽:
幾個(gè)簡(jiǎn)單的MYsql命令,數(shù)據(jù)表方面的,收藏自用.
1、只拷貝表結(jié)構(gòu),不拷貝數(shù)據(jù)
select * into b from a where 1<>1;
2、表數(shù)據(jù)遷移 表b已經(jīng)存在:
insert into b (d, e, f) select a, b, c from a;
表b原先不存在:
create table b (select a, b, c from a);
3、創(chuàng)建臨時(shí)表
創(chuàng)建臨時(shí)表的語(yǔ)法很簡(jiǎn)單,臨時(shí)表存在內(nèi)存中,會(huì)話結(jié)束即消失:
create temporary table a (...);
4、創(chuàng)建視圖
視圖屬于數(shù)據(jù)庫(kù):
create view test.myView as select a, b from a;