Accessing Data4:53 with Alena Holligan
Now that our base application is up and running, we're ready to model our data. We know we’ll have a Course object and we also know that we’ll have a Review object. Each course will have possibly many reviews. You might recognize this type of model relationship as one to many. One course, many reviews.
You can download the database here. Or if you prefer, you can set up the database yourself. If you want to create the tables, you can use the following SQL commands:
CREATE TABLE "courses" ( `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `title` TEXT NOT NULL, `url` TEXT NOT NULL )
CREATE TABLE "reviews" ( `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `course_id` INTEGER NOT NULL, `rating` INTEGER NOT NULL, `comment` BLOB NOT NULL )
You need to sign up for Treehouse in order to download course files.Sign up