Skip to content
Advertisement

Alter table and add constraint not null based on another column condition

I have this table:

I want to add a restriction thanks to which the substitute ID cannot be NULL where athletes country is ESP.

I have tried the following, but I am not sure where to place the WHERE condition:

Any ideas on how to solve this? (:

I was also trying to use CHECK, but I am not sure if I implement it correctly

Advertisement

Answer

This should work :

demo

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement