I am new to relational databases, I am not sure if I am asking this question correctly so any feedback is appreciated. I have seen a few questions about storing one-to-many relationships, but none that I have found seem to have data in quite this format.
I am more familiar with a document based approach, so I'll present my example data here as JSON and would appreciated guidance on how this would be implemented in a relational database.
For example if I have data about school classes and want to store where a student sits, in Mongo DB I would do something like the following:
[{'_id': 'asdf',
'name': 'English 101',
'seats': {'john': '1a',
'bill': '1b',
'suzie': '1c',
'julie': '2a'},
'_id': 'qwer',
'name': 'Biology 205',
'seats': {'julie': '1a',
'bill': '1b',
'john': '1c',
'suzie': '2a'}
}
]
In a relational database I am less certain. I would imagine I would have a table where the primary key is equivalent to the '_id'
field a column named 'name'
and one named 'seats
'? However I don't know what would go in the seats field (I thought about using a JSON string, thought there must be a better way).
Does this mean that I need a new table for each unique class that contains the seat information? Or is there another way to store this data in a relational database?