Create a function

Assignment Help Database Management System
Reference no: EM1339195

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: EM1339195

Questions Cloud

How can you characterize a new enzyme''s kinetics : how can You characterize a new enzyme's kinetics. No, the activity does not change with increasing enzyme concentration correctly. The enzyme may be only active in a dimer that forms a high concentration.
Determine the debt level : Discuss how do you Determine the debt level.
Explain the partnership agreement : Explain The Partnership Agreement and What are the grounds that Raju could use to apply for a dissolution of their partnership by way of court's order
Write down a balanced equation for the reaction catalyzed : find which of the following describes the type of the reaction(s) catalyzed: condensation (carbon-carbon bond formation); dehydration (loss of water); hydration (addition of water); decarboxylation (loss of CO2); oxidation-reduction; sutrate-level..
Create a function : Create a function that returns the day of the week for a specified date. Create a trigger that displays the message "Emp table updated" when an update to the employee table increases the employee's basic salary.
Three causes of world war i : Identify the nations that went to war in 1914. Explain at least three causes of World War I. What effect did World War One have on the 'European Consciousness'?
Explain employment law- polygraph tests : Explain Employment Law- Polygraph Tests and What if the employee volunteers (suggests) the use of a polygraph test to prove his
What type of inhibition is working on the substrate : An enzyme and its substrate are combined in a test tube but no product is formed. Another molecule is added to the tube, and now the product is formed at the normal rate. Give 2 reasons.what type of inhibition is working on the substrate.
Describing a project with initial cash outlay : The information below describes a project with an initial cash outlay of $10,000 and a required return of 12%.

Reviews

Write a Review

Database Management System Questions & Answers

  Draw the e/r diagrams for the business rules

Draw the E/R diagrams for the business rules

  First - second or third normal form

How many entities are shown by this relation?

  Difference between obsolescent and redundant stocks

Difference between obsolescent and redundant stocks

  Create a database using oracle packaged procedure

Create a database using Oracle packaged procedure

  Kinds of joins

It is not uncommon to have to access the data which reside in different tables, especially when formulating a report.

  Describing the select statement

Data processing needs taking or receiving the data from a source and doing something with it. The same can be said about the transaction processing. When working along with a file, whether it be a fixed length.

  Entity-relationship diagram

Create an entity-relationship diagram and design accompanying table layout using sound relational modeling practices and concepts.

  Prepare the e-r diagram for the movie database

Energy in the home, personal energy use and home energy efficiency and Efficient use of ‘waste' heat and renewable heat sources

  Analysis of a simple case study

VSS has an existing software package that controls its high bay systems and wants to rewrite it. The existing system is written in C and uses C-ISAM files to store data.

  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:

  Data modeling and normalization

Data Modeling and Normalization

  Explain the datawarehouse and data mining concepts

There are six major types of information systems which organisations use in their operations. Discuss how these information systems support managers in their decision making role Explain the datawarehouse and data mining concepts using appropria..

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