Name:

PHP - CCIS 2630

Class 7 - March 16th, 2006

Homework (due by end of next class period)

Lab 20 points - March 23rd, 2006

2 points - login to your mysql server

REQUIRED FOR CREDIT: At the mysql prompt type the following:

tee /home/YOURUSERNAME/mySQL_YOURUSERNAME.txt

8 points - Create 2 tables in your database according to the following:

Table name: car

Field Data type
carID Auto incrementing integer
ManufacturerID Integer
ModelName Variable character field up to 150 characters.
purchaseDate Date
Color Variable character field up to 30 characters.

Table name: manfacturer

Field Data type
ManufacturerID Auto incrementing integer
ManufacturerName Variable character field up to 70 characters.
Region Character Field of 1 character only.
Rating Integer

6 points - Insert the following data into the tables:

Car table:

1	1	Explorer	12-15-2001	blue
2	1	Focus		1-17-2003	red
3	2	Prius		4-1-2002	turquoise
4	2	Tercell		9-18-1995	red
5	3	SW1		11-15-2001	blue
5	3	LS-200		6-22-2003	yellow

Manufacturer table:

1	Ford	N	5
2	Toyota	S	4
3	Saturn	E	5

4 points - Write a SELECT statement that displays the Manufacturer name, model, purchaseDate, and color of all the blue and red cars.

Extra Credit

3 points - use mysqldump to export your database to a file called "backup_YOURUSERNAME.txt" in your home directory.

Email the "/home/YOURUSERNAME/mySQL_YOURUSERNAME.txt" to me at phpclass@linux-classes.com
(if you did the extra credit, email the "backup_YOURUSERNAME.txt" file as well