Something like:
create table Employee(
ID int primary key,
Name nvarchar(200)
IDArea int foreign key references Area(ID)
);
go
create table Area(
ID int primary key,
Name nvarchar(200)
);
Does something like this exist in Oracle?
Something like:
create table Employee(
ID int primary key,
Name nvarchar(200)
IDArea int foreign key references Area(ID)
);
go
create table Area(
ID int primary key,
Name nvarchar(200)
);
Does something like this exist in Oracle?
Yes, just leave out the "GO" keywords and put the statements in a file:
create table Area(
ID int primary key,
Name nvarchar2(200)
);
create table Employee(
ID int primary key,
Name nvarchar2(200),
IDArea int references Area(ID)
);
You must create the Area primary key before the foreign key that references it, so I have swapped these around. Also the foreign key syntax is slightly different in Oracle.
You should first create the master table, forget nvarchar datatype, and eventually the script would be :
create table Area(
ID number primary key,
Name varchar2(200)
);
create table Employee(
ID number primary key,
Name varchar2(200) ,
IDArea number, constraint fk_idarea foreign key (idarea) references Area(ID)
);