mysql - 插入临时表mysql
问题描述
select t.*
into #temp
from
(
select 'a' as a
union all
select 'b' as a
) as t
select * from #temp
drop table #temp
我通常在创建临时表的 SQL 服务器上执行此操作。语法“into #temp”在数据库上创建一个非物理表,而“into temp”将在数据库上创建一个物理表。
我在 MySQL 中的问题是转换上面的 MSSQL 语句。我想要创建的是一个不在数据库上物理创建的临时表。我们在 MySQL 中有这个功能吗?
解决方案
在 MySQL 中,您将使用create temporary table as
:
create temporary table temp as
select 'a' as a
union all
select 'b' as a ;
推荐阅读
- java - 动态分配给变量的类类型
- asp.net-core - 使用 DBContext ChangeTracker 编写基于事件的 SignalR 通知服务 - 关注点分离
- java - Java:在连续文件中创建和写入
- react-native - 用 reactNative 中的视图替换特定文本
- hive - 我的 hive 分区策略和视图策略应该是什么,这样查询才能在 10 秒内高效运行并返回结果
- bluetooth - 在适用于 IOS 和 ANDROID 的 Appcelerator Titan 中获取蓝牙访问权限
- triggers - 更新后触发:如何对更新的每一行执行查询
- java - Spring boot apache CXF 捕获soap错误并返回http错误码
- java - 扫描程序类 NoSuchElement 错误
- ember.js - 余烬纸和课堂?