Sunday, 22 February 2009

2nd part of the assignment.


I was working on the ERD of this assignment, but it will take time and effort to draw it on MS Word or any other software. I just draw it on paper. :) I am such a lazy bastard. :)
Anyway, here we go, the database design. The whole MySQL code is here. It will roughly be like this.

You can open PhpMyAdmin and copy/paste the sql commands there.
You will get exactly the same results you see in the image. Click on the image to make it bigger.

Note: I made some changes on the sql code below when I was populating the whole database tables.

-------------------------------------------------------------------------
create database projectsinc;
use projectsinc;

create table employees
(employee_id int unsigned not null auto_increment primary key,
name varchar(50) not null,
address varchar(50) not null,
city varchar(40) not null,
dob date not null,
current_job varchar(40) not null,
skills varchar(80) not null,
projects varchar(80) not null
);

create table engineer
(engineer_id int unsigned not null auto_increment primary key,
employee_id int unsigned not null,
type_of_degree varchar(20) not null
);

create table secretary
(secretary_id int unsigned not null auto_increment primary key,
employee_id int unsigned not null,
typing_speed int unsigned not null
);

create table married
(employee_id int unsigned not null primary key,
marriage_date date not null,
to_whom varchar(50) not null
);

create table skills
(skill_no int unsigned not null primary key,
skill_name varchar(60) not null,
description text not null
);

create table departments
(dept_name varchar(30) not null primary key,
tel_no int unsigned not null
);

create table vendors
(name varchar(40) not null primary key,
address varchar(60) not null,
equipment_type varchar(60) not null,
last_meet_date date not null
);

create table projects
(project_no int unsigned not null primary key,
project_name varchar(60) not null,
est_cost float(12,2) not null
);

create table city
(city_name varchar(20) not null primary key,
city_state varchar(20) not null,
population int unsigned not null
);

-------------------------------------------------------------------------



Good Luck with rest of the assignments. I hope this code will help.

Max

No comments:

Post a Comment