Ceci est une ancienne révision du document !


SQL Lab: SQLite practice

SQLite is a widespread embedded SQL engine.

This lab will give you some practice on SQL querying.

Application context

You are interested in creating a web site to rate movies. You already collected a few example rates on some movies. Even if you don't have much data, you can still try some queries.

The schema of the database is the following:

  • Movie(mID, title, year, director)
  • Reviewer(rID, name)
  • Rating(rID, mID, stars, ratingDate)

Setting up the database

As SQLite is not a full featured DBMS server, starting the SQLite shell on a database file is sufficient to get started. In a working directory of your choice, download tp1-dbdm.sql, then start SQLite1):

sqlite3 movies.db

Execute the sql script:

.read TP1-DBDM.sql

And turn on headers for getting attributes on results

.headers on
1)
this create the movies.db file if it doesn't exists already