1

Suppose I have a foreign key named my_fk that goes between two tables named table_a and table_b, where table_a is the "many" side and table_b contains the unique record that table_a is referencing. How would I go about changing an already-existing relationship from mandatory to optional? What SQL do I need to type?

sstan
  • 35,425
  • 6
  • 48
  • 66
interestedparty333
  • 2,386
  • 1
  • 21
  • 35
  • Possible duplicate of [Oracle optional relationship](https://stackoverflow.com/questions/1190446/oracle-optional-relationship) – Attila Csipak May 08 '18 at 12:43
  • @attilacsipak This is in not a duplicate -- read the title or the question. What is it with the SO community and being sick with power?!? _Already-existing_! – interestedparty333 May 08 '18 at 19:48

1 Answers1

1

If you want to make the relationship optional, you just need to allow nulls in the column from table_a that has a foreign key relationship to the table_b table.

alter table table_a modify fk_col_name null

Note: Replace fk_col_name by the actual column name.

sstan
  • 35,425
  • 6
  • 48
  • 66