Primary Key

A Primary Key uniquely identifies each record in a table. It cannot be NULL and must be unique.

Example:

CREATE TABLE employees (
  employee_id NUMBER PRIMARY KEY,
  name VARCHAR2(50)
);

Foreign Key

A Foreign Key is a column that creates a relationship between two tables.

CREATE TABLE departments (
  department_id NUMBER PRIMARY KEY,
  name VARCHAR2(50)
);

CREATE TABLE employees (
  employee_id NUMBER PRIMARY KEY,
  name VARCHAR2(50),
  department_id NUMBER REFERENCES departments(department_id)
);