Primary key is a column or group of columns that uniquely identify a row. Every table should have a primary key. And a table cannot have more than one primary key.
Foreign key is a column or set of columns in one table whose values must have matching values in the primary key of another (or the same) table. A foreign key is said to reference its primary key. Foreign keys are a mechanism for maintaining data integrity.
For your problem, I have created the script for you. I did it from scratch since I need to have table available before adding the constraints but I didn't added all columns, sorry!!:
--Create user table and add id as primary key
CREATE TABLE user
(
Id Number (5) ,
Username Varchar2 (25),
Eamil Varchar2 (25),
CONSTRAINT user_pk PRIMARY KEY (id)
);
--Create "agreement" table and add "Agreement_Id" as primary key
CREATE TABLE agreement
(
Id_Two Number (5) ,
Agreement_Id Varchar2 (25),
type Varchar2 (25),
Constraint agreement_Pk Primary Key (agreement_id)
);
--Create "email" table and add "email_Id" as primary key
CREATE TABLE email
(
Id Number (5) ,
Agreement_Id Varchar2 (25),
Eamil_Id Varchar2 (25),
Constraint email_Pk Primary Key (Eamil_Id)
);
Now added constraints:
1. Foriegn key for "Agreement" table from "user" table:
Alter Table Agreement
ADD CONSTRAINT fk_agreement1
Foreign Key (Id_Two)
REFERENCES user(id)
2. Foreign key for "email" table from "Agreement" table:
Alter Table Email
ADD CONSTRAINT fk_email1
Foreign Key (Agreement_Id)
REFERENCES Agreement(Agreement_Id)
3. Foreign key for "email" table from "user" table:
Alter Table Email
ADD CONSTRAINT fk_email2
Foreign Key (id)
REFERENCES user(id)
Thus, you can add all constraints.