Mysql多表创建
是否有可能在一个 mysql 查询中执行多个 CREATE TABLE ?
Is there a possibility to execute multiple CREATE TABLE
within one mysql query?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
是否有可能在一个 mysql 查询中执行多个 CREATE TABLE ?
Is there a possibility to execute multiple CREATE TABLE
within one mysql query?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
不可以。您必须在多个查询中执行这些操作。
<不正确>
但是,您可以将创建查询包装在 事务允许您在失败时回滚整个操作。更新:好的,正如 pilcrow 指出的那样,每个创建都会导致隐式提交,所以你不能为此使用事务。但是,您可以将插入(用于备份恢复)包装在事务中。
No. You must do them in multiple queries.
<incorrect>
However, you can wrap the creation queries in a transaction to allow you to roll back the entire operation if something fails.</incorrect>
UPDATE: Ok, as pilcrow points out, each create causes an implicit commit, so you can't use transactions for this. You can, however, wrap the inserts (for a backup restore) in transactions.