Creating groups

changes made to sql in relation populating groups table