September 6, 2012
Create a new directory ~/cs418_html/labs for your lab exercises and set the permissions so that it the web server (anyone) can access it (chmod 755 ~/cs418_html/labs/).
(Exercises come from http://cs.smith.edu/dftwiki/index.php/CSC220_Exercises_with_MySQL and http://code.google.com/edu/tools101/mysql.html)
We have a database with two tables.


The second table (orders) shows customer orders for different items with the quantity and price for each item.
Go through the data normalization process to improve this database. Write out your new database structure on paper and discuss it with another student (if working alone) or group (if working in a group).
In your MySQL database on mweigle418, create a table named lab1_store with the following contents:
id name qty price 1 apple 10 1 2 pear 5 2 3 banana 10 1.5 4 lemon 100 0.1 5 orange 50 0.2
Using SELECT statements, complete the following tasks:
First check your SELECT statements using the MySQL command line or the phpmyadmin interface. Then, write a web page named lab1-2.php that outputs the results of each query.
Create the following tables:
lab1_courses
id name dept_id 1 111 1 2 112 1 3 250 1 4 231 1 5 111 2 6 250 3 7 111 4
lab1_dept
id name 1 CSC 2 MTH 3 EGR 4 CHM
lab1_enrollment
course_id count 1 40 2 15 3 10 4 12 5 60 6 14 7 200
Using SELECT statements, answer the following questions/tasks:
First check your SELECT statements using the MySQL command line or the phpmyadmin interface. Then, write a web page named lab1-3.php that outputs the results of each query.