I have a logical problem in my database design. I have got a table with 2 field, one of the integer field is the primary key and it acts as foreign key in all other tables.
The table structure is
How can I map this in the database creation? How can i design the table with this requirement.
standard SQL can handle such a mapping simply:
CREATE TABLE employee (
first_name varchar,
last_name varchar,
date_started date,
id int primary key
);
create table salary (
employee_id int primary key references employee(id),
yearly_amount numeric
);
CREATE TABLE wage (
employee_id int primary key references employee(id),
hourly_amount numeric
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With