Question:
Is it possible to have enforce multiple column constraint when creating a table in mySQL, as opposed to later including it by altering the table?
Background:
I have noticed almost all answers to the question "how to create a multi column unique constraint in mySQL" involve using ALTER
on a table, here are 2 examples from here alone:
- ON DUPLICATE KEY: multi-column unique constraint
- Use multiple columns as unique identifier for mysql
The only examples I find which create multi column constraint when creating the table are for different flavors of sql:
- How to place unique contraint on multiple column
- How to do multiple column unique-constraint in ormlite ( SQLite )
- microsoft sql example
Is there a way to create the constraint when creating the table as I find it is cleaner that way?