MySQL 使用查詢結果建立表

2021-05-28 12:00:21 字數 348 閱讀 7662

mysql不支援:

select * into new_table_name from old_table_name;

替代方法: 1

create table new_table_name (select * from old_table_name);

select * into new_table_name from old_table_name; 2

select *  into outfile 'a.txt' from table_name;

load data infile '/database/mysql/a.txt' into table new_table_name;

mysql中用查詢結果建立新錶

在mysql中可以把已經存在的表直接通過命令複製為另乙個表 方法1 create table mmm select from bbb 注意 這條命令要求mmm這個表在資料庫中不存在 這條命令可以建立新錶mmm並且bbb中的表結構以及資料和mmm完全一樣mysql insert,也可以匯出部分字段 c...

MySQL使用查詢結果生成臨時表

mysql中不支援對同乙個表使用其查詢結果更新or刪除本表內資料 也就是update或delete後的where條件為針對相同表的select 解決方案是建立臨時表做過度儲存中間資料 可以直接使用查詢結果來形成臨時表 sql create table tmp as select column1 as...

用Select查詢結果建立ACCESS表

create table as 由 sql 2003 標準宣告.查了access的文件發現沒有關於create table as 得解釋,應當是不支援。在access中用查詢結果建立表可以用select into來替代 實現。access的文件中是這麼說的 建立生成表查詢 生成表查詢 一種查詢 sq...