You are on page 1of 4

Faculty of Information & Communication Technology

Individual Assignment 2

● Read all the questions before starting.


● Database name should be your name and student id.
● Submission will be on Monday 10/May/2019 and should via e-mail or
pass to examiner including with the First assignment (Assignment 1)
● Come by the faculty and submit to me personally!
● All the notes are in portal/google drive any issues email me at
(Kaarthikeyen.s@limkokwing.edu.my) before submission date
● Late submission and plagiarism will not be tolerated.
● Codes/Commands should be pasted in a notepad or word document
including all the ERRORS

A) Create/Alter/Drop Table Commands:

1. Create the JOB table and implement the following constraints.

Column Type Length PK FK Required Unique Default

Not Null

job_code char 3 PK

job_class char 30

chg_hour decimal 5,2 15

2. Insert the following records:

JOB
JOB_CODE JOB_CLASS CHG_HOUR

APD Application Designer 48.10

DBD Database Designer 105.00

EEG Elec. Engineer 84.50

Page 1 of 4
Faculty of Information & Communication Technology

GSP General Support 18.36

PRG Programmer 37.75

SYA Systems Analyst 96.75

3. Create the EMPLOYEE table with the sample data on the previous page. Also implement
the following constraints.

Column Type Length PK FK Required Unique Default

Not Null

emp_num int PK

emp_fname char 20 “unknown”

emp_lname char 20 NN unique

job_class char 3 job

(job_code)

hiredate date NN

4. Insert the following records:

EMPLOYEE
EMP_NUM EMP_FNAME EMP_LNAME JOB_CLASS HIREDATE

101 John News DBD 1978-11-01

102 David Senior SYA 1988-10-03

103 June Arbough EEG 1999-06-23

104 Anne Ramoras SYA 1992-02-28

105 Alice Johnson DBD 1995-08-15


Page 2 of 4
Faculty of Information & Communication Technology

199 Janet Jameson APD 1993-02-03

107 Tony Stark PRG 1994-09-20

108 SYA

109 Walter White EEG 1998-10-01

5. Add a new attribute to the JOB table named OvertimeCharge that must always have a
value.
6. In Emp_Num 108 you should insert your own first and last name and HIREDATE should be
the date that you started the assignment.
7. Add a constraint that will add the value NA to all JOB_CLASS columns in table JOB if no value
is specified when the record is inserted into the table.
8. Add a constraint that always requires a value entered into the CHG_HOUR column.
9. Change the CHG_HOUR column to store numbers up to 12 digits in length (including decimal
points).

B) Data Manipulation Commands:

10. Insert the 3 rows shown below into the EMP table.

106 William Smithfield PRG 2002-10-13

114 Annelise Jones null 2001-10-13

118 default value Frommer null 2001-10-13

11. Update the employee EMP_FNAME to Jim instead of James for employee 118
12. Update the Database Designer CHG_HOUR value by 10%
13. Remove the row from the job table for job code APD
14. Remove the employees from the employee table where the HIREDATE is before
1-January-90

Page 3 of 4
Faculty of Information & Communication Technology

C) Create/Alter/Drop Table Commands:(cont.)

15. Drop the constraint from the CHG_HOUR column.


16. Drop the column named OvertimeCharge from the JOB table.
17. Drop the CHG_HOUR column and all of its data from the JOB table.

D. Display the following


a) All the table
b) All the records
c) Display Employee in Layout form
d) Output EMP_FNAME and EMP_LNAME as Employee First Name and Employee Last
Name
e) Show Employee records in Descending form
f) Show all record who was hired before 1995 (optional)
g) Show all record who is an Elec. Engineer
h) Show your record (EMP_NUM 108)

Page 4 of 4

You might also like