Mysql多表创建

发布于 2024-12-17 14:34:17 字数 44 浏览 2 评论 0原文

是否有可能在一个 mysql 查询中执行多个 CREATE TABLE ?

Is there a possibility to execute multiple CREATE TABLE within one mysql query?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

权谋诡计 2024-12-24 14:34:17

不可以。您必须在多个查询中执行这些操作。

<不正确>但是,您可以将创建查询包装在 事务允许您在失败时回滚整个操作。

更新:好的,正如 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文