CREATE TABLE IF NOT EXISTS activity_transaction ( a_id INT NOT NULL, t_id INT NOT NULL, PRIMARY KEY (a_id, t_id), FOREIGN KEY (a_id) REFERENCES activity(a_id) ON DELETE CASCADE, FOREIGN KEY (t_id) REFERENCES transaction(t_id) ON DELETE CASCADE );