mysql怎么将查询结果导入临时表

mysql怎么将查询结果导入临时表,第1张

2种方法

第一种,建立正式的表,此表可供你反复查询

drop table if exists a_temp

create table a_temp as

select 表字段名旁扮称雀启纳 from 表名称

第二种,建立临时表,此表可供你当次链接的 *** 作里查询.

create temporary table 临时表名称

select 表字段名称 from 表名顷没称

插入悔旅旅的方式有多种,下面介绍常用的2种:

先不声明,直镇和接在SQL中插入,SQL 如下:

select test into #Temp from table

查碧凳询完成,记得drop table #temp

第二中,先创建临时表,SQL 如下:

create table #Temp (Test nvarchar(50))

insert into #temp  select test from table


欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/bake/11983622.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-20
下一篇 2023-05-20

发表评论

登录后才能评论

评论列表(0条)

保存