If I know that the table exists but I don't know whether the foreign key constraint exists, then I can do this:
ALTER TABLE table_name DROP CONSTRAINT IF EXISTS constraint_name
What if I don't know whether the table itself exists? I want a single statement that has outcomes as follows:
if (the table does not exist)
{
nothing happens
}
else if (the table exists, but the foreign key constraint does not exist)
{
nothing happens
}
else
{
the foreign key constraint is dropped, but the table continues to exist
}