Coolcrab
Coolcrab

Reputation: 2723

MYSQL table in table

I want to make a database that tracks the activity of members, so adds all the stuff they do. But to do that I think that I need a nested table, as the first would contain the user and his info and then a subtable to store all the events.

Can this be done in mysql?

So like:

 username 
 email 
 telephone 
 events-> event 1, event 2, event 3

with each event having date, participants and time

Upvotes: 0

Views: 56

Answers (1)

Adriaan Stander
Adriaan Stander

Reputation: 166336

You could look at a many to many approach.

So

Table Users
- UserID
- UserName
- User Etc.

Then

Table Activities
- ActivityID
- ActivityName
- ActivityGroupdID
- Acticity Etc.

Then

Table UserActivities
- UserID
- ActivityID
- Link Etc.

Further to this, you could think about user security, or roles where a user belonging to a specific group, might have access to specific activities.

Upvotes: 2

Related Questions