Homework 2

Set up SPJ database
Throughout the entire semester, we will use the supplier-part-project (SPJ) database as a sample database. The database tables are given in Fig. 4.5 and on the back cover of the textbook. Work on Questions 4.1 and 4.4. You are required to create database tables on our MySQL database and then populate data into the tables. The script for creating the tables can be found in the shared course folder on our CSC server (cscdevprod01). The following are some commands you may use to create the SPJ database tables.
  1. Make a course directory named csc4341 in your home directory
    cd ~ 
    mkdir csc4341
    pwd
  2. Copy the script spj.sql to your course directory from the shared directory:
    cp /shared/csc4341/spj.sql ~/csc4341
  3. Create the tables by running the script without logging into MySQL database. For example,
    mysql ZHANG -u yzhang -p < spj.sql 
  4. Then log in MySQL and check if the data is correctly populated in the tables. If not, make necessary corrections.