Mysql
 sql >> Base de données >  >> RDS >> Mysql

Comment déclarer une table interne dans MySQL ?

create temporary table tmp
(
id int unsigned not null,
name varchar(32) not null
)
engine=memory; -- change engine type if required e.g myisam/innodb

insert into tmp (id, name) select id, name from foo... ;

-- do more work...

select * from tmp order by id;

drop temporary table if exists tmp;

ou

create temporary table tmp engine=memory select id, name from foo... ;

-- do more work...

select * from tmp order by id;

drop temporary table if exists tmp;