I want to create constraint in my table ONLY if it not exists. Is there any way to do it in MySQL? Below is the sample query which will return rows if constraint exists, want to execute ADD Constraint if not returning any rows. How can I possibly do it? Appreciate for any help.
SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE TABLE_NAME = 'SAMPLE_TABLE'