title: Advanced queries in HBase
body: <p>Given the following HBase schema scenario (<a href="http://wiki.apache.org/hadoop/Hbase/FAQ" rel="noreferrer">from the official FAQ</a>)...</p>
  
  <blockquote>
    <p>How would you design an Hbase table
    for many-to-many association between
    two entities, for example Student and
    Course?</p>
    
    <p>I would define two tables:</p>
    
    <p>Student: student id student data
    (name, address, ...) courses (use
    course ids as column qualifiers here) </p>
    
    <p>Course: course id course data (name,
    syllabus, ...) students (use student
    ids as column qualifiers here)</p>
    
    <p>This schema gives you fast access to
    the queries, show all classes for a
    student (student table, courses
    family), or all students for a class
    (courses table, students family).</p>
  </blockquote>
  
  <p>How would you satisfy the request: "<em>Give me all the students that share at least two courses in common</em>"?  Can you build a "query" in HBase that will return that set, or do you have to retrieve all the pertinent data and crunch it yourself in code?</p>