数据库-临时表和复制表

1、临时表

  • 用来保存临时数据
  • 只在当前连接可见,关闭连接后被释放
  • 使用show  tables 无法显示出临时表

2、创建临时表

     create  temporary  tables  s_temp(

      id int,

      s_name  varchar(11)

);

3、复制表

  1. show  create  table  表名;
  2. 将结果集复制到【新建】页面中,即可
  • 查看表结构:show  create  table  表名;
  • 创建相同结构表:s_temp
  • 使用create  talbe···select

4、模板建表

  • 只复制表结构

           create  table  表2  like  表1;

  • 复制表结构和表数据

            create  table  表2  as  select  *  from  表1;

猜你喜欢

转载自blog.csdn.net/weixin_36290500/article/details/83118654
今日推荐