Você está na página 1de 2

Aldo Francisco Resendiz Hernandez

1. Write a script file to display the employee name, job, and hire date for all employees
who started between a give range. Concatenate the name job together, separated by a
space and comma, and label the column Employees. Prompt the user for the two
ranges using the ACCEPT command. Use the format MM/DD/YYYY. Save the
script file as p8q3.sql.
SET PAGESIZE 37

SET LINESIZE 60

SET FEEDBACK OFF

set echo off

set verify off

accept date1 prompt'Please enter the low date range ( ´MM/DD/YYYY´ ):'

accept date2 prompt'Please enter the high date range ( ´MM/DD/YYYY´ ):'

select concat( ename || ', ', job) "EMPLOYEE", hiredate "HIREDATE"

from emp

where hiredate between '&date1' and '&date2';

1. Write a script to display the employee name, job, and department name for a given location.
The search condition should allow for case-insensitive searches of the department location.
Save the script file as p8q4.sql.
Please enter the location name : DALLAS

SET PAGESIZE 37

SET LINESIZE 60

SET FEEDBACK OFF

set echo off

set verify off

accept departamento prompt'Please enter the location name:'

select e.ename "EMPLOYEES", e.job "JOB", d.dname "DEPARTMENT"

from emp e, dept d

where e.deptno=d.deptno and d.loc= UPPER ('&departamento');


Aldo Francisco Resendiz Hernandez

1. Modify p8q4.sql to create a report containing the department name, employee name, hire
date, salary, and each emplooyee´s annual for all employees in a given location. Prompt
the user for the location. Label the columns DEPARTMENT NAME, EMPLOYEE NAME,
START DATE, SALARY, and ANNUAL SALARY, placing the labels on multiple lines. Resave
the script as p8q5.sql.

Please enter the location name : Chicago

SET PAGESIZE 100

SET LINESIZE 100

SET FEEDBACK OFF

set echo off

set verify off

accept departamento prompt'Please enter the location name: '

break on department

column e.hiredate heading 'START|DATE'

column e.sal*12 heading 'ANNUAL|SALARY'

select d.dname "DEPARTMENT", e.ename "EMPLOYEE", e.hiredate , e.sal "SALARY", e.sal*12

from emp e, dept d

where e.deptno=d.deptno and d.loc=UPPER('&departamento');

Você também pode gostar