Team system ? need some help

hi, i’ve got to build some sort of team system where many users can add
themselves to one team.

now i’ve thought about doing this a couple of ways but one that sticks
is creating a Team table with a record for each team.

then in the user table create a field containing the team_id for the
team their joined to.

any idea if this is along the right path and maybe the code involved to
create that team record when the user is created (if said team doesn’t
exist yet).

appreciate your thoughts,