0

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

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

No, you cannot ROLLBACK multiple table creation statements — like many DDL statements they cause an implicit commit
@pilcrow - Wasn't aware of that. I'll update to reflect that fact.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.