Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I would know if can be declared in MySQl to create an index constraints in a table with two foreign key that one can be null.
For example cannot be repeated a null foreign key with the other foreign key setted:

first foreign key: 1
second foreign key: 1

first foreign key: 1
second foreign key: null

so this two foreign keys can be saved correctly in the table but if I try to save again

first foreign key: 1
second foreign key: null

I should receive an error from the database.
I'm not able to express this control in SQLYog.