I am looking at the student/courses hbase schema example to get my head
wrapped around the basics. (Many-many relationship between students and
courses).

As per my newbie understanding, I design the fol. tables:

Table: Student
Row: studentId
ColumnFamily: info
ColumnValues: info:firstname='John' info:lastname='Doe'

Table: Course
Row: courseId
ColumnFamily: info
ColumnValues: info:name='Physics101' info:description='Introduction to
Physics'

Table:StudentCourse
Row:studentId_courseId
ColumnFamily: info
ColumnValues: info:yeartaken='2001' info:status='pass' info:professor='Miss
Jane'

Now how do I tie this to something like
'get all courses for a student'?
'get all students that have taken a course'?

The way I envision is: store all courseIds for a given studentId in a column
in Student table. Then retrieve all of them for the given studentId, create
the row-ids corresponding to studenIid_courseId and then do a scan of the
StudentCourse table. Am I on the right track?

I went through the hbase schema case studies, but I am confused. I see this
question asked in different wordings in several places, but I am not sure I
see a definitive answer to 'how do I map many-many relationships in an hbase
schema'. I apologize if this is a duplicate.

Thanks in advance.

Reply via email to