Difference between revisions of "Oracle:Section7"

From mi-linux
Jump to navigationJump to search
(Created page with " == Exercise 7.1 == 7.1 Create a file which produces a report on Salesmen earning more than 3000. The report should have the following features: * it should be headed 'Comp...")
 
Line 1: Line 1:
 
+
[[Main Page]] >> [[Oracle|Oracle and SQL]] >> [[Oracle_Workbook|Workbook]] >> Section 7 answers
  
  
Line 5: Line 5:
  
 
7.1 Create a file which produces a report on Salesmen earning more than 3000. The report should have the following features:
 
7.1 Create a file which produces a report on Salesmen earning more than 3000. The report should have the following features:
* it should be headed 'Computing Salesmen Report'
+
* it should be headed 'Computing Sales Report'
 
* each page should have 'For Your Eyes Only' at the bottom of the report.  
 
* each page should have 'For Your Eyes Only' at the bottom of the report.  
 
* the output should be ordered by salary.  
 
* the output should be ordered by salary.  
 
* The SQL query file should be stored as U:\salesman.sql.  
 
* The SQL query file should be stored as U:\salesman.sql.  
 
* save the output of the query into a file U:\salary.txt.
 
* save the output of the query into a file U:\salary.txt.
 +
 +
SET TTITLE 'Computing Sales Report'
 +
SET BTITLE 'For Your Eyes Only'
 +
SET PAGESIZE 65
 +
 +
SPOOL u:\salary.txt
 +
SELECT * FROM EMP
 +
WHERE JOB = 'SALESMAN';
 +
 +
REM don't forget to switch everything off again
 +
SPOOL OFF
 +
TTITLE OFF
 +
BTITLE OFF

Revision as of 18:30, 8 March 2016

Main Page >> Oracle and SQL >> Workbook >> Section 7 answers


Exercise 7.1

7.1 Create a file which produces a report on Salesmen earning more than 3000. The report should have the following features:

  • it should be headed 'Computing Sales Report'
  • each page should have 'For Your Eyes Only' at the bottom of the report.
  • the output should be ordered by salary.
  • The SQL query file should be stored as U:\salesman.sql.
  • save the output of the query into a file U:\salary.txt.

SET TTITLE 'Computing Sales Report' SET BTITLE 'For Your Eyes Only' SET PAGESIZE 65

SPOOL u:\salary.txt SELECT * FROM EMP WHERE JOB = 'SALESMAN';

REM don't forget to switch everything off again SPOOL OFF TTITLE OFF BTITLE OFF