sqlite query using foreign keys

Viewed 14176

Help a sqlite n00b out, please.

I have two tables

   "CREATE TABLE students (" +
          "_id       INTEGER PRIMARY KEY AUTOINCREMENT," +
          "studentname      TEXT not null," +
          "studentpic       BLOB," +
          "comment          TEXT);";

and

   "CREATE TABLE classes (" +
           "_id              INTEGER PRIMARY KEY AUTOINCREMENT," +
           "classname        TEXT," +
           "attend           INTEGER," +
           "late             INTEGER," +
           "dtime            TEXT," +
           "student          INTEGER REFERENCES students(_id) on
                             UPDATE CASCADE);";

I want to display a list of students in particular class, but my classes table only reference them by student-id, how can I construct a query to pull back into a single cursor all the fields of 'classes' table but use the actual names from 'students' table ?

Many thanks in advance

1 Answers
Related