SQLite Editor

#1

CREATE TABLE contacts (
	contact_id integer PRIMARY KEY,
	first_name text NOT NULL,
	last_name text NOT NULL,
	email text NOT NULL UNIQUE,
	phone text NOT NULL UNIQUE
);

#2

CREATE TABLE groups (
	group_id integer PRIMARY KEY,
	name text NOT NULL
);

#3

CREATE TABLE contact_groups (
	contact_id integer,
	group_id integer,
	PRIMARY KEY (contact_id, group_id),
	FOREIGN KEY (contact_id) REFERENCES contacts (contact_id) 
			ON DELETE CASCADE ON UPDATE NO ACTION,
	FOREIGN KEY ([ group_id ]) REFERENCES groups (group_id) 
			ON DELETE CASCADE ON UPDATE NO ACTION
);