When you create a foreign key, it can be placed on the column, which is the foreign key reference or at the end when you must define also the column that references the parent table.
If the foreign key is built using multiple columns, then you must define the foreign key separately in the end.
The foreign key can also be created separately. Consider the following examples:
create table a (
id int not null primary key
);
create table b (
id int not null primary key,
fk int not null foreign key references a (id)
);
create table c (
id int not null primary key,
fk int not null,
constraint fk_c_a foreign key (fk) references a (id)
);
create table d (
id int not null primary key,
fk int not null
);
alter table d add constraint fk_d_a foreign key (fk) references a (id);
See also:
CREATE TABLE[
^]