将表结构复制到新表中 [英] Copy table structure into new table

查看:69
本文介绍了将表结构复制到新表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以将表的结构复制到没有数据的新表中,包括所有键和约束?

Is there a way to copy the structure of a table into a new table, without data, including all keys and constraints?

推荐答案

对于简单的模式副本,请使用like子句。

For a simple schema copy use the like clause.

CREATE TABLE new_table_name ( like old_table_name including all)

这篇关于将表结构复制到新表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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