1 create a function that returns the day of the week for a

Assignment Help Database Management System
Reference no: EM13360404

1. Create a function that returns the day of the week for a specified date.

Create [or replace] function func_name

https://www.youtube.com/watch?v=iHwjUKfhAAs

2. Create a procedure that accepts an employee number and a job. In the procedure, determine if the employee has the specified job or not. If the employee has the job, display the employee's ID number. If the employee does not have that job, display the employee's name and his or her actual job title.

3. Create a trigger to store a copy of any record deleted from the employee table into a table called Emp_temp. Assume that the Emp_temp table has the same structure as the employee table.

4. Create a trigger that displays the message "Emp table updated" when an update to the employee table increases the employee's basic salary.

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

Schema.sql keeps

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

 

-- DESCRIPTION

--   This script creates the SQL*Plus demonstration tables in the

--   current schema.  It should be STARTed by each user wishing to

--   access the tables.  

 

SET TERMOUT ON

PROMPT Building demonstration tables.  Please wait.

SET TERMOUT OFF

DROP TABLE EMPLOYEES;

DROP TABLE DEPARTMENTS;

DROP TABLE BONUS;

DROP TABLE SALGRADE;

CREATE TABLE EMPLOYEES

       (EMPLOYEE_ID NUMBER(2) NOT NULL,

        EMPLOYEE_NAME VARCHAR2(20),

        JOB_ID VARCHAR2(2),

 JOB_DESCRIPTION VARCHAR2(20),

        HOD NUMBER(2),

        HIREDATE DATE,

        SALARY NUMBER(10, 2),

        DEPARTMENT_ID NUMBER(2));

INSERT INTO EMPLOYEES VALUES

        (1, 'SMITH', 'J1', 'CLERK',     5,

        TO_DATE('17-DEC-2007', 'DD-MON-YYYY'),  5800, 20);

INSERT INTO EMPLOYEES VALUES

        (2, 'ALLEN', 'J2', 'SALESMAN',  3,

        TO_DATE('20-FEB-2008', 'DD-MON-YYYY'), 7600,  30);

INSERT INTO EMPLOYEES VALUES

        (3, 'WARD', 'J2',  'SALESMAN',  5,

        TO_DATE('22-FEB-2008', 'DD-MON-YYYY'), 8250, 30);

INSERT INTO EMPLOYEES VALUES

        (4, 'JONES','J3',  'MANAGER',   7,

        TO_DATE('2-APR-2008', 'DD-MON-YYYY'),  4900, 20);

INSERT INTO EMPLOYEES VALUES

        (5, 'JACK', 'J2','SALESMAN',  7,

        TO_DATE('28-SEP-2008', 'DD-MON-YYYY'), 6700, 10);

INSERT INTO EMPLOYEES VALUES

        (6, 'BLAKE', 'J3', 'MANAGER',   7,

        TO_DATE('1-MAY-2008', 'DD-MON-YYYY'),  12850,30);

INSERT INTO EMPLOYEES VALUES

       (7, 'CLARK', 'J3', 'MANAGER',   NULL,

       TO_DATE('9-JUN-2008', 'DD-MON-YYYY'),  22450, 10);

INSERT INTO EMPLOYEES VALUES

        (8, 'SCOTT', 'J4', 'ANALYST',   5,

        TO_DATE('09-DEC-2008', 'DD-MON-YYYY'), 13000,20);

INSERT INTO EMPLOYEES VALUES

        (9, 'TURNER', 'J2','SALESMAN',  3,

        TO_DATE('8-SEP-2007', 'DD-MON-YYYY'),  5500, 30);

INSERT INTO EMPLOYEES VALUES

        (10, 'ADAMS',  'J1','CLERK',     5,

        TO_DATE('12-JAN-2007', 'DD-MON-YYYY'), 9100, 20);

CREATE TABLE DEPARTMENTS

       (DEPARTMENT_ID NUMBER(2),

        DEPARTMENT_NAME VARCHAR2(20),

        LOCATION VARCHAR2(20) );

INSERT INTO DEPARTMENTS VALUES (10, 'ACCOUNTING', 'NEW YORK');

INSERT INTO DEPARTMENTS VALUES (20, 'PRODUCTION','MINNESOTA');

INSERT INTO DEPARTMENTS VALUES (30, 'SALES',      'CHICAGO');

INSERT INTO DEPARTMENTS VALUES (40, 'OPERATIONS', 'BOSTON');

CREATE TABLE BONUS

        (ENAME VARCHAR2(10),

         JOB   VARCHAR2(9),

         SAL   NUMBER,

         COMM  NUMBER);

 

CREATE TABLE SALGRADE

        (GRADE NUMBER,

         LOSAL NUMBER,

         HISAL NUMBER);

INSERT INTO SALGRADE VALUES (1,  3000, 8000);

INSERT INTO SALGRADE VALUES (2, 8001, 14000);

INSERT INTO SALGRADE VALUES (3, 14001, 20000);

INSERT INTO SALGRADE VALUES (4, 20001, 25000);

INSERT INTO SALGRADE VALUES (5, 25001, 30000);

COMMIT;

SET TERMOUT ON

PROMPT Demonstration table build is complete.

Reference no: EM13360404

Questions Cloud

Select a company that has gone public in the last few years : select a company that has gone public in the last few years on an organized exchange anywhere in the world.answer the
I am wishing for information on the cell wall i have read : i am wishing for information on the cell wall. i have read much information from books andor websites that has provided
Application developing a budgetwhen developing a budget : application developing a budgetwhen developing a budget what variables do you have to take into account? in health care
No one can predict the future but accountants and financial : no one can predict the future but accountants and financial managers must try and do exactly thatnbsp by examining net
1 create a function that returns the day of the week for a : 1. create a function that returns the day of the week for a specified date.create or replace function
Computer platformscomputer systems may be classified into : computer platformscomputer systems may be classified into two categories classical and quantum. this assignment will
A compressor installed at a whalf for loading container : a compressor installed at a whalf for loading container ships is able to provide 6 bar.g pressure into the pressure
The system on site is a pressure sand filter with a service : the system on site is a pressure sand filter with a service curve. the filter is backwashed using the feed pump at a
Explain choosing an appropriate business ownership : explain choosing an appropriate business ownership modellist possible alternatives and provide reasons why your

Reviews

Write a Review

Database Management System Questions & Answers

  Create mock-up report to make the monthly claim

He wishes you to group data by insurance company number, with subtotals by company and grand totals for each numeric field.

  Justify a question on database management

When a student has not chosen a major at a university, the university often enters a value of "Undecided" for the major field. Is "Undecided" a way to represent the null value? Should it be used as a default value? Justify your answer carefully.

  Investigate the role of corporate venturing

A corporate venture has the resources of a large organisation and the entrepreneurial Benefits of a small one

  Write procedure to construct character frequency table

Write the procedure named Get_frequencies which constructs character frequency table. Input to procedure must be a pointer to the string, and pointer to array of 256 doublewords.

  Determine cost of least expensive part in part table

Write a query to determine the cost of the least expensive part in the part table? Format the returned price in dollars and cents using the correct function.

  Patients post cardiac bypass surgery

Monitor Renal Outcomes in patients post cardiac bypass surgery?

  Find average number of books borrowed per member

Find the average number of books borrowed per member. Take into account that if a member does not borrow any books, then that member does not appear in the borrowed relation at all.

  Create the primary key and foreign keys using a uml class

In order to move forward, the local university will need to develop a data model that will retain student records and perform various data extract transform and load (ETL) processes.

  List the all facts and dimensions of the enterprise

Choose a model (star, snowflake or constellation) and discuss why it is an appropriate choice.

  Your task is to develop a database to support this activity

Your task is to develop a database to support this activity.Here is what you need to be able to provide Custom Auto Body in order to land your first consulting contract:

  Prepare a use case diagram for the case study

Case Study based on an Interview contained in a separate document (Please see the details in page 221 of your text book). Carefully read this case study. You are required to answer the following questions based on the Case Study.

  Find names of students who have higher gpa from table

List the students ID, name, GPA, and course Number such that all students have GPA greater than 3 . 5 and enrolled in a course in Jan 1, 2011. Find the names of all students who have GPA greater than 3.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd