-- supposing favorites are attached to user records CREATE TABLE user_favorites ( userid integer not null, title varchar(100) not null, link varchar(255) not null, num integer not null, PRIMARY KEY (userid, title), FOREIGN KEY (userid) REFERENCES users (userid) ON DELETE CASCADE );