The purpose of this
assignment is to practice working with tables and databases. You will create a
database named: HR and build the following tables within this database. Once
you are done creating the tables, you will start inserting data into each table
to make things real.
Table Name: employee
Attribute
|
Data Type
|
Primary
|
First Name
|
VARCHAR(15)
|
|
Mid Name
|
CHAR
|
|
Last Name
|
VARCHAR(15)
|
|
SSN Number
|
CHAR(9)
|
ü
|
Birthday
|
DATE
|
|
Address
|
VARCHAR(50)
|
|
Sex
|
CHAR
|
|
Salary
|
DECIMAL(10,2)
|
|
Supervisor SSN
|
CHAR(9)
|
|
Department Number
|
INT
|
|
Table Name: department
Attribute
|
Data Type
|
Primary
|
Department Name
|
VARCHAR(15)
|
|
Department Number
|
INT
|
ü
|
Manager SSN
|
CHAR(9)
|
|
Manage Start Date
|
DATE
|
|
Table Name: dept_locations
Attribute
|
Data Type
|
Primary
|
Department Number
|
INT
|
ü
|
Department Location
|
VARCHAR(15)
|
ü
|
Table Name: project
Attribute
|
Data Type
|
Primary
|
Project Name
|
VARCHAR(15)
|
|
Project Number
|
INT
|
ü
|
Project Location
|
VARCHAR(15)
|
|
Department Number
|
INT
|
|
Table Name: works_on
Attribute
|
Data Type
|
Primary
|
Employee SSN
|
CHAR(9)
|
ü
|
Project Number
|
INT
|
ü
|
Hours
|
DECIMAL(3, 1)
|
|
Table Name: dependent
Attribute
|
Data Type
|
Primary
|
Employee SSN
|
CHAR(9)
|
ü
|
Dependent Name
|
VARCHAR(15)
|
ü
|
Sex
|
CHAR
|
|
Birthday
|
DATE
|
|
Relationship
|
VARCHAR(8)
|
|
B. Insert Data
Table Name: Employee
FName
|
Minit
|
LName
|
SSN
|
BDate
|
Address
|
Sex
|
Salary
|
SuperSSN
|
DepNo
|
Doug
|
E
|
Gilbert
|
554433221
|
09-JUN-60
|
11
S 59 E, Salt Lake City, UT
|
M
|
80000
|
NULL
|
3
|
Joyce
|
|
PAN
|
543216784
|
07-FEB-78
|
35
S 18 E, Salt Lake City, UT
|
F
|
70000
|
NULL
|
2
|
Frankin
|
T
|
Wong
|
333445515
|
08-DEC-45
|
638
Voss, Houston, TX
|
M
|
40000
|
554433221
|
5
|
Jennifer
|
S
|
Wallace
|
987654321
|
20-JUN-31
|
291
Berry, Bellaire, TX
|
F
|
43000
|
554433221
|
4
|
John
|
B
|
Smith
|
123456789
|
09-JAN-55
|
731
Fondren, Houston, TX
|
M
|
30000
|
333445555
|
5
|
Ramesh
|
K
|
Narayan
|
666884444
|
15-SEP-52
|
975
Fire Oak, Humble, TX
|
M
|
38000
|
333445555
|
5
|
Joyce
|
A
|
English
|
453453453
|
31-JUL-62
|
5631
Rice, Houston, TX
|
F
|
25000
|
333445555
|
5
|
James
|
E
|
Borg
|
888665555
|
10-NOV-27
|
450
Stone, Houston, TX
|
M
|
55000
|
543216789
|
1
|
Alicia
|
J
|
Zelaya
|
999887777
|
19-JUL-58
|
3321
Castle, Spring, TX
|
F
|
25000
|
987654321
|
4
|
Ahmad
|
V
|
Jabbar
|
987987987
|
29-MAR-59
|
980
Dallas, Houston, TX
|
M
|
25000
|
987654321
|
4
|
Table Name: Department
DName
|
DepNo
|
MgrSSN
|
MgrDate
|
Manufacture
|
1
|
888665555
|
19-JUN-71
|
Administration
|
2
|
543216789
|
04-JAL-99
|
Headquarter
|
3
|
554433222
|
22-SEP-55
|
Finance
|
4
|
987654321
|
01-JAN-85
|
Research
|
5
|
333445553
|
22-MAY-78
|
Table Name: Dept_Locations
DepNo
|
DLocation
|
1
|
Houston
|
2
|
Chicago
|
3
|
New York
|
4
|
San Francisco
|
5
|
Salt Lake City
|
6
|
Stafford
|
7
|
Bellaire
|
8
|
Sugarland
|
Table Name: Project
PName
|
PNumber
|
Plocation
|
DepNo
|
ProjectA
|
3388
|
Houston
|
1
|
ProjectB
|
1945
|
Salt Lake City
|
5
|
ProjectC
|
6684
|
Houston
|
1
|
ProjectD
|
3324
|
Bellaire
|
7
|
ProjectE
|
4477
|
Sugarland
|
8
|
ProjectF
|
5671
|
Salt Lake City
|
5
|
ProjectG
|
7812
|
New York
|
3
|
ProjectH
|
9034
|
Stafford
|
6
|
ProjectI
|
9843
|
Chicago
|
2
|
ProjectJ
|
1122
|
San Francisco
|
4
|
Table Name: Works_On
ESSN
|
PNo
|
Hours
|
123456789
|
3388
|
32.5
|
123456782
|
1945
|
7.5
|
666884444
|
3388
|
40.0
|
453453453
|
5577
|
20.0
|
453453454
|
6622
|
20.0
|
333445556
|
3377
|
10.0
|
333445557
|
6688
|
10.0
|
Table Name: Dependent
ESSN
|
Dependent_Name
|
Sex
|
BDate
|
Relationship
|
123456789
|
Alice
|
F
|
05-APR-76
|
Daughter
|
123456782
|
Theodore
|
M
|
25-OCT-73
|
Son
|
666884444
|
Joy
|
F
|
03-MAY-48
|
Spouse
|
453453453
|
Abner
|
M
|
29-FEB-32
|
Spouse
|
453453454
|
Michael
|
M
|
01-JAN-78
|
Son
|
333445556
|
Alice
|
F
|
31-DEC-78
|
Daughter
|
333445557
|
Elizabeth
|
F
|
05-MAY-57
|
Spouse
|