MySQL-重复表格 [英] MySQL - Duplicate table

查看:68
本文介绍了MySQL-重复表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在MySQL中复制一个表,使新表为空.也就是说,我只需要将现有表的结构复制到新表中即可.

I need to duplicate a table in MySQL, making the new table empty. That is, I need to copy only the structure of an existing table to a new one.

推荐答案

尝试使用create table LIKE语法.

Try the create table LIKE syntax.

create table users2 like users; 

这应该为您提供一个空表(users2),其结构与原始表(用户)相同.

This should give you an empty table (users2) with the same structure as the original (users).

这篇关于MySQL-重复表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆