SUNTURST
         CONSULTING INC


     DATABASE PROJECT
                     BY

                 GROUP 12




               DBST 652
University of Maryland University College
              Summer 2011
      Saturday, November 26, 2011
Contents

Deliverable 1 – Project Charter........................................................................................... 2
Deliverable 2 - ERD............................................................................................................ 5
Deliverable 3 - Data Definition Language ........................................................................ 12
Deliverable 4 – Data Manipulation Language .................................................................. 18
Database Snappshot .......................................................................................................... 49
Deliverable 5 - SQL Queries............................................................................................. 62
Deliverable 6 -Database Maintenance Scripts .................................................................. 69
Deliverable 7 – Functons & Stored Procedure ................................................................ 75
Deliverable 8 -Explain Tool.............................................................................................. 79
Deliverable 9 - Object-Relational Exercises ..................................................................... 82
References ......................................................................................................................... 87




                                                                                                                                          1
Deliverable 1 – Project Charter

Database Objective

       Objective of this project is to create an Employee Database which will store

information about employees working for SunTrust Consulting Inc. SunTrust is IT

consulting company which has assigned many projects to its several employees.

        This database will contain all the information about the employees working for

the SunTrust , such as Employee’s ID, SSN, first name, Date of birth, home address,

office phone number, emergency contacts, department, languages, salary etc. It also

stores the information about project such as project ID, project name, the assigned

employee and the number of hours worked by each employee.

       Currently, SunTrust Company is using an access, single user database, to record

employee data. Moving this to multiuser database will enable individual employees to

access most of the employee’s data online. At the same time, company executive can see

the cost associated with each project.



Purpose and benefits

       This multi user database will help HR to ease their workload by giving employees

access to their data via web and letting them update their information. Moreover

employees will be able to search the database and find contact information about other

employees like addresses and phone numbers. Managers will have access to their

employee’s data and project’s cost which can be used to make a better business decision.


                                                                                           2
Furthermore, mangers would be able to create and finalize reports of projects like the

average cost of each projects and total salary paid to each employee.



Technical Detail

        This database will run in the UMUC Unix server dbcourse2 which will be

accessed via PortalPutTTY terminal emulator using SSH network protocol. The software

that would be used is Oracle 10g. Data definition language (DDL) would be used to

create the database. Data manipulation language (DML) and Transaction control

language (TCL) would also be utilized to manipulate the database and make changes or

undo transactions to the database.

Tools
Microsoft Visio 2010 and Oracle Data Modeler would be used to create the Entity

relationship diagram (ERD). Notepad +++ and notepad would be used to write and edit

SQL statements. Microsoft Project 2007 would be used to create the project schedule.



Project Schedule

Please open the Microsoft Project file for complete project schedule attached with this
document.




                                                                                          3
Deliverable         Deliverable Schedule             Member   Complete By
    1         Project Charter                                    June 5

     2        ERD                                               June 12

     3        Data Definition Language                          June 19

                                                                June 26
     4        Data Manipulation Language
                                                                 July 1
     5        SQL Queries

                                                                 July 8
     6        Database Maintenance Scripts

                                                                July 24
     7        Functons & Stored Procedure
                                                                July 29
     8        Explain Tool

                                                                July 29
     9        Object Relational Exercises

    10        Lab Project Report                                August 5


                                Table 1 Project Schedule




                                                                            4
Deliverable 2 - ERD


                                                                Dependent
                                                          PK     Depnd_Num

                                                                 First_Name
                                                                 Last_Name
                                                                 Dep_Dob
                                                          FK1    Emp_ID
                                                                 Depend_Type


                    Associated
                                                                                                 Department
                                                                                          PK       Dept_ID

                                                                            Employs                Dept_Name
                                                                                                   Dept_Phone
                                                                                          FK1      Dept_Mgr_ID
                                                                                                   Dept_Ext


                                                                                    Managed




                               Works
                                                                                    Assignment
                    EMPLOYEE
                                                                              PK    Assignment_Num
              PK      Emp_ID                  Manager                                                                                       Project
                                                                                    Assign_Date                                       PK    Proj_Num
                      First_Name                                                    Assign_Hours
                      Last_Name                                                     Cost                                              FK1   Proj_Mrg_ID
                      SNN                                                     FK1   Emp_ID                                                  Proj_Name
                      DOB                                                     FK2   Proj_Num                                                Due_Date
                      Emp_Rate                                  Associated
                                   Assigned
                      Gender
              FK1     Job_Code                                                                                                                        Managed
              FK2     Dept_ID
                                       Manager


                                                                                                                       Contact
                                                               Associated                                        PK    Contact_ID

Associated                                                                                                       FK1   Emp_ID
                                                                                                                       Address
                                                                                                                       Apt_Num
                                                                                                                       City
                                                                                                                       H_State
                    Job                                                                                                Phone_Home
                                                                                                                       Phone_Mobile
         PK    Job_Code                                                                                                Phone_Work

               Description




                                                                                                                                                                5
ERD Description

   Entity                             Description

   Emplpoyee                          Stores data about an employee

   Assignment                         Stores data relating to an assignment assigned to
                                      an employee
   Project                            Stores data of a project
   Department                         Stores data of a department

   Dependent                          Stores data of the dependent assiocated with an
                                      employee

   Job                                Stores data of a job
   Contact                            Stores the contact of an employee


                            Table 2 ERD Description




                                    Constraints
    Primary keys

           Name             Object                               Description

    dept_dept_id_pk       Department             Adds the primary key constraint to the
                                                           department table.

   job_Job_Code_pk            Job              Adds the primary key constraint to the job
                                                                table.

   PK_Proj_Num_pk           Project             Adds the primary key constraint to the
                                                             project table.
         Emp_id_pk         Employee             Adds the primary key constraint to the
                                                            employee table.
assign_assigment_num_pk   Assignment            Adds the primary key constraint to the
                                                           assignment table
   con_contact_id_pk        Contact            Adds the primary key constraint to contact
                                                                 table.
depend_Depend_num_pk       Dependent            Adds the primary key constraint to the
                                                           dependent table.

                          Table 3 Primary Key Contraints
                                                                                            6
Foreign Keys


      Name                Object                       Description

dept_dept_m8gr_id       Department     Adds the FK constraint linking Employee to
                                       Department using Employee PK column
                                       (Emp_ID) & Department (Dept_Mgr_ID)
                                       column.


proj_proj_mgr_id_fk       Project      Adds the FK constraint linking Employee to
                                       Project using Employee PK column
                                       (Emp_ID) & Project (Proj_Mrg_ID)
                                       column.


  emp_dept_id_fk                        Adds the FK constraint linking Department
                         Employee       to Employee using Department PK column
                                         (Dept_ID) & Employe(Dept_ID) column.


 emp_job_code_fk                       Add the FK constraint linking Job to
                                       Employee using Job PK column (Job_Code)
                      Table 4 Foreign Key Employee (Job_Code) column.
                                       & Constraint


assign_Emp_Num_fk                      Adds the FK constraint linking Employee to
                        Assignment     Assignment using Employee PK column
                                       (Emp_ID) & Assignment (Emp_ID)
                                       column.


  assign_Proj_Num                      Adds the FK constraint linking Project to
                                       Assignment using Project PK column
                                       (Proj_Num) & Assignment (Proj_Num)
                                       column.

Depend_Emp_id_fk         Dependent     Adds the FK constraint linking Employee to
                                       Dependent using Employee PK column
                                       (Emp_ID) & Dependent(Emp_ID) column.


  con_emp_id_fk           Contact      Adds the FK constraint linking Employee to
                                       Contact using Employee Pk column
                                       (Emp_ID) & Contact (Emp_ID) column.



                                                                                    7
                       Table 5 Not Null Constraint
Not Null




           Name           Object                          Description

       dept_ex_nn       Department   Adds the not null constraint to Dept_Ex column.


     dept_phone_nn                   Adds the not null constraint to Dept_Phone column.


     dept_name_nn                    Adds the not null constraint to Dept_Name column.


   job_description_nn      Job       Adds the not null constraint to the job_description
                                     column.


  proj_proj_mgr_id_nn    Project     Adds the not null constraint to the Proj_Mrg_ID
                                     column.

   proj_proj_name_nn
                                     Adds the not null constraint to the
                                     Proj_Name column.

    proj_due_date_nn
                                     Adds the not null constraint to Due_Date column.

   emp_last_name_nn                  Adds the not null constraint to Last_Name column.


      emp_dob_nn                     Adds the not null constraint to DOB column.

                        Employee
   emp_emp_rate_nn                   Adds the not null constraint to Emp_Rate
                                     Column.
                                     Adds the Dept_ID column not null constraint
       dept_id_nn
                                     Adds the not null constraint to First_Name column.
   emp_First_name_nn


      enp_job_code                   Adds the not null constraint to the Job_code column.




                                                                                            8
emp_gender_nn                     Adds the not null constraint to the Gender column.

  assign_emp_num_nn                   Adds the not null constraint to the Emp_ID column.

   assign_hours_nn      Assignment
                                      Adds the not null constraint to Assign_Hours
                                      column.
   assign_project_nn
                                      Adds the not null constraint to Proj_Num column.

 depend_first_name_nn                 Adds the not null constraint to First_Name column.

                        Dependent
 depend_last_name_nn                  Adds the not null constraint to Last_Name column.


 depend_dep_dob_mn                    Adds the not null constraint to the Dep_Dob
                                      column.

  depend_Emp_id_nn                    Adds the not null constraint to the Emp_ID column.


depend_Depend_Type_nn                 Adds the not null constraint to Depend_Type
                                      column.


                           Table 6 Not Null Constraint




                                                                                           9
Relationships

Relationship Name           Entities         Relationship                    Description

  Emp_Dpet Rel       Employee & Department       1:M        One or more employee works for a
                                                            department.

                                                            A department employes one or more
                                                            employees

  Dep_Emp Rel        Department& Employee        1:1        One and only one employee is the manger of
                                                            a department.

                                                            A department is managed by an employee.

                                                            An employment is assigned to zero or more
 Emp_Assign Rel      Employee & Assignment       1:M        assignment(s).

                                                            Zero or more assignment(s) is assiocated with
                                                            an employee.

Assign_Project Rel    Assignment & Project       1:M        One or more assignments can be assiocated
                                                            with a project.

                                                            A project can be assiocated with one or more
                                                            assignments.

  Cont_Emp Rel        Contact & Employee         1:M        An employee is assiocated with one or more
                                                            contact listing(s).

                                                            One or more contact listing(s) is assiocated
                                                            with an employee.

  Emp_Job Rel           Employee & Job           1:M        One or more employees can be assiocated
                                                            with the same job type.

                                                            A job type is assiocated with one or more
                                                            employees.


Depend_Emp Rel       Dependent & Employee        1:1        One and only one depedent may be assiocated
                                                            with an employee.




                                                                                                     10
Proj_Emp Rel   Project & Employee             1:1      One and only one employee is the manager of
                                                       a project.

                                                       A project is managed by an employee.


                                    Table 7 Relationships




                                                                                              11
Deliverable 3 - Data Definition Language



/* creates the department table */

CREATE TABLE DEPARTMENT
  (
  Dept_ID Number ,
  Dept_Name VARCHAR2(50),
  Dept_Phone Number,
       Dept_Mgr_ID Number ,
  Dept_Ext Number
 );

/* add the primary key constraint */

 Alter table department
  add constraint dept_dept_id_pk primary key (dept_id);

/* add the not null constraint */


Alter table department
        modify (dept_ext constraint dept_ex_nn not null)
        modify ( dept_phone constraint dept_phone_nn not null)
        modify (dept_name constraint dept_name_nn not null);

/* adds the foreign key constraint to the department table */

Alter table department
 add constraint dept_dept_mgr_id_fk foreign key (dept_mgr_id) references employee
(emp_id);

/* creates the unique number for the pk columns */
create sequence dept_dept_id_seq
start with 0400
increment by 5
Nocycle ;

/* creates the job table */

CREATE TABLE JOB
(


                                                                                    12
Job_code Number,
  Description VARCHAR2(50) CONSTRAINT job_description_nn not null
);

/*end of statement*/


/* creates the primary key constraint*/

Alter table job
add constraint job_Job_Code_pk PRIMARY KEY(Job_Code)

/*end*/


/* creates the table project*/

CREATE TABLE PROJECT
(
  Proj_Num Number ,
       Proj_Mgr_ID Number,
  Proj_name VARCHAR2(50),
  Due_Date DATE
       );

/* end */

/* creates pk constraint for the project table */


Alter table project
add CONSTRAINT PK_Proj_Num_pk PRIMARY KEY(Proj_Num);


/* create the foreign key constraint for project table */

Alter table project
  add constraint proj_proj_mgr_id_fk foreign key (proj_mgr_id) references employee
(emp_id);

/* end of sql */

/* creates the null constraints for project table * */

Alter table project
 modify( proj_mgr_id constraint proj_proj_mgr_id_nn not null )
 modify (proj_name constraint proj_proj_name_nn not null)
 modify( due_date constraint proj_due_date_nn not null);

/* end sql */

                                                                                     13
/* creates the employee table */

 CREATE TABLE EMPLOYEE
 (Emp_id Number ,
  First_Name VARCHAR2(50),
  Last_Name VARCHAR2(50),
  SSN VARCHAR2(11),
  Dob DATE,
  Emp_Rate Number(10,2),
  Dept_ID number ,
  Gender varchar2(6),
  Job_Code number
   );
/* end */


/* add the primary key constraint */

Alter table employee
add constraint Emp_id_pk PRIMARY KEY(Emp_id);

/* adds the null constraints to the columnn */

Alter table employee
modify( last_name constraint emp_last_name_nn not null)
modify ( dob constraint emp_dob_nn not null)
modify ( emp_rate constraint emp_emp_rate_nn not null)
modify ( dept_id constraint dept_id_nn not null)
modify( first_name constraint emp_First_name_nn NOT NULL)
modify ( job_code constraint emp_job_code_nn not null)
 modify ( gender constraint emp_gender_nn not null);


/* adds the foreign key constraint */



Alter table employee
  add CONSTRAINT EMP_dept_id_fk FOREIGN KEY(Dept_ID) REFERENCES
DEPARTMENT(Dept_ID) ;

Alter table employee
  add CONSTRAINT Emp_job_code_fk FOREIGN KEY(Job_Code) REFERENCES
JOB(Job_Code);

/* sql ends */




                                                                    14
/* creates the assignment table*/


 CREATE TABLE ASSIGNMENT
  (
   Assignment_Num Number,
   Assign_Date DATE,
   Assign_Hours Number(10,2),
   Cost Number(20,2),
  Emp_id number,
 Proj_Num number
  );
/*ends*/

/* creates the constraints for assignment */

 Alter table ASSIGNMENT
  add constraint assign_assigment_num_pk primary key ( Assignment_Num );

 Alter table ASSIGNMENT
   modify ( assign_date constraint assign_emp_num_nn not null)
         modify ( assign_hours constraint assign_hours_nn not null)
         modify ( emp_id constraint assign_emp_num not null)
         modify ( proj_num constraint assign_project_nn not null );

  Alter table ASSIGNMENT
         add CONSTRAINT assign_Emp_Num_fk FOREIGN KEY(Emp_id)
REFERENCES EMPLOYEE(Emp_id)

 Alter table ASSIGNMENT
   add CONSTRAINT assign_Proj_Num FOREIGN KEY(Proj_num) REFERENCES
PROJECT(Proj_num);

/*ends*/

/* creates the table for contact*/

 Create table contact
 ( contact_id number,
   Emp_ID number,
   Address varchar2(50),
        Apt_Num varchar2(50),
        City varchar2(30),
        H_State varchar2(3),
        Phone_Home number,
        phone_Mobile number,
        Phone_Work number
);



                                                                           15
/* end */


/* creates the pk constraint */
 Alter table contact
 add constraint con_contact_id_pk primary key ( contact_id, emp_id);

 /* creates the fk constraint */

Alter table contact
 add constraint con_emp_id_fk foreign key (emp_id) references employee (emp_id);

/* add column */

Alter table contact
 add email_office varchar2(40);



/*creates the sequence value for the assignment pk value*/

create sequence assign_assign_num_seq
start with 05020
increment by 12
Nocycle

/*ends*/


 /* change sequence */
 Alter sequence emp_ssn_seq
   increment by 589874



/*produce unique numbers for pk columns. The database creates the number */

create sequence emp_emp_id_seq
start with 030404
increment by 130
Nocycle ;

/* create unique number for ssn*/

create sequence emp_ssn_seq
start with 201342019
increment by 1200
Nocycle

/* creates unique constraint for ssn*/

                                                                                   16
Alter table employee
add constraint emp_emp_ssn_uk unique (ssn);

/* changed the sequence value*/

Alter sequence emp_ssn_seq
increment by 498989
Nocycle;

/*ends*/


/* creates the unique sequence for pk column */

Create sequence con_contact_id_seq
start with 00020
increment by 123;
nocycle;

/* creates the unique number for project_num */


create sequence proj_proj_num_seq
start with 0900
increment by 5
Nocycle

/* end */




                                                  17
Deliverable 4 – Data Manipulation Language


/* inserts records into the department*/

Insert into department( dept_id, dept_name, dept_phone, dept_ext)
    values ( dept_dept_id_seq.nextval, 'Quality Assurance', 2122028259, 8260);

Insert into department( dept_id, dept_name, dept_phone, dept_ext)
    values ( dept_dept_id_seq.nextval, 'Software Engineering', 2122028259, 6821);

Insert into department( dept_id, dept_name, dept_phone, dept_ext)
    values ( dept_dept_id_seq.nextval, 'System' , 2122028259, 1926);

Insert into department( dept_id, dept_name, dept_phone, dept_ext)
    values ( dept_dept_id_seq.nextval, 'Network Systems', 2122028259, 4041);

Insert into department( dept_id, dept_name, dept_phone, dept_ext)
    values ( dept_dept_id_seq.nextval, 'Database Systems', 2122028259, 5080);

Insert into department( dept_id, dept_name, dept_phone, dept_ext)
    values ( dept_dept_id_seq.nextval, 'Project Management',2122028259, 8070);

Insert into department( dept_id, dept_name, dept_phone, dept_ext)
    values ( dept_dept_id_seq.nextval, 'Accounting and Finance' ,2122028259,9090);


/* end of the insert statement*/


/* update department to include department manager id */


update department
set dept_mgr_id = ( select emp_id from employee where emp_id = 35084)
where dept_id = (select emp_id from employee where emp_id = 400);


update department
set dept_mgr_id = ( select emp_id from employee where emp_id = 34174)
where dept_id = ( select dept_id from department where dept_id = 405);

update department
set dept_mgr_id = (select emp_id from employee where emp_id = 30534 )


                                                                                     18
where dept_id = ( select dept_id from department where dept_id = 410);


update department
set dept_mgr_id = select emp_id from employee where emp_id = 35734 )
where dept_id = ( select dept_id from department where dept_id = 415);

update department
set dept_mgr_id = (select emp_id from employee where emp_id = 33264)
where dept_id = (select dept_id from employee where dept_id = 420) ;

update department
set dept_mgr_id = (select emp_id from employee where emp_id = 35344 )
where dept_id = ( select emp_id from employee where emp_id 425);

update department
set dept_mgr_id = (select emp_id from employee where emp_id = 36124 )
where dept_id = ( select dept_id from department where dept_id = 430);

/*end*/


/* insert records into the job table */

insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'C++/.Net Developer');

insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'Java Developer');
  commit;

insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'Php/ Java Script Developer')
  commit;

insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'HTML/XHTML Developer')
   commit;

insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'Python Developer')
   commit;

insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'Database Analyst');
   commit;

insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'Database Developer');
   commit;

                                                                         19
insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'Data Modeler');
  commit;

insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'System Analyst'):
  commit;

insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'Systems Engineer' );
  commit;

insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'Systems Administrator');
  commit;

insert into job (job_code,description)
 values ( job_job_code_seq.nextval, 'Database       Administrator');
 commit;

insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'Technical Writter');
  commit;

insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'Project Manager'
  );
  commit;

insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'Network Engineer'
  );
  commit;

insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'Network Specialist'
  );
  commit;

insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'Network Security Specialist'
  );
  commit;

insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'Graphics Specialist'
  );
  commit;



                                                                       20
insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'Payroll Specialist'
  );
  commit;

insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'Inventory Specialist'
  );
  commit;

insert into job (job_code,description)
  values ( job_job_code_seq.nextval, 'Test Analyst'
  );
  commit;

insert into job (job_code,description)
 values ( job_job_code_seq.nextval, 'system Analyst'
 );
 commit;


/* end of the insert statement*/



/* inserts the records into the project table*/


Insert into project (proj_num, proj_mgr_id, proj_name,due_date)
    values (proj_proj_num_seq.nextval, (select emp_id from employee where emp_id =
35604), 'New York Ticket Corp Payment System',
          to_date ('09-sep-2010', 'dd-mon-yyyy')
          );

Insert into project (proj_num, proj_mgr_id, proj_name,due_date)
    values (proj_proj_num_seq.nextval,
          (select emp_id from employee where emp_id = 35604),
          'St Paul College Web System Development',
          to_date('02-feb-2011', 'dd-mon-yyyy'));

Insert into project (proj_num, proj_mgr_id, proj_name,due_date)
    values (proj_proj_num_seq.nextval,
          (select emp_id from employee where emp_id =35474
          ), 'Citizens Bank Databae Development',
          to_date('09-AUG-2012', 'dd-mon-yyyy'));

Insert into project (proj_num, proj_mgr_id, proj_name,due_date)
    values (proj_proj_num_seq.nextval,
          (select emp_id from employee where emp_id = 35344 ),
           'WBBMN Urban TV System Development',

                                                                                     21
to_date('27-Dec-2013', 'dd-mon-yyyy'));



/* end of sql */


/* inserts records into the employee table*/


/* system enginner employee*/


Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Sunny','McCook', emp_ssn_seq.nextval, 50,
 (select dept_id from department where dept_id =410),
 (select job_code from job where job_code = 70),
 TO_DATE('29-MAR-1978','DD-MON-YYYY '), 'Male'
 );

Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Mariah', 'Johnson', emp_ssn_seq.nextval, 50,
 (select dept_id from department where dept_id =410),
 (select job_code from job where job_code = 70),
 TO_DATE('19-feb-1955','DD-MON-YYYY '), 'female'
 );

 Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'James', 'Imgram', emp_ssn_seq.nextval, 40,
 (select dept_id from department where dept_id =410),
 (select job_code from job where job_code = 70),
 TO_DATE( '20-jan-1950','DD-MON-YYYY '), 'male'
 );


/*end */



 /*system admin sql insert */

Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Joel', 'Roland', emp_ssn_seq.nextval, 40,
 (select dept_id from department where dept_id =410),
 (select job_code from job where job_code = 75),
 TO_DATE( '20-dec-1950','DD-MON-YYYY '), 'male'

                                                                                          22
);


Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Susan', 'Noah', emp_ssn_seq.nextval, 40,
 (select dept_id from department where dept_id =410),
 (select job_code from job where job_code = 75),
 TO_DATE( '10-apr-1964','DD-MON-YYYY '), 'female'
 );


Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Peter', 'Wolf', emp_ssn_seq.nextval, 40,
 (select dept_id from department where dept_id =410),
 (select job_code from job where job_code = 75),
 TO_DATE( '15-sep-1955','DD-MON-YYYY '), 'male'
 );


Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender )
values (emp_emp_id_seq.nextval , 'Marxwall', 'Luther', emp_ssn_seq.nextval, 40,
 (select dept_id from department where dept_id =410),
 (select job_code from job where job_code = 75),
 TO_DATE( '15-jan-1952','DD-MON-YYYY '), 'male'
 );

/* end sql /


/*system analyst*/

  Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Fox','Christopher',
 emp_ssn_seq.nextval, 40,
  (select dept_id from department where dept_id =410),
  (select job_code from job where job_code = 130),
  TO_DATE( '19- july-1977','DD-MON-YYYY '), 'male'
  );

 Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Deng', 'Alian',
 emp_ssn_seq.nextval, 30,
  (select dept_id from department where dept_id =410),
  (select job_code from job where job_code = 130),
  TO_DATE( '04-jun-1988', 'DD-MON-YYYY '), 'male');

                                                                                           23
/*end*/


/*database admins*/

 Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Jessica', 'Andy', emp_ssn_seq.nextval, 40,
  (select dept_id from department where dept_id =420),
  (select job_code from job where job_code = 80),
  TO_DATE( '01-Aug-1962','DD-MON-YYYY '), 'female'
  );

 Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Shirly', 'Davis', emp_ssn_seq.nextval, 40,
 (select dept_id from department where dept_id =420),
 (select job_code from job where job_code = 80),
 TO_DATE( '18-Aug-1962','DD-MON-YYYY '), 'female'
 );


   Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id,
job_code, dob, gender)
values (emp_emp_id_seq.nextval , 'Mathew', 'Brain', emp_ssn_seq.nextval, 40,
 (select dept_id from department where dept_id =420),
 (select job_code from job where job_code = 80),
 TO_DATE( '14-Aug-1980','DD-MON-YYYY '), 'male'
 );

    Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id,
job_code, dob, gender)
values (emp_emp_id_seq.nextval , 'Tyron', 'Banks', emp_ssn_seq.nextval, 40,
 (select dept_id from department where dept_id =420),
 (select job_code from job where job_code = 80),
 TO_DATE( '18-sep-1983','DD-MON-YYYY '), 'male'
 );

 /*end /

 /* db developer*/

Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Donna', 'Haris', emp_ssn_seq.nextval, 40,
 (select dept_id from department where dept_id =420),
 (select job_code from job where job_code = 60),
 TO_DATE( '12-oct-1982','DD-MON-YYYY '), 'female'

                                                                                          24
);

Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Linda', 'Mark', emp_ssn_seq.nextval, 40,
 (select dept_id from department where dept_id =420),
 (select job_code from job where job_code = 60),
 TO_DATE( '12-jul-1982','DD-MON-YYYY '), 'female'
 );

 Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Ruth', 'Baker', emp_ssn_seq.nextval, 40,
 (select dept_id from department where dept_id =420),
 (select job_code from job where job_code = 60),
 TO_DATE( '19-mar-1975','DD-MON-YYYY '), 'female'
 );

   Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id,
job_code, dob, gender)
values (emp_emp_id_seq.nextval , 'Kevin', 'Kenneth', emp_ssn_seq.nextval, 40,
 (select dept_id from department where dept_id =420),
 (select job_code from job where job_code = 60),
 TO_DATE( '09-mar-1975','DD-MON-YYYY '), 'male'
 );

 /* db developer end * /



 /* database modeler employee */

Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Isabella', 'Clinton'
, emp_ssn_seq.nextval, 40,
  (select dept_id from department where dept_id =420),
  (select job_code from job where job_code = 65),
  TO_DATE( '11-oct-1975','DD-MON-YYYY '), 'female'
  );

Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Sanford', 'Brown'
, emp_ssn_seq.nextval, 50,
  (select dept_id from department where dept_id =420),
  (select job_code from job where job_code = 65),
  TO_DATE( '08-nov-1972','DD-MON-YYYY '), 'male'
  );



                                                                                          25
Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Vonda', 'Ikenna'
, emp_ssn_seq.nextval, 30,
  (select dept_id from department where dept_id =420),
  (select job_code from job where job_code = 65),
  TO_DATE( '06-jun-1985','DD-MON-YYYY '), 'female'
  );

  Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Celina', 'Tobi'
, emp_ssn_seq.nextval, 30,
  (select dept_id from department where dept_id =420),
  (select job_code from job where job_code = 65),
  TO_DATE( '16-mar-1986','DD-MON-YYYY '), 'female'
  );


 /* end of sql */


/* database analyst */

Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Brenda', 'Bell'
, emp_ssn_seq.nextval, 30,
  (select dept_id from department where dept_id =420),
  (select job_code from job where job_code = 55),
  TO_DATE( '16-mar-1988','DD-MON-YYYY '), 'female'
  );

 Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Jaqueline', 'king'
, emp_ssn_seq.nextval, 50,
  (select dept_id from department where dept_id =420),
  (select job_code from job where job_code = 55),
  TO_DATE( '04-aug-1967','DD-MON-YYYY '), 'female'
  );

   Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Roland', 'king'
, emp_ssn_seq.nextval, 30,
  (select dept_id from department where dept_id =420),
  (select job_code from job where job_code = 55),
  TO_DATE( '04-jan-1987','DD-MON-YYYY '), 'male'

                                                                                            26
);

   Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id,
job_code, dob, gender)
values (emp_emp_id_seq.nextval , 'Michael', 'Stevens', emp_ssn_seq.nextval, 50,
 (select dept_id from department where dept_id =420),
 (select job_code from job where job_code = 55),
 TO_DATE( '25-dec-1974','DD-MON-YYYY '), 'male'
 );

 /*end of statement*/


/* java*/

Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Carol', 'Washington'
, emp_ssn_seq.nextval, 50,
  (select dept_id from department where dept_id =405),
  (select job_code from job where job_code = 50),
  TO_DATE( '12-jul-1984','DD-MON-YYYY '), 'female'
  );

Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Rebeca', 'Peterson',
 emp_ssn_seq.nextval, 30,
  (select dept_id from department where dept_id =405),
  (select job_code from job where job_code = 50),
  TO_DATE( '21-oct-1987','DD-MON-YYYY '), 'female'
  );

   Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id,
job_code, dob, gender)
values (emp_emp_id_seq.nextval , 'Cherri', 'Keys', emp_ssn_seq.nextval, 50,
 (select dept_id from department where dept_id =405),
 (select job_code from job where job_code = 50),
 TO_DATE( '25-apr-1983','DD-MON-YYYY '), 'female'
 );

 /*end of statement */

/*php/java scripts*/


Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Jerry','Springfield',
 emp_ssn_seq.nextval, 30,

                                                                                         27
(select dept_id from department where dept_id =405),
 (select job_code from job where job_code = 135),
 TO_DATE( '18-feb-1979
 ','DD-MON-YYYY '), 'male'
 );

Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Carlos', 'Winworth', emp_ssn_seq.nextval, 50,
 (select dept_id from department where dept_id =405),
 (select job_code from job where job_code =135),
 TO_DATE( '28-dec-1958','DD-MON-YYYY '), 'male'
 );

/*end*/

/* c++ developer */


Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Patrick', 'law',
 emp_ssn_seq.nextval, 40,
  (select dept_id from department where dept_id =405),
  (select job_code from job where job_code = 45),
  TO_DATE( '20-feb-1962','DD-MON-YYYY '), 'male'
  );

Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Jonas', 'lake'
,emp_ssn_seq.nextval, 50,
  (select dept_id from department where dept_id =405),
  (select job_code from job where job_code = 45),
  TO_DATE( '28-feb-1963','DD-MON-YYYY '), 'male'
  );

 /*end*/

/* HTRML/XHTML*/

Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Addie', 'Jude',
 emp_ssn_seq.nextval, 50,
  (select dept_id from department where dept_id =405),
  (select job_code from job where job_code = 140),
  TO_DATE( '19-may-1973','DD-MON-YYYY '), 'female'
  );



                                                                                         28
Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Adams', 'Wade'
,emp_ssn_seq.nextval, 50,
  (select dept_id from department where dept_id =405),
  (select job_code from job where job_code = 140),
  TO_DATE( '20-sep-1975','DD-MON-YYYY '), 'male'
  );

 /*end*/

/* phython */


  Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Robert', 'Lopez',
 emp_ssn_seq.nextval, 50,
  (select dept_id from department where dept_id =405),
  (select job_code from job where job_code = 145),
  TO_DATE( '2-jan -1983','DD-MON-YYYY '), 'male'
  );

/*end*/

 /* technical writer*/

Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Ray', 'Richmond',
 emp_ssn_seq.nextval, 50,
  (select dept_id from department where dept_id =400),
  (select job_code from job where job_code = 85),
  TO_DATE( '2-oct-1982','DD-MON-YYYY '), 'male'
  );

  Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Zack','Richmond',
 emp_ssn_seq.nextval, 50,
  (select dept_id from department where dept_id =400),
  (select job_code from job where job_code = 85),
  TO_DATE( '2-jan-1963','DD-MON-YYYY '), 'male'
  );

 Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Ashland', 'Kedzie',
 emp_ssn_seq.nextval, 50,
  (select dept_id from department where dept_id =400),

                                                                                           29
(select job_code from job where job_code = 85),
 TO_DATE( '06-jul-1969','DD-MON-YYYY '), 'female'
 );

/*end */


/*project manager*/

  Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Joel' , 'Jeremiah',
 emp_ssn_seq.nextval, 60,
  (select dept_id from department where dept_id =425),
  (select job_code from job where job_code = 90),
  TO_DATE( '20-oct-1958','DD-MON-YYYY '), 'male'
  );

  Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Zack','Isaiah',
 emp_ssn_seq.nextval, 50,
  (select dept_id from department where dept_id =425),
  (select job_code from job where job_code = 90),
  TO_DATE( '13-oct-1966','DD-MON-YYYY '), 'male'
  );

 Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Ashland', 'Macnell',
 emp_ssn_seq.nextval, 50,
  (select dept_id from department where dept_id =425),
  (select job_code from job where job_code = 90),
  TO_DATE( '06-jul-1969','DD-MON-YYYY '), 'female'
  );

/*end*/


/*network specialist*/

 Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Sam', 'Walteron',
 emp_ssn_seq.nextval,50,
  (select dept_id from department where dept_id =415),
  (select job_code from job where job_code = 95),
  TO_DATE( '14-apr-1951','DD-MON-YYYY '), 'male'
  );



                                                                                           30
Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Jacob', 'Henson',
 emp_ssn_seq.nextval, 40,
  (select dept_id from department where dept_id =415),
  (select job_code from job where job_code = 100),
  TO_DATE( '13-jan-1970','DD-MON-YYYY '), 'male'
  );

 Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Lee', 'Chin',
 emp_ssn_seq.nextval, 30,
  (select dept_id from department where dept_id =415),
  (select job_code from job where job_code = 105),
  TO_DATE( '09-sep-1984', 'DD-MON-YYYY '), 'male');

/*end*/


 /*accounting and fianace */

Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Rose', 'Henson',
 emp_ssn_seq.nextval, 40,
  (select dept_id from department where dept_id =430),
  (select job_code from job where job_code = 115),
  TO_DATE( '13-jan-1970','DD-MON-YYYY '), 'female'
  );

 Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Jackie', 'Hopewell',
 emp_ssn_seq.nextval, 30,
  (select dept_id from department where dept_id =430),
  (select job_code from job where job_code = 120),
  TO_DATE( '09-sep-1984', 'DD-MON-YYYY '), 'female');

/*end*/


  /*test analyst*/

Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Derick', 'Charles',
 emp_ssn_seq.nextval, 40,
  (select dept_id from department where dept_id =400),
  (select job_code from job where job_code = 125),

                                                                                           31
TO_DATE( '25-july-1970','DD-MON-YYYY '), 'male'
 );

 Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code,
dob, gender)
values (emp_emp_id_seq.nextval , 'Lou', 'Shih',
 emp_ssn_seq.nextval, 30,
  (select dept_id from department where dept_id =400),
  (select job_code from job where job_code = 125),
  TO_DATE( '04-jun-1989', 'DD-MON-YYYY '), 'female');

/*end*/

/* insert records of employees associated with project */


/* projct 900 */


insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 1200
  , (select emp_id from employee where emp_id = 34434)
  , (select proj_num from project where proj_num = 900 ) );


 insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 900
  , (select emp_id from employee where emp_id = 34304)
  , (select proj_num from project where proj_num = 900));


insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 900
  ,(select emp_id from employee where emp_id = 33914)
  , (select proj_num from project where proj_num = 900));


 insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 900
  , (select emp_id from employee where emp_id = 33784)
  , (select proj_num from project where proj_num = 900));


 insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 890

                                                                                          32
, (select emp_id from employee where emp_id = 34174 )
 , (select proj_num from project where proj_num = 900));


 insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 890
  , (select emp_id from employee where emp_id =34564 )
  , (select proj_num from project where proj_num = 900));


 insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 890
  , (select emp_id from employee where emp_id = 35084)
  , (select proj_num from project where proj_num = 900));

insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 890
  , (select emp_id from employee where emp_id =34954)
  , (select proj_num from project where proj_num = 900));

 insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 890
  , (select emp_id from employee where emp_id = 36514)
  , (select proj_num from project where proj_num = 900));


 insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 989
  , (select emp_id from employee where emp_id = 36384)
  , (select proj_num from project where proj_num = 900));



 insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 1000
  , (select emp_id from employee where emp_id = 30664 )
  , (select proj_num from project where proj_num = 900));


insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 400
  , (select emp_id from employee where emp_id = 30534 )
  , (select proj_num from project where proj_num = 900));

                                                                                         33
insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 980
  , (select emp_id from employee where emp_id = 31054)
  , (select proj_num from project where proj_num = 900));


insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 800
  , (select emp_id from employee where emp_id = 31314 )
  , (select proj_num from project where proj_num = 900));


 insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 690
  , (select emp_id from employee where emp_id = 33394 )
  , (select proj_num from project where proj_num = 900));

insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 550
  , (select emp_id from employee where emp_id = 33264 )
  , (select proj_num from project where proj_num = 900));

insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun-2008', 'dd-mon-yyyy'), 1200,
    (select emp_id from employee where emp_id = 32224)
  , (select proj_num from project where proj_num = 900));

insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun-2008', 'dd-mon-yyyy'), 980,
    (select emp_id from employee where emp_id = 32094)
  , (select proj_num from project where proj_num = 900));

insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 550
  , (select emp_id from employee where emp_id = 32874 )
  , (select proj_num from project where proj_num = 900));

insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun-2008', 'dd-mon-yyyy'), 1200,

                                                                                         34
(select emp_id from employee where emp_id = 31704 )
 , (select proj_num from project where proj_num = 900));

insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun-2008', 'dd-mon-yyyy'), 980,
    (select emp_id from employee where emp_id = 35994)
  , (select proj_num from project where proj_num = 900));


insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun-2008', 'dd-mon-yyyy'), 1200,
    (select emp_id from employee where emp_id = 36124 )
  , (select proj_num from project where proj_num = 900));

insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-jun-2008', 'dd-mon-yyyy'), 980,
    (select emp_id from employee where emp_id = 36254 )
  , (select proj_num from project where proj_num = 900));


 /* project num 905 */

insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 980
  , (select emp_id from employee where emp_id = 35214)
  , (select proj_num from project where proj_num = 905));

insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 780
  , (select emp_id from employee where emp_id = 36384)
  , (select proj_num from project where proj_num = 905));

insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 890
  , (select emp_id from employee where emp_id = 34824)
  , (select proj_num from project where proj_num = 905));

 insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 400
  , (select emp_id from employee where emp_id = 34044)
  , (select proj_num from project where proj_num = 55));




                                                                                         35
insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 400,
    (select emp_id from employee where emp_id = 34174)
  , (select proj_num from project where proj_num = 905));


insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 500,
    (select emp_id from employee where emp_id = 34434)
  , (select proj_num from project where proj_num = 905));


 insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 800,
    (select emp_id from employee where emp_id = 34304)
  , (select proj_num from project where proj_num = 905));


  insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 789,
    (select emp_id from employee where emp_id = 33784 )
  , (select proj_num from project where proj_num = 905));


 insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 789,
    (select emp_id from employee where emp_id = 32224 )
  , (select proj_num from project where proj_num = 905));


   insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 890,
    (select emp_id from employee where emp_id = 32484)
  , (select proj_num from project where proj_num = 905));


 insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 900,
    (select emp_id from employee where emp_id = 32744)
  , (select proj_num from project where proj_num = 905));




                                                                                        36
insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 989,
    (select emp_id from employee where emp_id = 30404)
  , (select proj_num from project where proj_num = 905));

insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'),900,
    (select emp_id from employee where emp_id = 30924 )
  , (select proj_num from project where proj_num = 905));


insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 1500,
    (select emp_id from employee where emp_id = 31834)
  , (select proj_num from project where proj_num = 905));

insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 1400,
    (select emp_id from employee where emp_id = 31444)
  , (select proj_num from project where proj_num = 905));

insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 699,
    (select emp_id from employee where emp_id = 35994)
  , (select proj_num from project where proj_num = 905));

  insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 850,
    (select emp_id from employee where emp_id = 35864)
  , (select proj_num from project where proj_num = 905));


insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 90,
    (select emp_id from employee where emp_id = 36124)
  , (select proj_num from project where proj_num = 905));

  insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 850,
    (select emp_id from employee where emp_id = 36254)
  , (select proj_num from project where proj_num = 905));



                                                                                         37
insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 850,
    (select emp_id from employee where emp_id = 33134)
  , (select proj_num from project where proj_num = 905));

/*end of project 905 */


/* project 910 */


 insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('01-feb-2011', 'dd-mon-yyyy'), 1800,
    (select emp_id from employee where emp_id = 33654 )
  , (select proj_num from project where proj_num = 910));

 insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('01-feb-2011', 'dd-mon-yyyy'), 1200,
    (select emp_id from employee where emp_id = 33524 )
  , (select proj_num from project where proj_num = 910));

 insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('01-feb-2011', 'dd-mon-yyyy'), 1340,
    (select emp_id from employee where emp_id = 32354)
  , (select proj_num from project where proj_num = 910));

    insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('01-feb-2011', 'dd-mon-yyyy'), 980,
    (select emp_id from employee where emp_id = 33004)
  , (select proj_num from project where proj_num = 910));

    insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('01-feb-2011', 'dd-mon-yyyy'), 1050,
    (select emp_id from employee where emp_id = 32614 )
  , (select proj_num from project where proj_num = 910));

      insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours,
emp_id, proj_num)
 values ( assign_assign_num_seq.nextval, to_date('01-feb-2011', 'dd-mon-yyyy'), 1300,
   (select emp_id from employee where emp_id = 31184 )
 , (select proj_num from project where proj_num = 910));

  insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)

                                                                                         38
values ( assign_assign_num_seq.nextval, to_date('01-feb-2011', 'dd-mon-yyyy'), 290,
   (select emp_id from employee where emp_id = 30794)
 , (select proj_num from project where proj_num = 910));

  insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('01-feb-2011', 'dd-mon-yyyy'), 800,
    (select emp_id from employee where emp_id = 31964 )
  , (select proj_num from project where proj_num = 910));


insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('01-feb-2011', 'dd-mon-yyyy'), 780,
    (select emp_id from employee where emp_id = 31574)
  , (select proj_num from project where proj_num = 910));


 insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('27-dec-2010', 'dd-mon-yyyy'), 550,
    (select emp_id from employee where emp_id = 34694 )
  , (select proj_num from project where proj_num = 910));


insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('27-dec-2010', 'dd-mon-yyyy'), 650,
    (select emp_id from employee where emp_id = 35734 )
  , (select proj_num from project where proj_num = 910));


insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('27-dec-2010', 'dd-mon-yyyy'), 890,
    (select emp_id from employee where emp_id = 34434 )
  , (select proj_num from project where proj_num = 910));


insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('27-dec-2010', 'dd-mon-yyyy'), 900,
    (select emp_id from employee where emp_id = 32224 )
  , (select proj_num from project where proj_num = 910));

insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('27-dec-2010', 'dd-mon-yyyy'), 900,
    (select emp_id from employee where emp_id = 30404)
  , (select proj_num from project where proj_num = 910));

                                                                                        39
insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('27-dec-2010', 'dd-mon-yyyy'), 1200,
    (select emp_id from employee where emp_id = 31834 )
  , (select proj_num from project where proj_num = 910));


insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id,
proj_num)
  values ( assign_assign_num_seq.nextval, to_date('27-dec-2010', 'dd-mon-yyyy'), 550,
    (select emp_id from employee where emp_id = 34174)
  , (select proj_num from project where proj_num = 910));


 /* update assign hours*/

 update assignment
set assign_hours = 1200
where ASSIGNMENT_NUM = 5824
/*end sql*/




/*end*/

/* updates the cost for each employee based on their pay rate */


update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num =5296 )
where emp_id = 35214
and Assignment_Num =5296 ;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num =5308 )
where emp_id = 36384
and Assignment_Num =5308 ;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num =5320)
where emp_id = 34824
and Assignment_Num =5320 ;




                                                                                         40
update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num =5344 )
where emp_id = 34174
and Assignment_Num =5344 ;


update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num =5356 )
where emp_id = 34434
and Assignment_Num =5356 ;


update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num =5368)
where emp_id = 34044
and Assignment_Num =5368 ;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num =5380)
where emp_id =33784
and Assignment_Num = 5380;


update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num =5392)
where emp_id = 34304
and Assignment_Num =5392 ;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num =5404)
where emp_id = 32224
and Assignment_Num =5404 ;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num =5416)
where emp_id = 32484
and Assignment_Num =5416 ;


 update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5428)
where emp_id = 32744

                                                                                         41
and Assignment_Num = 5428 ;


update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5440)
where emp_id = 30404
and Assignment_Num = 5440 ;


 update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5452)
where emp_id = 30924
and Assignment_Num = 5452 ;

 update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5464)
where emp_id = 31834
and Assignment_Num = 5464;


update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5488)
where emp_id = 35994
and Assignment_Num = 5488;



update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5500)
where emp_id = 35864
and Assignment_Num = 5500;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5476 )
where emp_id = 31444
and Assignment_Num = 5476;


update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5512 )
where emp_id = 36124
and Assignment_Num = 5512;



                                                                                         42
update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5524 )
where emp_id = 36254
and Assignment_Num = 5524 ;


update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5536 )
where emp_id = 33134
and Assignment_Num = 5536;


update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5188 )
where emp_id = 33394
and Assignment_Num = 5188;

 update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5200 )
where emp_id = 33264
and Assignment_Num = 5200;


update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5212)
where emp_id = 32224
and Assignment_Num = 5212;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5224 )
where emp_id = 32094
and Assignment_Num = 5224 ;

 update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5236 )
where emp_id = 32874
and Assignment_Num = 5236;


update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5248 )
where emp_id = 31704

                                                                                         43
and Assignment_Num = 5248;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5260 )
where emp_id = 35994
and Assignment_Num = 5260 ;

 update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5272)
where emp_id = 36124
and Assignment_Num = 5272;


update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5020)
where emp_id = 34434
and Assignment_Num = 5020;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5032 )
where emp_id = 34304
and Assignment_Num = 5032 ;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5044 )
where emp_id = 33914
and Assignment_Num = 5044 ;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5056 )
where emp_id = 33784
and Assignment_Num = 5056 ;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5068 )
where emp_id = 34174
and Assignment_Num = 5068;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5080)
where emp_id = 34564
and Assignment_Num = 5080 ;

                                                                                         44
update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5092 )
where emp_id = 35084
and Assignment_Num = 5092;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5104 )
where emp_id = 34954
and Assignment_Num = 5104 ;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5116 )
where emp_id = 36514
and Assignment_Num = 5116;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5128 )
where emp_id = 36384
and Assignment_Num = 5128 ;

 update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5140 )
where emp_id = 30664
and Assignment_Num = 5140 ;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5152)
where emp_id = 30534
and Assignment_Num = 5152;


update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5164 )
where emp_id = 31054
and Assignment_Num = 5164 ;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5176 )
where emp_id = 31314
and Assignment_Num = 5176;



                                                                                         45
update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 91608)
where emp_id = 36254
and Assignment_Num = 91608;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5284 )
where emp_id = 36254
and Assignment_Num = 5284 ;


update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5608 )
where emp_id = 33654
and Assignment_Num = 5608;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5620 )
where emp_id = 33524
and Assignment_Num = 5620;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5632)
where emp_id = 32354
and Assignment_Num = 5632 ;


update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5644 )
where emp_id = 33004
and Assignment_Num = 5644 ;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5656)
where emp_id = 31184
and Assignment_Num = 5656;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5680 )
where emp_id = 30794
and Assignment_Num = 5680;



                                                                                         46
update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5668)
where emp_id = 32614
and Assignment_Num = 5668 ;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5692 )
where emp_id = 31964
and Assignment_Num = 5692 ;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5704 )
where emp_id = 31574
and Assignment_Num = 5704 ;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5740 )
where emp_id = 34694
and Assignment_Num = 5740;

 update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5752)
where emp_id = 35734
and Assignment_Num = 5752 ;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5764 )
where emp_id = 34434
and Assignment_Num = 5764 ;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5776 )
where emp_id = 32224
and Assignment_Num = 5776;


 update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5788 )
where emp_id = 30404
and Assignment_Num = 5788 ;

update assignment

                                                                                         47
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5812 )
where emp_id = 31834
and Assignment_Num = 5812 ;

update assignment
set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a
on e.emp_id = a.emp_id where a.Assignment_Num = 5824)
where emp_id = 34174
and Assignment_Num = 5824;



/*end*/



/* inserts the record for employee contact information */


insert into contact (contact_id, emp_id, address, city, h_state, phone_home, phone_work,
email_office)
 values (con_contact_id_seq.nextval,
   ( select emp_id from employee where emp_id = 35474), '8080 W Maddison', 'City
Heights', 'NJ', 2029091840, 82500920, 'ray.rich@sunlife.com');

 insert into contact (contact_id, emp_id, address, city, h_state, phone_home, phone_work,
email_office)
  values (con_contact_id_seq.nextval,
   ( select emp_id from employee where emp_id = 30794), '909 E Hudson', 'New York
City', 'NY', 2098908860, 82500922, 'zach.rich@sunlife.com') ;

insert into contact (contact_id, emp_id, address, apt_num, city, h_state, phone_home,
phone_work, email_office)
 values (con_contact_id_seq.nextval,
   ( select emp_id from employee where emp_id = 34434), '4040 E Fifth Ave', '18GC',
'New York City', 'NY', 2013499292, 82500924, 'ashland.kediz@sunlife.com');

insert into contact (contact_id, emp_id, address, apt_num, city, h_state, phone_home,
phone_work, email_office)
 values (con_contact_id_seq.nextval,
   ( select emp_id from employee where emp_id = 30404), '1900 S Lake Pine Dr', '2d',
'New England', 'CT', 2420017540, 82500923, 'derick.charl@sunlife.com');

insert into contact (contact_id, emp_id, address, apt_num, city, h_state, phone_home,
phone_work, email_office)
 values (con_contact_id_seq.nextval,
   ( select emp_id from employee where emp_id = 34174), '1200 S brodway Dr', '4c',
'New bedford Park', 'CT', 2123988019, 82500926, 'lou.shi@sunlife.com');



                                                                                            48
Database Snappshot




The log file could not be captured with a web browser. The following captured pictures
reprsents the database state.
Figure 1 described issued command describes table structure for Department, Project and
Employee. The describe isssued command in figure 2 describes the table structures for
Job, Contact and Assiignment.




                                                                                          49
Figure 1 Table Structures




                            50
Figure 2 Table Structure




                           51
Figure 3 Contact Table Data




                              52
Figure 4 Department Table Data




                                 53
Figure 5 Project Table Data




                              54
Figure 6 Employee Table Data




                               55
Figure 7 Employee Table Data




                               56
Figure 8 Assignment Table Data




                                 57
Figure 9 Assignment Table Data




                                 58
Figure 10 Assignment Table Data




                                  59
Figure 11 Job Table Data




                           60
61
Deliverable 5 - SQL Queries


/* Show me name of employess whose job code is 65 */

SELECT first_name, last_name, job_code
from employee
where job_code= '65';




        First_Name             Last_Name              Job_Code
         Sanford                Brown                     65
          Vonda                 Ikenna                    65
          Celina                 Tobi                     65
         Isabella               Clinton                   65

                                        Table 8


/* Show me the total number of employess for different job codes */


SELECT job_code, count (*) as Total_number
from employee
Group by job_code;


               JOB_CODE                                 TOTAL_NUMBER
                  115                                         1
                  125                                         2
                   70                                         3
                  135                                         2
                  105                                         1
                   60                                         4
                   50                                         3
                   45                                         2
                  145                                         1
                  140                                         2
                   85                                         3
                  130                                         2
                   65                                         4
                   55                                         4


                                                                       62
95                                            1
                    90                                            3
                   100                                            1
                   120                                            1
                    75                                            4
                    80                                            4


                                   Table 9


/* Show me the lowest rate for job code 65 */

select min(emp_rate) "Lowest Rate"
from employee
where job_code= '65'
group by job_code;



Lowest Rate
                                                                                       30
                                       Table 10




/* Show me the name of employees with highest rate . List them by their first name*/

select first_name , last_name, emp_rate AS Lowest_emp_rate
from employee
where
emp_rate =
(select min(emp_rate)
from employee )
order by first_name;



FIRST_NAME           LAST_NAME               LOWEST_EMP_RATE
     Brenda                Bell                     30
     Celina                Tobi                     30
      Deng                Alian                     30
     Jackie              Hopewell                   30
      Jerry             Springfield                 30
       Lee                 Chin                     30


                                                                                            63
Lou                   Shih                     30


                              Table 11




/* subquery, Show the list of employees whose emp rate is greater than average rate */


select initcap(first_name) as FIRST_NAME, initcap (last_name) as LAST_NAME,
initcap(gender) as GENDER, emp_rate
from employee
where emp_rate > ( select avg(emp_rate) from employee);

FIRST_NAME             LAST_NAME             GENDER           EMP_RATE
     Sanford                Brown               Male               50
    Jaqueline                King              Female              50
     Michael               Stevens              Male               50
      Carol              Washington            Female              50
      Cherri                 Keys              Female              50
      Carlos              Winworth              Male               50
      Jonas                  Lake               Male               50
      Addie                  Jude              Female              50
     Adams                  Wade                Male               50
     Robert                 Lopez               Male               50
       Ray                Richmond              Male               50
       Zack               Richmond              Male               50
     Ashland                Kedzie             Female              50
       Joel               Jeremiah              Male               60
       Zack                 Isaiah              Male               50
     Ashland               Macnell             Female              50
       Sam                Walteron              Male               50
      Sunny                Mccook               Male               50
     Mariah                Johnson             Female              50

                                 Table 12




                                                                                         64
/* Show the list of the employees who are working on the project assigned in the past 6
months */



Select e.first_name,e.last_name , a.assign_date, assignment_num
from employee e, assignment a
where
e.emp_id=a.emp_id
and
assign_date > (add_months(sysdate, -6))

FIRST_NAME           LAST_NAME             ASSIGN_DATE            ASSIGNMENT_NUM
     Joel                Roland               01-FEB-11                 5680
    Marxwall                Luther             01-FEB-11                   5656
      Jessica               Andy               01-FEB-11                   5704
      Tyron                 Banks              01-FEB-11                   5692
       Ruth                 Baker              01-FEB-11                   5632
     Isabella              Clinton             01-FEB-11                   5668
      Celina                 Tobi              01-FEB-11                   5644


                                        Table 13


/* Joining Three Tables.Show the name of employee , their ID, and project description
whose projects are overdue today */



select emp_id, e.first_name, proj_name, p.due_date
from employee e JOIN assignment a
using(emp_id)
JOIN
project p
using (proj_num)
where
due_date< sysdate




                                                                                          65
EMP_ID   FIRST_NAME          PROJ_NAME              DUE_DATE    EMP_ID

 32744     Sanford     St Paul College Web System   02-FEB-11    32744
                             Development
 32874      Vonda        New York Ticket Corp       09-SEP-10    32874
                            Payment System
 33134      Brenda     St Paul College Web System   02-FEB-11    33134
                             Development
 33264     Jaqueline     New York Ticket Corp       09-SEP-10    33264
                            Payment System
 33394      Roland       New York Ticket Corp       09-SEP-10    33394
                            Payment System
 33784     Rebeca      St Paul College Web System   02-FEB-11    33784
                             Development
 33784     Rebeca        New York Ticket Corp       09-SEP-10    33784
                            Payment System
 33914      Cherri       New York Ticket Corp       09-SEP-10    33914
                            Payment System
 34044       Jerry     St Paul College Web System   02-FEB-11    34044
                             Development
 34174      Carlos     St Paul College Web System   02-FEB-11    34174
                             Development
 34174      Carlos       New York Ticket Corp       09-SEP-10    34174
                            Payment System
 34304      Patrick    St Paul College Web System   02-FEB-11    34304
                             Development
 34304      Patrick      New York Ticket Corp       09-SEP-10    34304
                            Payment System
 34434      Jonas      St Paul College Web System   02-FEB-11    34434
                             Development
 34434      Jonas        New York Ticket Corp       09-SEP-10    34434



                                                                         66
Payment System
34564   Addie       New York Ticket Corp       09-SEP-10   34564
                       Payment System
34824   Robert    St Paul College Web System   02-FEB-11   34824
                        Development
34954    Ray        New York Ticket Corp       09-SEP-10   34954
                       Payment System
35084    Zack       New York Ticket Corp       09-SEP-10   35084
                       Payment System
35214   Ashland   St Paul College Web System   02-FEB-11   35214
                        Development
35864    Jacob    St Paul College Web System   02-FEB-11   35864
                        Development
35994    Lee      St Paul College Web System   02-FEB-11   35994
                        Development
35994    Lee        New York Ticket Corp       09-SEP-10   35994
                       Payment System
36124    Rose     St Paul College Web System   02-FEB-11   36124
                        Development
36124    Rose       New York Ticket Corp       09-SEP-10   36124
                       Payment System
36254   Jackie    St Paul College Web System   02-FEB-11   36254
                        Development
36254   Jackie      New York Ticket Corp       09-SEP-10   36254
                       Payment System
36384   Derick    St Paul College Web System   02-FEB-11   36384
                        Development
36384   Derick      New York Ticket Corp       09-SEP-10   36384
                       Payment System
30404   Sunny     St Paul College Web System   02-FEB-11   30404
                        Development
30534   Mariah      New York Ticket Corp       09-SEP-10   30534
                       Payment System


                                                                   67
30664   James      New York Ticket Corp       09-SEP-10   30664
                      Payment System
30924   Susan    St Paul College Web System   02-FEB-11   30924
                       Development
31054    Peter     New York Ticket Corp       09-SEP-10   31054
                      Payment System
31314    Fox       New York Ticket Corp       09-SEP-10   31314
                      Payment System
31444    Deng    St Paul College Web System   02-FEB-11   31444
                       Development
31704   Shirly     New York Ticket Corp       09-SEP-10   31704
                      Payment System
31834   Mathew   St Paul College Web System   02-FEB-11   31834
                       Development
32094   Donna      New York Ticket Corp       09-SEP-10   32094
                      Payment System
32224   Linda    St Paul College Web System   02-FEB-11   32224
                       Development
32224   Linda      New York Ticket Corp       09-SEP-10   32224
                      Payment System
32484   Kevin    St Paul College Web System   02-FEB-11   32484
                       Development
36514    Lou       New York Ticket Corp       09-SEP-10   36514
                      Payment System




                         Table 14




                                                                  68
Deliverable 6 -Database Maintenance Scripts

/* create the dependent table*/

CREATE TABLE DEPENDENT
  (
   Depend_Num Number (5),
   First_Name VARCHAR2(50),
   Last_Name VARCHAR2(50),
    Dep_Dob DATE ,
   Emp_id NUMBER,
        Depend_Type varchar2(20)
 );

 /* create the sequence for the primary key for depend_num*/

create sequence depend_depend_num_seq
start with 065000
increment by 13
Nocycle;

/* creates the constraints assiocated with dependent table */

 Alter table DEPENDENT
  modify (first_name CONSTRAINT depend_first_name_nn not null)
        modify (last_name CONSTRAINT depend_last_name_nn not null)
        modify (dep_DOB CONSTRAINT depend_dep_dob_mn not null )
  modify (emp_id CONSTRAINT depend_Emp_id_nn NOT NULL)
        modify (Depend_Type CONSTRAINT depend_Depend_Type_nn NOT
NULL);


 Alter table DEPENDENT
   add constraint depend_Depend_num_pk PRIMARY KEY (Depend_Num);

Alter table DEPENDENT
  add CONSTRAINT Depend_Emp_id_fk FOREIGN KEY(Emp_id) REFERENCES
EMPLOYEE(Emp_id);




                                                                     69
DML Statements


insert into dependent (depend_num, first_name, last_name, dep_dob, emp_id,
Depend_Type )
       values ( depend_depend_num_seq.nextval, 'Nancy', 'Brown', to_date('18-oct-1969',
'dd-mon-yyyy'),
                       (select emp.emp_id from employee emp where emp.emp_id =
32744),
                                 'Wife'
                      );

insert into dependent (depend_num, first_name, last_name, dep_dob, emp_id,
Depend_Type )
       values ( depend_depend_num_seq.nextval, 'John', 'Ikenna', to_date('08-dec-1985',
'dd-mon-yyyy'),
                       (select emp.emp_id from employee emp where emp.emp_id =
32874),
                                 'Husband'
                      );

insert into dependent (depend_num, first_name, last_name, dep_dob, emp_id,
Depend_Type )
       values ( depend_depend_num_seq.nextval, 'Greg', 'Tobi', to_date('12-mar-1985',
'dd-mon-yyyy'),
                       (select emp.emp_id from employee emp where emp.emp_id =
33004),
                                 'Partner'
                      );
insert into dependent (depend_num, first_name, last_name, dep_dob, emp_id,
Depend_Type )
       values ( depend_depend_num_seq.nextval, 'Mariah', 'Winfield', to_date('09-apr-
1969', 'dd-mon-yyyy'),
                       (select emp.emp_id from employee emp where emp.emp_id =
33134),
                                 'Partner'
                      );

insert into dependent (depend_num, first_name, last_name, dep_dob, emp_id,
Depend_Type )
       values ( depend_depend_num_seq.nextval, 'luther', 'king', to_date('09-apr-1988',
'dd-mon-yyyy'),
                       (select emp.emp_id from employee emp where emp.emp_id =
33394),
                                 'Partner'
                      );


                                                                                          70
insert into dependent (depend_num, first_name, last_name, dep_dob, emp_id,
Depend_Type )
       values ( depend_depend_num_seq.nextval, 'Rolland-H', 'king', to_date('01-jan-
1969', 'dd-mon-yyyy'),
                       (select emp.emp_id from employee emp where emp.emp_id =
33264),
                                 'Husband'
                      );

insert into dependent (depend_num, first_name, last_name, dep_dob, emp_id,
Depend_Type )
       values ( depend_depend_num_seq.nextval, 'Gladys', 'Stevens', to_date('01-jan-
1980', 'dd-mon-yyyy'),
                      (select emp.emp_id from employee emp where emp.emp_id =
33524 ),
                                'Wife'
                     );

insert into dependent (depend_num, first_name, last_name, dep_dob, emp_id,
Depend_Type )
       values ( depend_depend_num_seq.nextval, 'Grace', 'Zack', to_date('24-aug-1965',
'dd-mon-yyyy'),
                       (select emp.emp_id from employee emp where emp.emp_id =
35474 ),
                                 'Wife'
                      );
insert into dependent (depend_num, first_name, last_name, dep_dob, emp_id,
Depend_Type )
       values ( depend_depend_num_seq.nextval, 'Grace', 'Zack', to_date('24-aug-1965',
'dd-mon-yyyy'),
                       (select emp.emp_id from employee emp where emp.emp_id =
35474 ),
                                 'Wife'
                      );




                                                                                         71
/* display all dependents */


SELECT * FROM DEPENDENT




DEPEND_NUM FIRST_NAME LAST_NAME DEP_DOB                               EMP_ID DEPEND_TYPE
   65000      Nancy      Brown   18-OCT-69                             32744      Wife
   65013        John     Ikenna  08-DEC-85                             32874    Husband
   65026        Greg      Tobi   12-MAR-85                             33004     Partner
   65039      Mariah    Winfield 09-APR-69                             33134     Partner
   65052       luther     King   09-APR-88                             33394     Partner
   65065     Rolland-H    King   01-JAN-69                             33264    Husband
   65078      Gladys    Stevens  01-JAN-80                             33524      Wife
   65091       Grace      Zack   24-AUG-65                             35474      Wife


                                       Table 15




/* list the dependent name and their correspondanting employee*/


select e.emp_id, initcap(e.first_name) ||','||initcap(e.last_name) as Employee_Name,
dep.depend_num, dep.dep_dob, initcap(dep.first_name)||','||initcap(dep.last_name) as
Dependent_Name,
dep.depend_type
from employee e inner join dependent dep
on e.emp_id = dep.emp_id;




                                                                                       72
EMP_ID   EMPLOYEE_NAME DEPEND_NUM      DEP_DOB      DEPENDENT_NAME          DEPEND_TYPE


32744     Sanford,Brown     65000       18-OCT-69          Nancy,Brown           Wife
32874      Vonda,Ikenna     65013       08-DEC-85          John,Ikenna          Husband
33004       Celina,Tobi     65026       12-MAR-85           Greg,Tobi           Partner
33134       Brenda,Bell     65039       09-APR-69         Mariah,Winfield       Partner
33264     Jaqueline,King    65065       01-JAN-69         Rolland-H,King        Husband
33394      Roland,King      65052       09-APR-88          Luther,King          Partner
33524     Michael,Stevens   65078       01-JAN-80         Gladys,Stevens         Wife

                                    Table 16




                            Figure 12 Update Statements




                                                                                   73
/* the Spouse changed her first_name */

    update dependent
    set first_name = 'Lisa'
    where DEPEND_NUM = 65000;

    /* the spouse birth day was changed */

    update dependent
    set dep_dob = '28-Aug-1965'
    where DEPEND_NUM = 65013;


    /* the spouse got separated and was removed*/

    delete dependent
    where DEPEND_NUM = 65039;

    /* changes the name of the colum dep_dob */

    Alter table dependent
     Rename column dep_dob to DOB



    /* Display all dependents with updated information */
    SELECT * FROM DEPENDENT

DEPEND_NUM       FIRST_NAME        LAST_NAME         DEP_DOB    EMP_ID   DEPEND_TYPE
65000            Lisa              Brown            18-OCT-69   32744    Wife
65013            John              Ikenna           28-AUG-65   32874    Husband
65026            Greg              Tobi             12-MAR-85   33004    Partner
65052            luther            king             09-APR-88   33394    Partner
65065            Rolland-H         king             01-JAN-69   33264    Husband
65078            Gladys            Stevens          01-JAN-80   33524    Wife
65091            Grace             Zack             24-AUG-65   35474    Wife
                                         Table 17




                                                                                   74
Deliverable 7 – Functons & Stored Procedure
/* lower function*/




SELECT LOWER(p.PROJ_NAME) as PROJ_NAME, p.DUE_DATE,
CONCAT(CONCAT(e.FIRST_NAME,' '), e.LAST_NAME) as PROJ_MANAGER
FROM PROJECT p ,EMPLOYEE e WHERE p.PROJ_MGR_ID=e.EMP_ID;




            PROJ_NAME                       DUE_DATE     PROJ_MANAGER

wbbmn urban tv system development            27-DEC-13    Joel Jeremiah


 citizens bank database development         09-AUG-12      Zack Isaiah


new york ticket corp payment system          09-SEP-10   Ashland Macnell
      st paul college web system
            development                      02-FEB-11   Ashland Macnell

                                      Table 18




/* UPPER And INITCAP Character Function */


SELECT UPPER(p.PROJ_NAME) as PROJ_NAME, p.DUE_DATE,
INITCAP(CONCAT(CONCAT(e.FIRST_NAME,' '), e.LAST_NAME)) as
PROJ_MANAGER FROM PROJECT p ,EMPLOYEE e WHERE
p.PROJ_MGR_ID=e.EMP_ID




                                                                           75
PROJ_NAME                        DUE_DATE          PROJ_MANAGER
   WBBMN URBAN TV SYSTEM
        DEVELOPMENT                         27-DEC-13         Joel Jeremiah
   CITIZENS BANK DATABASE
        DEVELOPMENT                         09-AUG-12          Zack Isaiah
NEW YORK TICKET CORP PAYMENT
            SYSTEM                          09-SEP-10       Ashland Macnell
 ST PAUL COLLEGE WEB SYSTEM                 02-FEB-11       Ashland Macnell
        DEVELOPMENT


                                 Table 19



     /* RPAD And SUBSTR Character Functions*/

     SELECT RPAD(SUBSTR(p.PROJ_NAME,1,15),18,'.') as PROJ_NAME,
     p.DUE_DATE, INITCAP(CONCAT(CONCAT(e.FIRST_NAME,' '), e.LAST_NAME))
     as PROJ_MANAGER FROM PROJECT p ,EMPLOYEE e WHERE
     p.PROJ_MGR_ID=e.EMP_ID;


          PROJ_NAME                  DUE_DATE           PROJ_MANAGER
       WBBMN Urban TV...             27-DEC-13           Joel Jeremiah
         Citizens Bank D...          09-AUG-12            Zack Isaiah
        New York Ticket...            09-SEP-10         Ashland Macnell
         St Paul College...           02-FEB-11         Ashland Macnell


                                      Table 20




                                                                              76
/* NVL, SUM, multiply and GROUP BY functions to find total paid        for employees for
each project */



SELECT a.PROJ_NUM, RPAD(SUBSTR(p.PROJ_NAME,1,15),18,'.') as
PROJ_NAME, SUM(NVL(a.ASSIGN_HOURS,0) * NVL(e.EMP_RATE,0)) as
TOTAL_COST from ASSIGNMENT a, EMPLOYEE e ,PROJECT p WHERE
a.EMP_ID = e.EMP_ID AND a.PROJ_NUM = p.PROJ_NUM GROUP BY
a.PROJ_NUM, p.PROJ_NAM



PROJ_NUM                        PROJ_NAME                        TOTAL_COST
905                             St Paul College...               622550
910                             Citizens Bank D...               731700
900                             New York Ticket...               850160
                                        Table 21




/*------------------------------------------------------------------------*/
/*        NVL, SUM, multiply, GROUP BY and HAVING functions to find */
/*          projects that total paid for employees exceeds 750000            */
/*------------------------------------------------------------------------*/



SELECT a.PROJ_NUM, RPAD(SUBSTR(p.PROJ_NAME,1,15),18,'.') as
PROJ_NAME, SUM(NVL(a.ASSIGN_HOURS,0) * NVL(e.EMP_RATE,0)) as
TOTAL_COST from ASSIGNMENT a, EMPLOYEE e ,PROJECT p WHERE
a.EMP_ID = e.EMP_ID AND a.PROJ_NUM = p.PROJ_NUM GROUP BY
a.PROJ_NUM, p.PROJ_NAME HAVING SUM(NVL(a.ASSIGN_HOURS,0) *
NVL(e.EMP_RATE,0)) >750000;


          PROJ_NUM                       PROJ_NAME                  TOTAL_COST
               900                     New York Ticket...                 850160
                                        Table 22




                                                                                           77
/*------------------------------------------------------------------------*/
/*        TO_CHAR, SYSTIMESTAMP, MONTHS_BETWEEN, and FLOOR */
/*         functions to find list of employees over 50 years old             */
/*------------------------------------------------------------------------*/


SELECT INITCAP(CONCAT(CONCAT(e.FIRST_NAME,' '), e.LAST_NAME)) as
EMP_NAME, TO_CHAR(MONTH e.DOB,'MM/DD/YYYY') as DOB,
(SYSTIMESTAMP - e.DOB) YEAR TO as "AGE Year ot Month",
FLOOR(MONTHS_BETWEEN(SYSTIMESTAMP,e.DOB)/12) as AGE from
EMPLOYEE e WHERE
FLOOR(MONTHS_BETWEEN(SYSTIMESTAMP,e.DOB)/12) > 50;


   EMP_NAME                  DOB            AGE Year ot Month            AGE
 Carlos Winworth          12/28/1958              +52-07                  52
   Joel Jeremiah          10/20/1958              +52-09                  52
   Sam Walteron           04/14/1951              +60-04                  60
  Mariah Johnson          02/19/1955              +56-05                  56
  James Imgram            01/20/1950              +61-06                  61
    Joel Roland           12/20/1950              +60-07                  60
    Peter Wolf            09/15/1955              +55-11                  55
 Marxwall Luther          01/15/1952              +59-07                  59
                                       Table 23




                                                                                  78
Deliverable 8 -Explain Tool

Selection Query

set timing on;
delete from plan_table;
explain plan for
SELECT last_name
FROM employee
WHERE job_code =65;
select * from table(dbms_xplan.display)

PLAN_TABLE_OUTPUT
Plan hash value: 1970680878
| Id | Operation               | Name          | Rows | Bytes | Cost (%CPU)| Time     |
| 0 | SELECT STATEMENT |                      |4       | 44   | 3 (0)      | 00:00:01 |
|* 1 | TABLE ACCESS FULL| EMPLOYEE | 4                | 44    | 3 (0)      | 00:00:01 |
Predicate Information (identified by operation id):
1 - filter("JOB_CODE"=65)
                                        Table 24
13 rows selected.
Elapsed: 00:00:00.04


Projection Query

set timing on;
delete from plan_table;
explain plan for
SELECT * from department;
`select * from table(dbms_xplan.display))

2 rows deleted.
Elapsed: 00:00:00.00 Explained.

Elapsed: 00:00:00.01




                                                                                          79
PLAN_TABLE_OUTPUT
Plan hash value: 3547660139
| Id | Operation            | Name        | Rows | Bytes | Cost (%CPU)|
Time       |
| 0 | SELECT STATEMENT |                  |7     | 259 | 3 (0)        |
00:00:01 |
| 1 | TABLE ACCESS FULL| DEPARTMENT | 7           | 259 | 3 (0)        |
00:00:01 |
                                   Table 25


8 rows selected.

Elapsed: 00:00:00.03


Join Query

set timing on;
delete from plan_table;
explain plan for
select d.first_name "Employee Name", e.first_name "Dependent Name"
from dependent d join employee e
using (emp_id);
select * from table(dbms_xplan.display)

Elapsed: 00:00:00.00 Explained.

Elapsed: 00:00:00.02


PLAN_TABLE_OUTPUT
Plan hash value: 1353759702
| Id | Operation                          | Name       | Rows | Bytes | Cost
(%CPU)| Time       |
| 0 | SELECT STATEMENT                    |            |7     |1     | 6 (17)
| 00:00:01 |
| 1 | MERGE JOIN                              |        |7     | 168 | 6 (17)
| 00:00:01 |
| 2 | TABLE ACCESS BY INDEX ROWID        | EMPLOYEE | 48      | 576 | 2 (0)
| 00:00:01 |
| 3 | INDEX FULL SCAN                     | EMP_ID_PK| 48     |      | 1 (0)
| 00:00:01 |
|* 4 | SORT JOIN                          |            |7     | 84   | 4 (25)
| 00:00:01 |

                                                                                80
| 5 | TABLE ACCESS FULL                      | DEPENDENT | 7   | 84   | 3 (0)
| 00:00:01 |
Predicate Information (identified by operation id):
4 - access("D"."EMP_ID"="E"."EMP_ID")
filter("D"."EMP_ID"="E"."EMP_ID")


                                     Table 26
18 rows selected.

Elapsed: 00:00:00.05



Union Query

set timing on;
delete from plan_table;
explain plan for
select first_name, last_name from dependent
union all
select first_name, last_name from employee;
select * from table(dbms_xplan.display)




                                     Figure 13




                                                                                81
Deliverable 9 - Object-Relational Exercises

/* Create the phone_number_type object*/


create type phone_number_type as object (
        Home number,
        Mobile number,
        Work number
);




                                      Figure 14


/* Create the contact table*/

Create table contact
 ( contact_id number,
   Emp_ID number,
   Address varchar2(50),
        Apt_Num varchar2(50),
        City varchar2(30),
        H_State varchar2(3),
        Phone_Number phone_number_type
);




                                                              82
Figure 15


/*desc contact command*/




                           Figure 16




                                       83
/* Insert to contact table*/


insert into contact (contact_id, emp_id, address, city, h_state, Phone_Number)
 values (con_contact_id_seq.nextval, 35474, '8080 W Maddison', 'City Heights', 'NJ',
phone_number_type (2029091840, 0, 82500920));




                                       Figure 17


insert into contact (contact_id, emp_id, address, city, h_state, Phone_Number)
 values (con_contact_id_seq.nextval, 30794, '909 E Hudson', 'New York City', 'NY',
phone_number_type (2098908860, 2098008860, 82500922)) ;

insert into contact (contact_id, emp_id, address, apt_num, city, h_state, Phone_Number)
 values (con_contact_id_seq.nextval, 34434, '4040 E Fifth Ave', '18GC', 'New York
City', 'NY', phone_number_type (2013499292, 2015499292, 82500924));

insert into contact (contact_id, emp_id, address, apt_num, city, h_state, Phone_Number)
  values (con_contact_id_seq.nextval,
( select emp_id from employee where emp_id = 30404), '1900 S Lake Pine Dr', '2d', 'New
England', 'CT', phone_number_type (2420017540, 2420017940, 82500923));




                                                                                          84
Figure 18


/* Select the data from the contact table*/




                                       Figure 19




                                                     85
/* Update the contact table*/


update contact
set Phone_Number = phone_number_type (2029091840, 2029391840, 82500920)
where CONTACT_ID = 20;




                                         Figure 20


/* Select the data from the contact table*/

select * from contact;




                                         Figure 21




                                                                          86
References

Elmasri, R. & Navathe, S. (2011). Fundamentals of Database Sytems (6th ed.). Boston,

       MA: Pearson.

Group 8 (2011). Employee Skill Management Database System. Reterived from

       http://tychousa9.umuc.edu/DBST652/1106/9040/class.nsf/Course+Content/B6A1

       B17D413D020785257891005D9457?OpenDocument

O’Heam, S. (2010). OCA Oracle Database SQL Certified Expert Exam Guide. NewY

       ork: GuideMcGraw Hill.

Oracle. Oracle SQL Data Modeler Demonstration. Reterived from

       http://www.oracle.com/technetwork/developer-tools/datamodeler/demonstrations-

       224554.html

Oracle. (2010). Introduction to Oracle Objects. Object-Relational Features.
       Retrieved from
       http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14260/adobjint.htm

Rischert, A. (2010). Oracle SQL by Example. Upper Saddle River, NJ: Prentice Hall.




                                                                                       87

Object Relational Database Project

  • 1.
    SUNTURST CONSULTING INC DATABASE PROJECT BY GROUP 12 DBST 652 University of Maryland University College Summer 2011 Saturday, November 26, 2011
  • 2.
    Contents Deliverable 1 –Project Charter........................................................................................... 2 Deliverable 2 - ERD............................................................................................................ 5 Deliverable 3 - Data Definition Language ........................................................................ 12 Deliverable 4 – Data Manipulation Language .................................................................. 18 Database Snappshot .......................................................................................................... 49 Deliverable 5 - SQL Queries............................................................................................. 62 Deliverable 6 -Database Maintenance Scripts .................................................................. 69 Deliverable 7 – Functons & Stored Procedure ................................................................ 75 Deliverable 8 -Explain Tool.............................................................................................. 79 Deliverable 9 - Object-Relational Exercises ..................................................................... 82 References ......................................................................................................................... 87 1
  • 3.
    Deliverable 1 –Project Charter Database Objective Objective of this project is to create an Employee Database which will store information about employees working for SunTrust Consulting Inc. SunTrust is IT consulting company which has assigned many projects to its several employees. This database will contain all the information about the employees working for the SunTrust , such as Employee’s ID, SSN, first name, Date of birth, home address, office phone number, emergency contacts, department, languages, salary etc. It also stores the information about project such as project ID, project name, the assigned employee and the number of hours worked by each employee. Currently, SunTrust Company is using an access, single user database, to record employee data. Moving this to multiuser database will enable individual employees to access most of the employee’s data online. At the same time, company executive can see the cost associated with each project. Purpose and benefits This multi user database will help HR to ease their workload by giving employees access to their data via web and letting them update their information. Moreover employees will be able to search the database and find contact information about other employees like addresses and phone numbers. Managers will have access to their employee’s data and project’s cost which can be used to make a better business decision. 2
  • 4.
    Furthermore, mangers wouldbe able to create and finalize reports of projects like the average cost of each projects and total salary paid to each employee. Technical Detail This database will run in the UMUC Unix server dbcourse2 which will be accessed via PortalPutTTY terminal emulator using SSH network protocol. The software that would be used is Oracle 10g. Data definition language (DDL) would be used to create the database. Data manipulation language (DML) and Transaction control language (TCL) would also be utilized to manipulate the database and make changes or undo transactions to the database. Tools Microsoft Visio 2010 and Oracle Data Modeler would be used to create the Entity relationship diagram (ERD). Notepad +++ and notepad would be used to write and edit SQL statements. Microsoft Project 2007 would be used to create the project schedule. Project Schedule Please open the Microsoft Project file for complete project schedule attached with this document. 3
  • 5.
    Deliverable Deliverable Schedule Member Complete By 1 Project Charter June 5 2 ERD June 12 3 Data Definition Language June 19 June 26 4 Data Manipulation Language July 1 5 SQL Queries July 8 6 Database Maintenance Scripts July 24 7 Functons & Stored Procedure July 29 8 Explain Tool July 29 9 Object Relational Exercises 10 Lab Project Report August 5 Table 1 Project Schedule 4
  • 6.
    Deliverable 2 -ERD Dependent PK Depnd_Num First_Name Last_Name Dep_Dob FK1 Emp_ID Depend_Type Associated Department PK Dept_ID Employs Dept_Name Dept_Phone FK1 Dept_Mgr_ID Dept_Ext Managed Works Assignment EMPLOYEE PK Assignment_Num PK Emp_ID Manager Project Assign_Date PK Proj_Num First_Name Assign_Hours Last_Name Cost FK1 Proj_Mrg_ID SNN FK1 Emp_ID Proj_Name DOB FK2 Proj_Num Due_Date Emp_Rate Associated Assigned Gender FK1 Job_Code Managed FK2 Dept_ID Manager Contact Associated PK Contact_ID Associated FK1 Emp_ID Address Apt_Num City H_State Job Phone_Home Phone_Mobile PK Job_Code Phone_Work Description 5
  • 7.
    ERD Description Entity Description Emplpoyee Stores data about an employee Assignment Stores data relating to an assignment assigned to an employee Project Stores data of a project Department Stores data of a department Dependent Stores data of the dependent assiocated with an employee Job Stores data of a job Contact Stores the contact of an employee Table 2 ERD Description Constraints Primary keys Name Object Description dept_dept_id_pk Department Adds the primary key constraint to the department table. job_Job_Code_pk Job Adds the primary key constraint to the job table. PK_Proj_Num_pk Project Adds the primary key constraint to the project table. Emp_id_pk Employee Adds the primary key constraint to the employee table. assign_assigment_num_pk Assignment Adds the primary key constraint to the assignment table con_contact_id_pk Contact Adds the primary key constraint to contact table. depend_Depend_num_pk Dependent Adds the primary key constraint to the dependent table. Table 3 Primary Key Contraints 6
  • 8.
    Foreign Keys Name Object Description dept_dept_m8gr_id Department Adds the FK constraint linking Employee to Department using Employee PK column (Emp_ID) & Department (Dept_Mgr_ID) column. proj_proj_mgr_id_fk Project Adds the FK constraint linking Employee to Project using Employee PK column (Emp_ID) & Project (Proj_Mrg_ID) column. emp_dept_id_fk Adds the FK constraint linking Department Employee to Employee using Department PK column (Dept_ID) & Employe(Dept_ID) column. emp_job_code_fk Add the FK constraint linking Job to Employee using Job PK column (Job_Code) Table 4 Foreign Key Employee (Job_Code) column. & Constraint assign_Emp_Num_fk Adds the FK constraint linking Employee to Assignment Assignment using Employee PK column (Emp_ID) & Assignment (Emp_ID) column. assign_Proj_Num Adds the FK constraint linking Project to Assignment using Project PK column (Proj_Num) & Assignment (Proj_Num) column. Depend_Emp_id_fk Dependent Adds the FK constraint linking Employee to Dependent using Employee PK column (Emp_ID) & Dependent(Emp_ID) column. con_emp_id_fk Contact Adds the FK constraint linking Employee to Contact using Employee Pk column (Emp_ID) & Contact (Emp_ID) column. 7 Table 5 Not Null Constraint
  • 9.
    Not Null Name Object Description dept_ex_nn Department Adds the not null constraint to Dept_Ex column. dept_phone_nn Adds the not null constraint to Dept_Phone column. dept_name_nn Adds the not null constraint to Dept_Name column. job_description_nn Job Adds the not null constraint to the job_description column. proj_proj_mgr_id_nn Project Adds the not null constraint to the Proj_Mrg_ID column. proj_proj_name_nn Adds the not null constraint to the Proj_Name column. proj_due_date_nn Adds the not null constraint to Due_Date column. emp_last_name_nn Adds the not null constraint to Last_Name column. emp_dob_nn Adds the not null constraint to DOB column. Employee emp_emp_rate_nn Adds the not null constraint to Emp_Rate Column. Adds the Dept_ID column not null constraint dept_id_nn Adds the not null constraint to First_Name column. emp_First_name_nn enp_job_code Adds the not null constraint to the Job_code column. 8
  • 10.
    emp_gender_nn Adds the not null constraint to the Gender column. assign_emp_num_nn Adds the not null constraint to the Emp_ID column. assign_hours_nn Assignment Adds the not null constraint to Assign_Hours column. assign_project_nn Adds the not null constraint to Proj_Num column. depend_first_name_nn Adds the not null constraint to First_Name column. Dependent depend_last_name_nn Adds the not null constraint to Last_Name column. depend_dep_dob_mn Adds the not null constraint to the Dep_Dob column. depend_Emp_id_nn Adds the not null constraint to the Emp_ID column. depend_Depend_Type_nn Adds the not null constraint to Depend_Type column. Table 6 Not Null Constraint 9
  • 11.
    Relationships Relationship Name Entities Relationship Description Emp_Dpet Rel Employee & Department 1:M One or more employee works for a department. A department employes one or more employees Dep_Emp Rel Department& Employee 1:1 One and only one employee is the manger of a department. A department is managed by an employee. An employment is assigned to zero or more Emp_Assign Rel Employee & Assignment 1:M assignment(s). Zero or more assignment(s) is assiocated with an employee. Assign_Project Rel Assignment & Project 1:M One or more assignments can be assiocated with a project. A project can be assiocated with one or more assignments. Cont_Emp Rel Contact & Employee 1:M An employee is assiocated with one or more contact listing(s). One or more contact listing(s) is assiocated with an employee. Emp_Job Rel Employee & Job 1:M One or more employees can be assiocated with the same job type. A job type is assiocated with one or more employees. Depend_Emp Rel Dependent & Employee 1:1 One and only one depedent may be assiocated with an employee. 10
  • 12.
    Proj_Emp Rel Project & Employee 1:1 One and only one employee is the manager of a project. A project is managed by an employee. Table 7 Relationships 11
  • 13.
    Deliverable 3 -Data Definition Language /* creates the department table */ CREATE TABLE DEPARTMENT ( Dept_ID Number , Dept_Name VARCHAR2(50), Dept_Phone Number, Dept_Mgr_ID Number , Dept_Ext Number ); /* add the primary key constraint */ Alter table department add constraint dept_dept_id_pk primary key (dept_id); /* add the not null constraint */ Alter table department modify (dept_ext constraint dept_ex_nn not null) modify ( dept_phone constraint dept_phone_nn not null) modify (dept_name constraint dept_name_nn not null); /* adds the foreign key constraint to the department table */ Alter table department add constraint dept_dept_mgr_id_fk foreign key (dept_mgr_id) references employee (emp_id); /* creates the unique number for the pk columns */ create sequence dept_dept_id_seq start with 0400 increment by 5 Nocycle ; /* creates the job table */ CREATE TABLE JOB ( 12
  • 14.
    Job_code Number, Description VARCHAR2(50) CONSTRAINT job_description_nn not null ); /*end of statement*/ /* creates the primary key constraint*/ Alter table job add constraint job_Job_Code_pk PRIMARY KEY(Job_Code) /*end*/ /* creates the table project*/ CREATE TABLE PROJECT ( Proj_Num Number , Proj_Mgr_ID Number, Proj_name VARCHAR2(50), Due_Date DATE ); /* end */ /* creates pk constraint for the project table */ Alter table project add CONSTRAINT PK_Proj_Num_pk PRIMARY KEY(Proj_Num); /* create the foreign key constraint for project table */ Alter table project add constraint proj_proj_mgr_id_fk foreign key (proj_mgr_id) references employee (emp_id); /* end of sql */ /* creates the null constraints for project table * */ Alter table project modify( proj_mgr_id constraint proj_proj_mgr_id_nn not null ) modify (proj_name constraint proj_proj_name_nn not null) modify( due_date constraint proj_due_date_nn not null); /* end sql */ 13
  • 15.
    /* creates theemployee table */ CREATE TABLE EMPLOYEE (Emp_id Number , First_Name VARCHAR2(50), Last_Name VARCHAR2(50), SSN VARCHAR2(11), Dob DATE, Emp_Rate Number(10,2), Dept_ID number , Gender varchar2(6), Job_Code number ); /* end */ /* add the primary key constraint */ Alter table employee add constraint Emp_id_pk PRIMARY KEY(Emp_id); /* adds the null constraints to the columnn */ Alter table employee modify( last_name constraint emp_last_name_nn not null) modify ( dob constraint emp_dob_nn not null) modify ( emp_rate constraint emp_emp_rate_nn not null) modify ( dept_id constraint dept_id_nn not null) modify( first_name constraint emp_First_name_nn NOT NULL) modify ( job_code constraint emp_job_code_nn not null) modify ( gender constraint emp_gender_nn not null); /* adds the foreign key constraint */ Alter table employee add CONSTRAINT EMP_dept_id_fk FOREIGN KEY(Dept_ID) REFERENCES DEPARTMENT(Dept_ID) ; Alter table employee add CONSTRAINT Emp_job_code_fk FOREIGN KEY(Job_Code) REFERENCES JOB(Job_Code); /* sql ends */ 14
  • 16.
    /* creates theassignment table*/ CREATE TABLE ASSIGNMENT ( Assignment_Num Number, Assign_Date DATE, Assign_Hours Number(10,2), Cost Number(20,2), Emp_id number, Proj_Num number ); /*ends*/ /* creates the constraints for assignment */ Alter table ASSIGNMENT add constraint assign_assigment_num_pk primary key ( Assignment_Num ); Alter table ASSIGNMENT modify ( assign_date constraint assign_emp_num_nn not null) modify ( assign_hours constraint assign_hours_nn not null) modify ( emp_id constraint assign_emp_num not null) modify ( proj_num constraint assign_project_nn not null ); Alter table ASSIGNMENT add CONSTRAINT assign_Emp_Num_fk FOREIGN KEY(Emp_id) REFERENCES EMPLOYEE(Emp_id) Alter table ASSIGNMENT add CONSTRAINT assign_Proj_Num FOREIGN KEY(Proj_num) REFERENCES PROJECT(Proj_num); /*ends*/ /* creates the table for contact*/ Create table contact ( contact_id number, Emp_ID number, Address varchar2(50), Apt_Num varchar2(50), City varchar2(30), H_State varchar2(3), Phone_Home number, phone_Mobile number, Phone_Work number ); 15
  • 17.
    /* end */ /*creates the pk constraint */ Alter table contact add constraint con_contact_id_pk primary key ( contact_id, emp_id); /* creates the fk constraint */ Alter table contact add constraint con_emp_id_fk foreign key (emp_id) references employee (emp_id); /* add column */ Alter table contact add email_office varchar2(40); /*creates the sequence value for the assignment pk value*/ create sequence assign_assign_num_seq start with 05020 increment by 12 Nocycle /*ends*/ /* change sequence */ Alter sequence emp_ssn_seq increment by 589874 /*produce unique numbers for pk columns. The database creates the number */ create sequence emp_emp_id_seq start with 030404 increment by 130 Nocycle ; /* create unique number for ssn*/ create sequence emp_ssn_seq start with 201342019 increment by 1200 Nocycle /* creates unique constraint for ssn*/ 16
  • 18.
    Alter table employee addconstraint emp_emp_ssn_uk unique (ssn); /* changed the sequence value*/ Alter sequence emp_ssn_seq increment by 498989 Nocycle; /*ends*/ /* creates the unique sequence for pk column */ Create sequence con_contact_id_seq start with 00020 increment by 123; nocycle; /* creates the unique number for project_num */ create sequence proj_proj_num_seq start with 0900 increment by 5 Nocycle /* end */ 17
  • 19.
    Deliverable 4 –Data Manipulation Language /* inserts records into the department*/ Insert into department( dept_id, dept_name, dept_phone, dept_ext) values ( dept_dept_id_seq.nextval, 'Quality Assurance', 2122028259, 8260); Insert into department( dept_id, dept_name, dept_phone, dept_ext) values ( dept_dept_id_seq.nextval, 'Software Engineering', 2122028259, 6821); Insert into department( dept_id, dept_name, dept_phone, dept_ext) values ( dept_dept_id_seq.nextval, 'System' , 2122028259, 1926); Insert into department( dept_id, dept_name, dept_phone, dept_ext) values ( dept_dept_id_seq.nextval, 'Network Systems', 2122028259, 4041); Insert into department( dept_id, dept_name, dept_phone, dept_ext) values ( dept_dept_id_seq.nextval, 'Database Systems', 2122028259, 5080); Insert into department( dept_id, dept_name, dept_phone, dept_ext) values ( dept_dept_id_seq.nextval, 'Project Management',2122028259, 8070); Insert into department( dept_id, dept_name, dept_phone, dept_ext) values ( dept_dept_id_seq.nextval, 'Accounting and Finance' ,2122028259,9090); /* end of the insert statement*/ /* update department to include department manager id */ update department set dept_mgr_id = ( select emp_id from employee where emp_id = 35084) where dept_id = (select emp_id from employee where emp_id = 400); update department set dept_mgr_id = ( select emp_id from employee where emp_id = 34174) where dept_id = ( select dept_id from department where dept_id = 405); update department set dept_mgr_id = (select emp_id from employee where emp_id = 30534 ) 18
  • 20.
    where dept_id =( select dept_id from department where dept_id = 410); update department set dept_mgr_id = select emp_id from employee where emp_id = 35734 ) where dept_id = ( select dept_id from department where dept_id = 415); update department set dept_mgr_id = (select emp_id from employee where emp_id = 33264) where dept_id = (select dept_id from employee where dept_id = 420) ; update department set dept_mgr_id = (select emp_id from employee where emp_id = 35344 ) where dept_id = ( select emp_id from employee where emp_id 425); update department set dept_mgr_id = (select emp_id from employee where emp_id = 36124 ) where dept_id = ( select dept_id from department where dept_id = 430); /*end*/ /* insert records into the job table */ insert into job (job_code,description) values ( job_job_code_seq.nextval, 'C++/.Net Developer'); insert into job (job_code,description) values ( job_job_code_seq.nextval, 'Java Developer'); commit; insert into job (job_code,description) values ( job_job_code_seq.nextval, 'Php/ Java Script Developer') commit; insert into job (job_code,description) values ( job_job_code_seq.nextval, 'HTML/XHTML Developer') commit; insert into job (job_code,description) values ( job_job_code_seq.nextval, 'Python Developer') commit; insert into job (job_code,description) values ( job_job_code_seq.nextval, 'Database Analyst'); commit; insert into job (job_code,description) values ( job_job_code_seq.nextval, 'Database Developer'); commit; 19
  • 21.
    insert into job(job_code,description) values ( job_job_code_seq.nextval, 'Data Modeler'); commit; insert into job (job_code,description) values ( job_job_code_seq.nextval, 'System Analyst'): commit; insert into job (job_code,description) values ( job_job_code_seq.nextval, 'Systems Engineer' ); commit; insert into job (job_code,description) values ( job_job_code_seq.nextval, 'Systems Administrator'); commit; insert into job (job_code,description) values ( job_job_code_seq.nextval, 'Database Administrator'); commit; insert into job (job_code,description) values ( job_job_code_seq.nextval, 'Technical Writter'); commit; insert into job (job_code,description) values ( job_job_code_seq.nextval, 'Project Manager' ); commit; insert into job (job_code,description) values ( job_job_code_seq.nextval, 'Network Engineer' ); commit; insert into job (job_code,description) values ( job_job_code_seq.nextval, 'Network Specialist' ); commit; insert into job (job_code,description) values ( job_job_code_seq.nextval, 'Network Security Specialist' ); commit; insert into job (job_code,description) values ( job_job_code_seq.nextval, 'Graphics Specialist' ); commit; 20
  • 22.
    insert into job(job_code,description) values ( job_job_code_seq.nextval, 'Payroll Specialist' ); commit; insert into job (job_code,description) values ( job_job_code_seq.nextval, 'Inventory Specialist' ); commit; insert into job (job_code,description) values ( job_job_code_seq.nextval, 'Test Analyst' ); commit; insert into job (job_code,description) values ( job_job_code_seq.nextval, 'system Analyst' ); commit; /* end of the insert statement*/ /* inserts the records into the project table*/ Insert into project (proj_num, proj_mgr_id, proj_name,due_date) values (proj_proj_num_seq.nextval, (select emp_id from employee where emp_id = 35604), 'New York Ticket Corp Payment System', to_date ('09-sep-2010', 'dd-mon-yyyy') ); Insert into project (proj_num, proj_mgr_id, proj_name,due_date) values (proj_proj_num_seq.nextval, (select emp_id from employee where emp_id = 35604), 'St Paul College Web System Development', to_date('02-feb-2011', 'dd-mon-yyyy')); Insert into project (proj_num, proj_mgr_id, proj_name,due_date) values (proj_proj_num_seq.nextval, (select emp_id from employee where emp_id =35474 ), 'Citizens Bank Databae Development', to_date('09-AUG-2012', 'dd-mon-yyyy')); Insert into project (proj_num, proj_mgr_id, proj_name,due_date) values (proj_proj_num_seq.nextval, (select emp_id from employee where emp_id = 35344 ), 'WBBMN Urban TV System Development', 21
  • 23.
    to_date('27-Dec-2013', 'dd-mon-yyyy')); /* endof sql */ /* inserts records into the employee table*/ /* system enginner employee*/ Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Sunny','McCook', emp_ssn_seq.nextval, 50, (select dept_id from department where dept_id =410), (select job_code from job where job_code = 70), TO_DATE('29-MAR-1978','DD-MON-YYYY '), 'Male' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Mariah', 'Johnson', emp_ssn_seq.nextval, 50, (select dept_id from department where dept_id =410), (select job_code from job where job_code = 70), TO_DATE('19-feb-1955','DD-MON-YYYY '), 'female' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'James', 'Imgram', emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =410), (select job_code from job where job_code = 70), TO_DATE( '20-jan-1950','DD-MON-YYYY '), 'male' ); /*end */ /*system admin sql insert */ Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Joel', 'Roland', emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =410), (select job_code from job where job_code = 75), TO_DATE( '20-dec-1950','DD-MON-YYYY '), 'male' 22
  • 24.
    ); Insert into employee(emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Susan', 'Noah', emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =410), (select job_code from job where job_code = 75), TO_DATE( '10-apr-1964','DD-MON-YYYY '), 'female' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Peter', 'Wolf', emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =410), (select job_code from job where job_code = 75), TO_DATE( '15-sep-1955','DD-MON-YYYY '), 'male' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender ) values (emp_emp_id_seq.nextval , 'Marxwall', 'Luther', emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =410), (select job_code from job where job_code = 75), TO_DATE( '15-jan-1952','DD-MON-YYYY '), 'male' ); /* end sql / /*system analyst*/ Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Fox','Christopher', emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =410), (select job_code from job where job_code = 130), TO_DATE( '19- july-1977','DD-MON-YYYY '), 'male' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Deng', 'Alian', emp_ssn_seq.nextval, 30, (select dept_id from department where dept_id =410), (select job_code from job where job_code = 130), TO_DATE( '04-jun-1988', 'DD-MON-YYYY '), 'male'); 23
  • 25.
    /*end*/ /*database admins*/ Insertinto employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Jessica', 'Andy', emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =420), (select job_code from job where job_code = 80), TO_DATE( '01-Aug-1962','DD-MON-YYYY '), 'female' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Shirly', 'Davis', emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =420), (select job_code from job where job_code = 80), TO_DATE( '18-Aug-1962','DD-MON-YYYY '), 'female' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Mathew', 'Brain', emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =420), (select job_code from job where job_code = 80), TO_DATE( '14-Aug-1980','DD-MON-YYYY '), 'male' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Tyron', 'Banks', emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =420), (select job_code from job where job_code = 80), TO_DATE( '18-sep-1983','DD-MON-YYYY '), 'male' ); /*end / /* db developer*/ Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Donna', 'Haris', emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =420), (select job_code from job where job_code = 60), TO_DATE( '12-oct-1982','DD-MON-YYYY '), 'female' 24
  • 26.
    ); Insert into employee(emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Linda', 'Mark', emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =420), (select job_code from job where job_code = 60), TO_DATE( '12-jul-1982','DD-MON-YYYY '), 'female' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Ruth', 'Baker', emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =420), (select job_code from job where job_code = 60), TO_DATE( '19-mar-1975','DD-MON-YYYY '), 'female' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Kevin', 'Kenneth', emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =420), (select job_code from job where job_code = 60), TO_DATE( '09-mar-1975','DD-MON-YYYY '), 'male' ); /* db developer end * / /* database modeler employee */ Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Isabella', 'Clinton' , emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =420), (select job_code from job where job_code = 65), TO_DATE( '11-oct-1975','DD-MON-YYYY '), 'female' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Sanford', 'Brown' , emp_ssn_seq.nextval, 50, (select dept_id from department where dept_id =420), (select job_code from job where job_code = 65), TO_DATE( '08-nov-1972','DD-MON-YYYY '), 'male' ); 25
  • 27.
    Insert into employee(emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Vonda', 'Ikenna' , emp_ssn_seq.nextval, 30, (select dept_id from department where dept_id =420), (select job_code from job where job_code = 65), TO_DATE( '06-jun-1985','DD-MON-YYYY '), 'female' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Celina', 'Tobi' , emp_ssn_seq.nextval, 30, (select dept_id from department where dept_id =420), (select job_code from job where job_code = 65), TO_DATE( '16-mar-1986','DD-MON-YYYY '), 'female' ); /* end of sql */ /* database analyst */ Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Brenda', 'Bell' , emp_ssn_seq.nextval, 30, (select dept_id from department where dept_id =420), (select job_code from job where job_code = 55), TO_DATE( '16-mar-1988','DD-MON-YYYY '), 'female' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Jaqueline', 'king' , emp_ssn_seq.nextval, 50, (select dept_id from department where dept_id =420), (select job_code from job where job_code = 55), TO_DATE( '04-aug-1967','DD-MON-YYYY '), 'female' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Roland', 'king' , emp_ssn_seq.nextval, 30, (select dept_id from department where dept_id =420), (select job_code from job where job_code = 55), TO_DATE( '04-jan-1987','DD-MON-YYYY '), 'male' 26
  • 28.
    ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Michael', 'Stevens', emp_ssn_seq.nextval, 50, (select dept_id from department where dept_id =420), (select job_code from job where job_code = 55), TO_DATE( '25-dec-1974','DD-MON-YYYY '), 'male' ); /*end of statement*/ /* java*/ Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Carol', 'Washington' , emp_ssn_seq.nextval, 50, (select dept_id from department where dept_id =405), (select job_code from job where job_code = 50), TO_DATE( '12-jul-1984','DD-MON-YYYY '), 'female' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Rebeca', 'Peterson', emp_ssn_seq.nextval, 30, (select dept_id from department where dept_id =405), (select job_code from job where job_code = 50), TO_DATE( '21-oct-1987','DD-MON-YYYY '), 'female' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Cherri', 'Keys', emp_ssn_seq.nextval, 50, (select dept_id from department where dept_id =405), (select job_code from job where job_code = 50), TO_DATE( '25-apr-1983','DD-MON-YYYY '), 'female' ); /*end of statement */ /*php/java scripts*/ Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Jerry','Springfield', emp_ssn_seq.nextval, 30, 27
  • 29.
    (select dept_id fromdepartment where dept_id =405), (select job_code from job where job_code = 135), TO_DATE( '18-feb-1979 ','DD-MON-YYYY '), 'male' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Carlos', 'Winworth', emp_ssn_seq.nextval, 50, (select dept_id from department where dept_id =405), (select job_code from job where job_code =135), TO_DATE( '28-dec-1958','DD-MON-YYYY '), 'male' ); /*end*/ /* c++ developer */ Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Patrick', 'law', emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =405), (select job_code from job where job_code = 45), TO_DATE( '20-feb-1962','DD-MON-YYYY '), 'male' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Jonas', 'lake' ,emp_ssn_seq.nextval, 50, (select dept_id from department where dept_id =405), (select job_code from job where job_code = 45), TO_DATE( '28-feb-1963','DD-MON-YYYY '), 'male' ); /*end*/ /* HTRML/XHTML*/ Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Addie', 'Jude', emp_ssn_seq.nextval, 50, (select dept_id from department where dept_id =405), (select job_code from job where job_code = 140), TO_DATE( '19-may-1973','DD-MON-YYYY '), 'female' ); 28
  • 30.
    Insert into employee(emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Adams', 'Wade' ,emp_ssn_seq.nextval, 50, (select dept_id from department where dept_id =405), (select job_code from job where job_code = 140), TO_DATE( '20-sep-1975','DD-MON-YYYY '), 'male' ); /*end*/ /* phython */ Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Robert', 'Lopez', emp_ssn_seq.nextval, 50, (select dept_id from department where dept_id =405), (select job_code from job where job_code = 145), TO_DATE( '2-jan -1983','DD-MON-YYYY '), 'male' ); /*end*/ /* technical writer*/ Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Ray', 'Richmond', emp_ssn_seq.nextval, 50, (select dept_id from department where dept_id =400), (select job_code from job where job_code = 85), TO_DATE( '2-oct-1982','DD-MON-YYYY '), 'male' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Zack','Richmond', emp_ssn_seq.nextval, 50, (select dept_id from department where dept_id =400), (select job_code from job where job_code = 85), TO_DATE( '2-jan-1963','DD-MON-YYYY '), 'male' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Ashland', 'Kedzie', emp_ssn_seq.nextval, 50, (select dept_id from department where dept_id =400), 29
  • 31.
    (select job_code fromjob where job_code = 85), TO_DATE( '06-jul-1969','DD-MON-YYYY '), 'female' ); /*end */ /*project manager*/ Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Joel' , 'Jeremiah', emp_ssn_seq.nextval, 60, (select dept_id from department where dept_id =425), (select job_code from job where job_code = 90), TO_DATE( '20-oct-1958','DD-MON-YYYY '), 'male' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Zack','Isaiah', emp_ssn_seq.nextval, 50, (select dept_id from department where dept_id =425), (select job_code from job where job_code = 90), TO_DATE( '13-oct-1966','DD-MON-YYYY '), 'male' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Ashland', 'Macnell', emp_ssn_seq.nextval, 50, (select dept_id from department where dept_id =425), (select job_code from job where job_code = 90), TO_DATE( '06-jul-1969','DD-MON-YYYY '), 'female' ); /*end*/ /*network specialist*/ Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Sam', 'Walteron', emp_ssn_seq.nextval,50, (select dept_id from department where dept_id =415), (select job_code from job where job_code = 95), TO_DATE( '14-apr-1951','DD-MON-YYYY '), 'male' ); 30
  • 32.
    Insert into employee(emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Jacob', 'Henson', emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =415), (select job_code from job where job_code = 100), TO_DATE( '13-jan-1970','DD-MON-YYYY '), 'male' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Lee', 'Chin', emp_ssn_seq.nextval, 30, (select dept_id from department where dept_id =415), (select job_code from job where job_code = 105), TO_DATE( '09-sep-1984', 'DD-MON-YYYY '), 'male'); /*end*/ /*accounting and fianace */ Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Rose', 'Henson', emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =430), (select job_code from job where job_code = 115), TO_DATE( '13-jan-1970','DD-MON-YYYY '), 'female' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Jackie', 'Hopewell', emp_ssn_seq.nextval, 30, (select dept_id from department where dept_id =430), (select job_code from job where job_code = 120), TO_DATE( '09-sep-1984', 'DD-MON-YYYY '), 'female'); /*end*/ /*test analyst*/ Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Derick', 'Charles', emp_ssn_seq.nextval, 40, (select dept_id from department where dept_id =400), (select job_code from job where job_code = 125), 31
  • 33.
    TO_DATE( '25-july-1970','DD-MON-YYYY '),'male' ); Insert into employee (emp_id, first_name, last_name, ssn, emp_rate, dept_id, job_code, dob, gender) values (emp_emp_id_seq.nextval , 'Lou', 'Shih', emp_ssn_seq.nextval, 30, (select dept_id from department where dept_id =400), (select job_code from job where job_code = 125), TO_DATE( '04-jun-1989', 'DD-MON-YYYY '), 'female'); /*end*/ /* insert records of employees associated with project */ /* projct 900 */ insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 1200 , (select emp_id from employee where emp_id = 34434) , (select proj_num from project where proj_num = 900 ) ); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 900 , (select emp_id from employee where emp_id = 34304) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 900 ,(select emp_id from employee where emp_id = 33914) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 900 , (select emp_id from employee where emp_id = 33784) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 890 32
  • 34.
    , (select emp_idfrom employee where emp_id = 34174 ) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 890 , (select emp_id from employee where emp_id =34564 ) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 890 , (select emp_id from employee where emp_id = 35084) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 890 , (select emp_id from employee where emp_id =34954) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 890 , (select emp_id from employee where emp_id = 36514) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 989 , (select emp_id from employee where emp_id = 36384) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 1000 , (select emp_id from employee where emp_id = 30664 ) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 400 , (select emp_id from employee where emp_id = 30534 ) , (select proj_num from project where proj_num = 900)); 33
  • 35.
    insert into ASSIGNMENT(Assignment_Num,Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 980 , (select emp_id from employee where emp_id = 31054) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 800 , (select emp_id from employee where emp_id = 31314 ) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 690 , (select emp_id from employee where emp_id = 33394 ) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 550 , (select emp_id from employee where emp_id = 33264 ) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun-2008', 'dd-mon-yyyy'), 1200, (select emp_id from employee where emp_id = 32224) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun-2008', 'dd-mon-yyyy'), 980, (select emp_id from employee where emp_id = 32094) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun -2008', 'dd-mon-yyyy'), 550 , (select emp_id from employee where emp_id = 32874 ) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun-2008', 'dd-mon-yyyy'), 1200, 34
  • 36.
    (select emp_id fromemployee where emp_id = 31704 ) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun-2008', 'dd-mon-yyyy'), 980, (select emp_id from employee where emp_id = 35994) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun-2008', 'dd-mon-yyyy'), 1200, (select emp_id from employee where emp_id = 36124 ) , (select proj_num from project where proj_num = 900)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-jun-2008', 'dd-mon-yyyy'), 980, (select emp_id from employee where emp_id = 36254 ) , (select proj_num from project where proj_num = 900)); /* project num 905 */ insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 980 , (select emp_id from employee where emp_id = 35214) , (select proj_num from project where proj_num = 905)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 780 , (select emp_id from employee where emp_id = 36384) , (select proj_num from project where proj_num = 905)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 890 , (select emp_id from employee where emp_id = 34824) , (select proj_num from project where proj_num = 905)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 400 , (select emp_id from employee where emp_id = 34044) , (select proj_num from project where proj_num = 55)); 35
  • 37.
    insert into ASSIGNMENT(Assignment_Num,Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 400, (select emp_id from employee where emp_id = 34174) , (select proj_num from project where proj_num = 905)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 500, (select emp_id from employee where emp_id = 34434) , (select proj_num from project where proj_num = 905)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 800, (select emp_id from employee where emp_id = 34304) , (select proj_num from project where proj_num = 905)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 789, (select emp_id from employee where emp_id = 33784 ) , (select proj_num from project where proj_num = 905)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 789, (select emp_id from employee where emp_id = 32224 ) , (select proj_num from project where proj_num = 905)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 890, (select emp_id from employee where emp_id = 32484) , (select proj_num from project where proj_num = 905)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 900, (select emp_id from employee where emp_id = 32744) , (select proj_num from project where proj_num = 905)); 36
  • 38.
    insert into ASSIGNMENT(Assignment_Num,Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 989, (select emp_id from employee where emp_id = 30404) , (select proj_num from project where proj_num = 905)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'),900, (select emp_id from employee where emp_id = 30924 ) , (select proj_num from project where proj_num = 905)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 1500, (select emp_id from employee where emp_id = 31834) , (select proj_num from project where proj_num = 905)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 1400, (select emp_id from employee where emp_id = 31444) , (select proj_num from project where proj_num = 905)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 699, (select emp_id from employee where emp_id = 35994) , (select proj_num from project where proj_num = 905)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 850, (select emp_id from employee where emp_id = 35864) , (select proj_num from project where proj_num = 905)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 90, (select emp_id from employee where emp_id = 36124) , (select proj_num from project where proj_num = 905)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 850, (select emp_id from employee where emp_id = 36254) , (select proj_num from project where proj_num = 905)); 37
  • 39.
    insert into ASSIGNMENT(Assignment_Num,Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('06-dec-2009', 'dd-mon-yyyy'), 850, (select emp_id from employee where emp_id = 33134) , (select proj_num from project where proj_num = 905)); /*end of project 905 */ /* project 910 */ insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('01-feb-2011', 'dd-mon-yyyy'), 1800, (select emp_id from employee where emp_id = 33654 ) , (select proj_num from project where proj_num = 910)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('01-feb-2011', 'dd-mon-yyyy'), 1200, (select emp_id from employee where emp_id = 33524 ) , (select proj_num from project where proj_num = 910)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('01-feb-2011', 'dd-mon-yyyy'), 1340, (select emp_id from employee where emp_id = 32354) , (select proj_num from project where proj_num = 910)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('01-feb-2011', 'dd-mon-yyyy'), 980, (select emp_id from employee where emp_id = 33004) , (select proj_num from project where proj_num = 910)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('01-feb-2011', 'dd-mon-yyyy'), 1050, (select emp_id from employee where emp_id = 32614 ) , (select proj_num from project where proj_num = 910)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('01-feb-2011', 'dd-mon-yyyy'), 1300, (select emp_id from employee where emp_id = 31184 ) , (select proj_num from project where proj_num = 910)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) 38
  • 40.
    values ( assign_assign_num_seq.nextval,to_date('01-feb-2011', 'dd-mon-yyyy'), 290, (select emp_id from employee where emp_id = 30794) , (select proj_num from project where proj_num = 910)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('01-feb-2011', 'dd-mon-yyyy'), 800, (select emp_id from employee where emp_id = 31964 ) , (select proj_num from project where proj_num = 910)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('01-feb-2011', 'dd-mon-yyyy'), 780, (select emp_id from employee where emp_id = 31574) , (select proj_num from project where proj_num = 910)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('27-dec-2010', 'dd-mon-yyyy'), 550, (select emp_id from employee where emp_id = 34694 ) , (select proj_num from project where proj_num = 910)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('27-dec-2010', 'dd-mon-yyyy'), 650, (select emp_id from employee where emp_id = 35734 ) , (select proj_num from project where proj_num = 910)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('27-dec-2010', 'dd-mon-yyyy'), 890, (select emp_id from employee where emp_id = 34434 ) , (select proj_num from project where proj_num = 910)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('27-dec-2010', 'dd-mon-yyyy'), 900, (select emp_id from employee where emp_id = 32224 ) , (select proj_num from project where proj_num = 910)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('27-dec-2010', 'dd-mon-yyyy'), 900, (select emp_id from employee where emp_id = 30404) , (select proj_num from project where proj_num = 910)); 39
  • 41.
    insert into ASSIGNMENT(Assignment_Num,Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('27-dec-2010', 'dd-mon-yyyy'), 1200, (select emp_id from employee where emp_id = 31834 ) , (select proj_num from project where proj_num = 910)); insert into ASSIGNMENT(Assignment_Num, Assign_Date, Assign_Hours, emp_id, proj_num) values ( assign_assign_num_seq.nextval, to_date('27-dec-2010', 'dd-mon-yyyy'), 550, (select emp_id from employee where emp_id = 34174) , (select proj_num from project where proj_num = 910)); /* update assign hours*/ update assignment set assign_hours = 1200 where ASSIGNMENT_NUM = 5824 /*end sql*/ /*end*/ /* updates the cost for each employee based on their pay rate */ update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num =5296 ) where emp_id = 35214 and Assignment_Num =5296 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num =5308 ) where emp_id = 36384 and Assignment_Num =5308 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num =5320) where emp_id = 34824 and Assignment_Num =5320 ; 40
  • 42.
    update assignment set cost= (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num =5344 ) where emp_id = 34174 and Assignment_Num =5344 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num =5356 ) where emp_id = 34434 and Assignment_Num =5356 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num =5368) where emp_id = 34044 and Assignment_Num =5368 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num =5380) where emp_id =33784 and Assignment_Num = 5380; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num =5392) where emp_id = 34304 and Assignment_Num =5392 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num =5404) where emp_id = 32224 and Assignment_Num =5404 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num =5416) where emp_id = 32484 and Assignment_Num =5416 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5428) where emp_id = 32744 41
  • 43.
    and Assignment_Num =5428 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5440) where emp_id = 30404 and Assignment_Num = 5440 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5452) where emp_id = 30924 and Assignment_Num = 5452 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5464) where emp_id = 31834 and Assignment_Num = 5464; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5488) where emp_id = 35994 and Assignment_Num = 5488; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5500) where emp_id = 35864 and Assignment_Num = 5500; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5476 ) where emp_id = 31444 and Assignment_Num = 5476; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5512 ) where emp_id = 36124 and Assignment_Num = 5512; 42
  • 44.
    update assignment set cost= (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5524 ) where emp_id = 36254 and Assignment_Num = 5524 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5536 ) where emp_id = 33134 and Assignment_Num = 5536; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5188 ) where emp_id = 33394 and Assignment_Num = 5188; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5200 ) where emp_id = 33264 and Assignment_Num = 5200; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5212) where emp_id = 32224 and Assignment_Num = 5212; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5224 ) where emp_id = 32094 and Assignment_Num = 5224 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5236 ) where emp_id = 32874 and Assignment_Num = 5236; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5248 ) where emp_id = 31704 43
  • 45.
    and Assignment_Num =5248; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5260 ) where emp_id = 35994 and Assignment_Num = 5260 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5272) where emp_id = 36124 and Assignment_Num = 5272; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5020) where emp_id = 34434 and Assignment_Num = 5020; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5032 ) where emp_id = 34304 and Assignment_Num = 5032 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5044 ) where emp_id = 33914 and Assignment_Num = 5044 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5056 ) where emp_id = 33784 and Assignment_Num = 5056 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5068 ) where emp_id = 34174 and Assignment_Num = 5068; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5080) where emp_id = 34564 and Assignment_Num = 5080 ; 44
  • 46.
    update assignment set cost= (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5092 ) where emp_id = 35084 and Assignment_Num = 5092; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5104 ) where emp_id = 34954 and Assignment_Num = 5104 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5116 ) where emp_id = 36514 and Assignment_Num = 5116; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5128 ) where emp_id = 36384 and Assignment_Num = 5128 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5140 ) where emp_id = 30664 and Assignment_Num = 5140 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5152) where emp_id = 30534 and Assignment_Num = 5152; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5164 ) where emp_id = 31054 and Assignment_Num = 5164 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5176 ) where emp_id = 31314 and Assignment_Num = 5176; 45
  • 47.
    update assignment set cost= (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 91608) where emp_id = 36254 and Assignment_Num = 91608; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5284 ) where emp_id = 36254 and Assignment_Num = 5284 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5608 ) where emp_id = 33654 and Assignment_Num = 5608; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5620 ) where emp_id = 33524 and Assignment_Num = 5620; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5632) where emp_id = 32354 and Assignment_Num = 5632 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5644 ) where emp_id = 33004 and Assignment_Num = 5644 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5656) where emp_id = 31184 and Assignment_Num = 5656; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5680 ) where emp_id = 30794 and Assignment_Num = 5680; 46
  • 48.
    update assignment set cost= (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5668) where emp_id = 32614 and Assignment_Num = 5668 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5692 ) where emp_id = 31964 and Assignment_Num = 5692 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5704 ) where emp_id = 31574 and Assignment_Num = 5704 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5740 ) where emp_id = 34694 and Assignment_Num = 5740; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5752) where emp_id = 35734 and Assignment_Num = 5752 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5764 ) where emp_id = 34434 and Assignment_Num = 5764 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5776 ) where emp_id = 32224 and Assignment_Num = 5776; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5788 ) where emp_id = 30404 and Assignment_Num = 5788 ; update assignment 47
  • 49.
    set cost =(select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5812 ) where emp_id = 31834 and Assignment_Num = 5812 ; update assignment set cost = (select e.emp_rate * a.assign_hours from employee e inner join assignment a on e.emp_id = a.emp_id where a.Assignment_Num = 5824) where emp_id = 34174 and Assignment_Num = 5824; /*end*/ /* inserts the record for employee contact information */ insert into contact (contact_id, emp_id, address, city, h_state, phone_home, phone_work, email_office) values (con_contact_id_seq.nextval, ( select emp_id from employee where emp_id = 35474), '8080 W Maddison', 'City Heights', 'NJ', 2029091840, 82500920, 'ray.rich@sunlife.com'); insert into contact (contact_id, emp_id, address, city, h_state, phone_home, phone_work, email_office) values (con_contact_id_seq.nextval, ( select emp_id from employee where emp_id = 30794), '909 E Hudson', 'New York City', 'NY', 2098908860, 82500922, 'zach.rich@sunlife.com') ; insert into contact (contact_id, emp_id, address, apt_num, city, h_state, phone_home, phone_work, email_office) values (con_contact_id_seq.nextval, ( select emp_id from employee where emp_id = 34434), '4040 E Fifth Ave', '18GC', 'New York City', 'NY', 2013499292, 82500924, 'ashland.kediz@sunlife.com'); insert into contact (contact_id, emp_id, address, apt_num, city, h_state, phone_home, phone_work, email_office) values (con_contact_id_seq.nextval, ( select emp_id from employee where emp_id = 30404), '1900 S Lake Pine Dr', '2d', 'New England', 'CT', 2420017540, 82500923, 'derick.charl@sunlife.com'); insert into contact (contact_id, emp_id, address, apt_num, city, h_state, phone_home, phone_work, email_office) values (con_contact_id_seq.nextval, ( select emp_id from employee where emp_id = 34174), '1200 S brodway Dr', '4c', 'New bedford Park', 'CT', 2123988019, 82500926, 'lou.shi@sunlife.com'); 48
  • 50.
    Database Snappshot The logfile could not be captured with a web browser. The following captured pictures reprsents the database state. Figure 1 described issued command describes table structure for Department, Project and Employee. The describe isssued command in figure 2 describes the table structures for Job, Contact and Assiignment. 49
  • 51.
    Figure 1 TableStructures 50
  • 52.
    Figure 2 TableStructure 51
  • 53.
    Figure 3 ContactTable Data 52
  • 54.
    Figure 4 DepartmentTable Data 53
  • 55.
    Figure 5 ProjectTable Data 54
  • 56.
    Figure 6 EmployeeTable Data 55
  • 57.
    Figure 7 EmployeeTable Data 56
  • 58.
    Figure 8 AssignmentTable Data 57
  • 59.
    Figure 9 AssignmentTable Data 58
  • 60.
    Figure 10 AssignmentTable Data 59
  • 61.
    Figure 11 JobTable Data 60
  • 62.
  • 63.
    Deliverable 5 -SQL Queries /* Show me name of employess whose job code is 65 */ SELECT first_name, last_name, job_code from employee where job_code= '65'; First_Name Last_Name Job_Code Sanford Brown 65 Vonda Ikenna 65 Celina Tobi 65 Isabella Clinton 65 Table 8 /* Show me the total number of employess for different job codes */ SELECT job_code, count (*) as Total_number from employee Group by job_code; JOB_CODE TOTAL_NUMBER 115 1 125 2 70 3 135 2 105 1 60 4 50 3 45 2 145 1 140 2 85 3 130 2 65 4 55 4 62
  • 64.
    95 1 90 3 100 1 120 1 75 4 80 4 Table 9 /* Show me the lowest rate for job code 65 */ select min(emp_rate) "Lowest Rate" from employee where job_code= '65' group by job_code; Lowest Rate 30 Table 10 /* Show me the name of employees with highest rate . List them by their first name*/ select first_name , last_name, emp_rate AS Lowest_emp_rate from employee where emp_rate = (select min(emp_rate) from employee ) order by first_name; FIRST_NAME LAST_NAME LOWEST_EMP_RATE Brenda Bell 30 Celina Tobi 30 Deng Alian 30 Jackie Hopewell 30 Jerry Springfield 30 Lee Chin 30 63
  • 65.
    Lou Shih 30 Table 11 /* subquery, Show the list of employees whose emp rate is greater than average rate */ select initcap(first_name) as FIRST_NAME, initcap (last_name) as LAST_NAME, initcap(gender) as GENDER, emp_rate from employee where emp_rate > ( select avg(emp_rate) from employee); FIRST_NAME LAST_NAME GENDER EMP_RATE Sanford Brown Male 50 Jaqueline King Female 50 Michael Stevens Male 50 Carol Washington Female 50 Cherri Keys Female 50 Carlos Winworth Male 50 Jonas Lake Male 50 Addie Jude Female 50 Adams Wade Male 50 Robert Lopez Male 50 Ray Richmond Male 50 Zack Richmond Male 50 Ashland Kedzie Female 50 Joel Jeremiah Male 60 Zack Isaiah Male 50 Ashland Macnell Female 50 Sam Walteron Male 50 Sunny Mccook Male 50 Mariah Johnson Female 50 Table 12 64
  • 66.
    /* Show thelist of the employees who are working on the project assigned in the past 6 months */ Select e.first_name,e.last_name , a.assign_date, assignment_num from employee e, assignment a where e.emp_id=a.emp_id and assign_date > (add_months(sysdate, -6)) FIRST_NAME LAST_NAME ASSIGN_DATE ASSIGNMENT_NUM Joel Roland 01-FEB-11 5680 Marxwall Luther 01-FEB-11 5656 Jessica Andy 01-FEB-11 5704 Tyron Banks 01-FEB-11 5692 Ruth Baker 01-FEB-11 5632 Isabella Clinton 01-FEB-11 5668 Celina Tobi 01-FEB-11 5644 Table 13 /* Joining Three Tables.Show the name of employee , their ID, and project description whose projects are overdue today */ select emp_id, e.first_name, proj_name, p.due_date from employee e JOIN assignment a using(emp_id) JOIN project p using (proj_num) where due_date< sysdate 65
  • 67.
    EMP_ID FIRST_NAME PROJ_NAME DUE_DATE EMP_ID 32744 Sanford St Paul College Web System 02-FEB-11 32744 Development 32874 Vonda New York Ticket Corp 09-SEP-10 32874 Payment System 33134 Brenda St Paul College Web System 02-FEB-11 33134 Development 33264 Jaqueline New York Ticket Corp 09-SEP-10 33264 Payment System 33394 Roland New York Ticket Corp 09-SEP-10 33394 Payment System 33784 Rebeca St Paul College Web System 02-FEB-11 33784 Development 33784 Rebeca New York Ticket Corp 09-SEP-10 33784 Payment System 33914 Cherri New York Ticket Corp 09-SEP-10 33914 Payment System 34044 Jerry St Paul College Web System 02-FEB-11 34044 Development 34174 Carlos St Paul College Web System 02-FEB-11 34174 Development 34174 Carlos New York Ticket Corp 09-SEP-10 34174 Payment System 34304 Patrick St Paul College Web System 02-FEB-11 34304 Development 34304 Patrick New York Ticket Corp 09-SEP-10 34304 Payment System 34434 Jonas St Paul College Web System 02-FEB-11 34434 Development 34434 Jonas New York Ticket Corp 09-SEP-10 34434 66
  • 68.
    Payment System 34564 Addie New York Ticket Corp 09-SEP-10 34564 Payment System 34824 Robert St Paul College Web System 02-FEB-11 34824 Development 34954 Ray New York Ticket Corp 09-SEP-10 34954 Payment System 35084 Zack New York Ticket Corp 09-SEP-10 35084 Payment System 35214 Ashland St Paul College Web System 02-FEB-11 35214 Development 35864 Jacob St Paul College Web System 02-FEB-11 35864 Development 35994 Lee St Paul College Web System 02-FEB-11 35994 Development 35994 Lee New York Ticket Corp 09-SEP-10 35994 Payment System 36124 Rose St Paul College Web System 02-FEB-11 36124 Development 36124 Rose New York Ticket Corp 09-SEP-10 36124 Payment System 36254 Jackie St Paul College Web System 02-FEB-11 36254 Development 36254 Jackie New York Ticket Corp 09-SEP-10 36254 Payment System 36384 Derick St Paul College Web System 02-FEB-11 36384 Development 36384 Derick New York Ticket Corp 09-SEP-10 36384 Payment System 30404 Sunny St Paul College Web System 02-FEB-11 30404 Development 30534 Mariah New York Ticket Corp 09-SEP-10 30534 Payment System 67
  • 69.
    30664 James New York Ticket Corp 09-SEP-10 30664 Payment System 30924 Susan St Paul College Web System 02-FEB-11 30924 Development 31054 Peter New York Ticket Corp 09-SEP-10 31054 Payment System 31314 Fox New York Ticket Corp 09-SEP-10 31314 Payment System 31444 Deng St Paul College Web System 02-FEB-11 31444 Development 31704 Shirly New York Ticket Corp 09-SEP-10 31704 Payment System 31834 Mathew St Paul College Web System 02-FEB-11 31834 Development 32094 Donna New York Ticket Corp 09-SEP-10 32094 Payment System 32224 Linda St Paul College Web System 02-FEB-11 32224 Development 32224 Linda New York Ticket Corp 09-SEP-10 32224 Payment System 32484 Kevin St Paul College Web System 02-FEB-11 32484 Development 36514 Lou New York Ticket Corp 09-SEP-10 36514 Payment System Table 14 68
  • 70.
    Deliverable 6 -DatabaseMaintenance Scripts /* create the dependent table*/ CREATE TABLE DEPENDENT ( Depend_Num Number (5), First_Name VARCHAR2(50), Last_Name VARCHAR2(50), Dep_Dob DATE , Emp_id NUMBER, Depend_Type varchar2(20) ); /* create the sequence for the primary key for depend_num*/ create sequence depend_depend_num_seq start with 065000 increment by 13 Nocycle; /* creates the constraints assiocated with dependent table */ Alter table DEPENDENT modify (first_name CONSTRAINT depend_first_name_nn not null) modify (last_name CONSTRAINT depend_last_name_nn not null) modify (dep_DOB CONSTRAINT depend_dep_dob_mn not null ) modify (emp_id CONSTRAINT depend_Emp_id_nn NOT NULL) modify (Depend_Type CONSTRAINT depend_Depend_Type_nn NOT NULL); Alter table DEPENDENT add constraint depend_Depend_num_pk PRIMARY KEY (Depend_Num); Alter table DEPENDENT add CONSTRAINT Depend_Emp_id_fk FOREIGN KEY(Emp_id) REFERENCES EMPLOYEE(Emp_id); 69
  • 71.
    DML Statements insert intodependent (depend_num, first_name, last_name, dep_dob, emp_id, Depend_Type ) values ( depend_depend_num_seq.nextval, 'Nancy', 'Brown', to_date('18-oct-1969', 'dd-mon-yyyy'), (select emp.emp_id from employee emp where emp.emp_id = 32744), 'Wife' ); insert into dependent (depend_num, first_name, last_name, dep_dob, emp_id, Depend_Type ) values ( depend_depend_num_seq.nextval, 'John', 'Ikenna', to_date('08-dec-1985', 'dd-mon-yyyy'), (select emp.emp_id from employee emp where emp.emp_id = 32874), 'Husband' ); insert into dependent (depend_num, first_name, last_name, dep_dob, emp_id, Depend_Type ) values ( depend_depend_num_seq.nextval, 'Greg', 'Tobi', to_date('12-mar-1985', 'dd-mon-yyyy'), (select emp.emp_id from employee emp where emp.emp_id = 33004), 'Partner' ); insert into dependent (depend_num, first_name, last_name, dep_dob, emp_id, Depend_Type ) values ( depend_depend_num_seq.nextval, 'Mariah', 'Winfield', to_date('09-apr- 1969', 'dd-mon-yyyy'), (select emp.emp_id from employee emp where emp.emp_id = 33134), 'Partner' ); insert into dependent (depend_num, first_name, last_name, dep_dob, emp_id, Depend_Type ) values ( depend_depend_num_seq.nextval, 'luther', 'king', to_date('09-apr-1988', 'dd-mon-yyyy'), (select emp.emp_id from employee emp where emp.emp_id = 33394), 'Partner' ); 70
  • 72.
    insert into dependent(depend_num, first_name, last_name, dep_dob, emp_id, Depend_Type ) values ( depend_depend_num_seq.nextval, 'Rolland-H', 'king', to_date('01-jan- 1969', 'dd-mon-yyyy'), (select emp.emp_id from employee emp where emp.emp_id = 33264), 'Husband' ); insert into dependent (depend_num, first_name, last_name, dep_dob, emp_id, Depend_Type ) values ( depend_depend_num_seq.nextval, 'Gladys', 'Stevens', to_date('01-jan- 1980', 'dd-mon-yyyy'), (select emp.emp_id from employee emp where emp.emp_id = 33524 ), 'Wife' ); insert into dependent (depend_num, first_name, last_name, dep_dob, emp_id, Depend_Type ) values ( depend_depend_num_seq.nextval, 'Grace', 'Zack', to_date('24-aug-1965', 'dd-mon-yyyy'), (select emp.emp_id from employee emp where emp.emp_id = 35474 ), 'Wife' ); insert into dependent (depend_num, first_name, last_name, dep_dob, emp_id, Depend_Type ) values ( depend_depend_num_seq.nextval, 'Grace', 'Zack', to_date('24-aug-1965', 'dd-mon-yyyy'), (select emp.emp_id from employee emp where emp.emp_id = 35474 ), 'Wife' ); 71
  • 73.
    /* display alldependents */ SELECT * FROM DEPENDENT DEPEND_NUM FIRST_NAME LAST_NAME DEP_DOB EMP_ID DEPEND_TYPE 65000 Nancy Brown 18-OCT-69 32744 Wife 65013 John Ikenna 08-DEC-85 32874 Husband 65026 Greg Tobi 12-MAR-85 33004 Partner 65039 Mariah Winfield 09-APR-69 33134 Partner 65052 luther King 09-APR-88 33394 Partner 65065 Rolland-H King 01-JAN-69 33264 Husband 65078 Gladys Stevens 01-JAN-80 33524 Wife 65091 Grace Zack 24-AUG-65 35474 Wife Table 15 /* list the dependent name and their correspondanting employee*/ select e.emp_id, initcap(e.first_name) ||','||initcap(e.last_name) as Employee_Name, dep.depend_num, dep.dep_dob, initcap(dep.first_name)||','||initcap(dep.last_name) as Dependent_Name, dep.depend_type from employee e inner join dependent dep on e.emp_id = dep.emp_id; 72
  • 74.
    EMP_ID EMPLOYEE_NAME DEPEND_NUM DEP_DOB DEPENDENT_NAME DEPEND_TYPE 32744 Sanford,Brown 65000 18-OCT-69 Nancy,Brown Wife 32874 Vonda,Ikenna 65013 08-DEC-85 John,Ikenna Husband 33004 Celina,Tobi 65026 12-MAR-85 Greg,Tobi Partner 33134 Brenda,Bell 65039 09-APR-69 Mariah,Winfield Partner 33264 Jaqueline,King 65065 01-JAN-69 Rolland-H,King Husband 33394 Roland,King 65052 09-APR-88 Luther,King Partner 33524 Michael,Stevens 65078 01-JAN-80 Gladys,Stevens Wife Table 16 Figure 12 Update Statements 73
  • 75.
    /* the Spousechanged her first_name */ update dependent set first_name = 'Lisa' where DEPEND_NUM = 65000; /* the spouse birth day was changed */ update dependent set dep_dob = '28-Aug-1965' where DEPEND_NUM = 65013; /* the spouse got separated and was removed*/ delete dependent where DEPEND_NUM = 65039; /* changes the name of the colum dep_dob */ Alter table dependent Rename column dep_dob to DOB /* Display all dependents with updated information */ SELECT * FROM DEPENDENT DEPEND_NUM FIRST_NAME LAST_NAME DEP_DOB EMP_ID DEPEND_TYPE 65000 Lisa Brown 18-OCT-69 32744 Wife 65013 John Ikenna 28-AUG-65 32874 Husband 65026 Greg Tobi 12-MAR-85 33004 Partner 65052 luther king 09-APR-88 33394 Partner 65065 Rolland-H king 01-JAN-69 33264 Husband 65078 Gladys Stevens 01-JAN-80 33524 Wife 65091 Grace Zack 24-AUG-65 35474 Wife Table 17 74
  • 76.
    Deliverable 7 –Functons & Stored Procedure /* lower function*/ SELECT LOWER(p.PROJ_NAME) as PROJ_NAME, p.DUE_DATE, CONCAT(CONCAT(e.FIRST_NAME,' '), e.LAST_NAME) as PROJ_MANAGER FROM PROJECT p ,EMPLOYEE e WHERE p.PROJ_MGR_ID=e.EMP_ID; PROJ_NAME DUE_DATE PROJ_MANAGER wbbmn urban tv system development 27-DEC-13 Joel Jeremiah citizens bank database development 09-AUG-12 Zack Isaiah new york ticket corp payment system 09-SEP-10 Ashland Macnell st paul college web system development 02-FEB-11 Ashland Macnell Table 18 /* UPPER And INITCAP Character Function */ SELECT UPPER(p.PROJ_NAME) as PROJ_NAME, p.DUE_DATE, INITCAP(CONCAT(CONCAT(e.FIRST_NAME,' '), e.LAST_NAME)) as PROJ_MANAGER FROM PROJECT p ,EMPLOYEE e WHERE p.PROJ_MGR_ID=e.EMP_ID 75
  • 77.
    PROJ_NAME DUE_DATE PROJ_MANAGER WBBMN URBAN TV SYSTEM DEVELOPMENT 27-DEC-13 Joel Jeremiah CITIZENS BANK DATABASE DEVELOPMENT 09-AUG-12 Zack Isaiah NEW YORK TICKET CORP PAYMENT SYSTEM 09-SEP-10 Ashland Macnell ST PAUL COLLEGE WEB SYSTEM 02-FEB-11 Ashland Macnell DEVELOPMENT Table 19 /* RPAD And SUBSTR Character Functions*/ SELECT RPAD(SUBSTR(p.PROJ_NAME,1,15),18,'.') as PROJ_NAME, p.DUE_DATE, INITCAP(CONCAT(CONCAT(e.FIRST_NAME,' '), e.LAST_NAME)) as PROJ_MANAGER FROM PROJECT p ,EMPLOYEE e WHERE p.PROJ_MGR_ID=e.EMP_ID; PROJ_NAME DUE_DATE PROJ_MANAGER WBBMN Urban TV... 27-DEC-13 Joel Jeremiah Citizens Bank D... 09-AUG-12 Zack Isaiah New York Ticket... 09-SEP-10 Ashland Macnell St Paul College... 02-FEB-11 Ashland Macnell Table 20 76
  • 78.
    /* NVL, SUM,multiply and GROUP BY functions to find total paid for employees for each project */ SELECT a.PROJ_NUM, RPAD(SUBSTR(p.PROJ_NAME,1,15),18,'.') as PROJ_NAME, SUM(NVL(a.ASSIGN_HOURS,0) * NVL(e.EMP_RATE,0)) as TOTAL_COST from ASSIGNMENT a, EMPLOYEE e ,PROJECT p WHERE a.EMP_ID = e.EMP_ID AND a.PROJ_NUM = p.PROJ_NUM GROUP BY a.PROJ_NUM, p.PROJ_NAM PROJ_NUM PROJ_NAME TOTAL_COST 905 St Paul College... 622550 910 Citizens Bank D... 731700 900 New York Ticket... 850160 Table 21 /*------------------------------------------------------------------------*/ /* NVL, SUM, multiply, GROUP BY and HAVING functions to find */ /* projects that total paid for employees exceeds 750000 */ /*------------------------------------------------------------------------*/ SELECT a.PROJ_NUM, RPAD(SUBSTR(p.PROJ_NAME,1,15),18,'.') as PROJ_NAME, SUM(NVL(a.ASSIGN_HOURS,0) * NVL(e.EMP_RATE,0)) as TOTAL_COST from ASSIGNMENT a, EMPLOYEE e ,PROJECT p WHERE a.EMP_ID = e.EMP_ID AND a.PROJ_NUM = p.PROJ_NUM GROUP BY a.PROJ_NUM, p.PROJ_NAME HAVING SUM(NVL(a.ASSIGN_HOURS,0) * NVL(e.EMP_RATE,0)) >750000; PROJ_NUM PROJ_NAME TOTAL_COST 900 New York Ticket... 850160 Table 22 77
  • 79.
    /*------------------------------------------------------------------------*/ /* TO_CHAR, SYSTIMESTAMP, MONTHS_BETWEEN, and FLOOR */ /* functions to find list of employees over 50 years old */ /*------------------------------------------------------------------------*/ SELECT INITCAP(CONCAT(CONCAT(e.FIRST_NAME,' '), e.LAST_NAME)) as EMP_NAME, TO_CHAR(MONTH e.DOB,'MM/DD/YYYY') as DOB, (SYSTIMESTAMP - e.DOB) YEAR TO as "AGE Year ot Month", FLOOR(MONTHS_BETWEEN(SYSTIMESTAMP,e.DOB)/12) as AGE from EMPLOYEE e WHERE FLOOR(MONTHS_BETWEEN(SYSTIMESTAMP,e.DOB)/12) > 50; EMP_NAME DOB AGE Year ot Month AGE Carlos Winworth 12/28/1958 +52-07 52 Joel Jeremiah 10/20/1958 +52-09 52 Sam Walteron 04/14/1951 +60-04 60 Mariah Johnson 02/19/1955 +56-05 56 James Imgram 01/20/1950 +61-06 61 Joel Roland 12/20/1950 +60-07 60 Peter Wolf 09/15/1955 +55-11 55 Marxwall Luther 01/15/1952 +59-07 59 Table 23 78
  • 80.
    Deliverable 8 -ExplainTool Selection Query set timing on; delete from plan_table; explain plan for SELECT last_name FROM employee WHERE job_code =65; select * from table(dbms_xplan.display) PLAN_TABLE_OUTPUT Plan hash value: 1970680878 | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | | 0 | SELECT STATEMENT | |4 | 44 | 3 (0) | 00:00:01 | |* 1 | TABLE ACCESS FULL| EMPLOYEE | 4 | 44 | 3 (0) | 00:00:01 | Predicate Information (identified by operation id): 1 - filter("JOB_CODE"=65) Table 24 13 rows selected. Elapsed: 00:00:00.04 Projection Query set timing on; delete from plan_table; explain plan for SELECT * from department; `select * from table(dbms_xplan.display)) 2 rows deleted. Elapsed: 00:00:00.00 Explained. Elapsed: 00:00:00.01 79
  • 81.
    PLAN_TABLE_OUTPUT Plan hash value:3547660139 | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | | 0 | SELECT STATEMENT | |7 | 259 | 3 (0) | 00:00:01 | | 1 | TABLE ACCESS FULL| DEPARTMENT | 7 | 259 | 3 (0) | 00:00:01 | Table 25 8 rows selected. Elapsed: 00:00:00.03 Join Query set timing on; delete from plan_table; explain plan for select d.first_name "Employee Name", e.first_name "Dependent Name" from dependent d join employee e using (emp_id); select * from table(dbms_xplan.display) Elapsed: 00:00:00.00 Explained. Elapsed: 00:00:00.02 PLAN_TABLE_OUTPUT Plan hash value: 1353759702 | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | | 0 | SELECT STATEMENT | |7 |1 | 6 (17) | 00:00:01 | | 1 | MERGE JOIN | |7 | 168 | 6 (17) | 00:00:01 | | 2 | TABLE ACCESS BY INDEX ROWID | EMPLOYEE | 48 | 576 | 2 (0) | 00:00:01 | | 3 | INDEX FULL SCAN | EMP_ID_PK| 48 | | 1 (0) | 00:00:01 | |* 4 | SORT JOIN | |7 | 84 | 4 (25) | 00:00:01 | 80
  • 82.
    | 5 |TABLE ACCESS FULL | DEPENDENT | 7 | 84 | 3 (0) | 00:00:01 | Predicate Information (identified by operation id): 4 - access("D"."EMP_ID"="E"."EMP_ID") filter("D"."EMP_ID"="E"."EMP_ID") Table 26 18 rows selected. Elapsed: 00:00:00.05 Union Query set timing on; delete from plan_table; explain plan for select first_name, last_name from dependent union all select first_name, last_name from employee; select * from table(dbms_xplan.display) Figure 13 81
  • 83.
    Deliverable 9 -Object-Relational Exercises /* Create the phone_number_type object*/ create type phone_number_type as object ( Home number, Mobile number, Work number ); Figure 14 /* Create the contact table*/ Create table contact ( contact_id number, Emp_ID number, Address varchar2(50), Apt_Num varchar2(50), City varchar2(30), H_State varchar2(3), Phone_Number phone_number_type ); 82
  • 84.
    Figure 15 /*desc contactcommand*/ Figure 16 83
  • 85.
    /* Insert tocontact table*/ insert into contact (contact_id, emp_id, address, city, h_state, Phone_Number) values (con_contact_id_seq.nextval, 35474, '8080 W Maddison', 'City Heights', 'NJ', phone_number_type (2029091840, 0, 82500920)); Figure 17 insert into contact (contact_id, emp_id, address, city, h_state, Phone_Number) values (con_contact_id_seq.nextval, 30794, '909 E Hudson', 'New York City', 'NY', phone_number_type (2098908860, 2098008860, 82500922)) ; insert into contact (contact_id, emp_id, address, apt_num, city, h_state, Phone_Number) values (con_contact_id_seq.nextval, 34434, '4040 E Fifth Ave', '18GC', 'New York City', 'NY', phone_number_type (2013499292, 2015499292, 82500924)); insert into contact (contact_id, emp_id, address, apt_num, city, h_state, Phone_Number) values (con_contact_id_seq.nextval, ( select emp_id from employee where emp_id = 30404), '1900 S Lake Pine Dr', '2d', 'New England', 'CT', phone_number_type (2420017540, 2420017940, 82500923)); 84
  • 86.
    Figure 18 /* Selectthe data from the contact table*/ Figure 19 85
  • 87.
    /* Update thecontact table*/ update contact set Phone_Number = phone_number_type (2029091840, 2029391840, 82500920) where CONTACT_ID = 20; Figure 20 /* Select the data from the contact table*/ select * from contact; Figure 21 86
  • 88.
    References Elmasri, R. &Navathe, S. (2011). Fundamentals of Database Sytems (6th ed.). Boston, MA: Pearson. Group 8 (2011). Employee Skill Management Database System. Reterived from http://tychousa9.umuc.edu/DBST652/1106/9040/class.nsf/Course+Content/B6A1 B17D413D020785257891005D9457?OpenDocument O’Heam, S. (2010). OCA Oracle Database SQL Certified Expert Exam Guide. NewY ork: GuideMcGraw Hill. Oracle. Oracle SQL Data Modeler Demonstration. Reterived from http://www.oracle.com/technetwork/developer-tools/datamodeler/demonstrations- 224554.html Oracle. (2010). Introduction to Oracle Objects. Object-Relational Features. Retrieved from http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14260/adobjint.htm Rischert, A. (2010). Oracle SQL by Example. Upper Saddle River, NJ: Prentice Hall. 87