I need to add a NOT NULL column to an existing (populated) table that will be a foreign key to another table. This brings about two problems:
When you add the c
Create the column, but allow NULL. Populate the column with the correct data from the foreign key table. Alter the column add not null. Add the foreign key constraint.