{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Practice 5 - Practice 5 SQL 1 Group functions work across...

This preview shows pages 1–2. Sign up to view the full content.

Practice 5 – SQL 1. Group functions work across many rows to produce one result. True 2. Group functions include nulls in calculations False 3. The WHERE clause restricts rows prior to inclusion in a group calculation. True 4. Display the highest, lowest, sum, and average salary of all employees. Label the column Maximum, Minimum, Sum, and Average, respectively. Round your results to the decimal position. Save your SQL statement in a file called p5q4.sql SQL> select round(max(sal),2) "Maximum", 2 round(min(sal),2) "Minimum", 3 round(sum(sal),2) "Sum", 4 round(avg(sal),2) "Average" 5 from emp; Maximum Minimum Sum Average --------- - ---------- ---------- ---------- 5000 800 29025 2073.21 SQL> ed/ File saved 5. Modify p5q4.sql to display the minimum, maximum, sum and average salary for each job type. Resave to a file called p5q5.sql. Rerun your query. SQL> select job ,round(max(sal),2) "Maximum", 2 round(min(sal),2) "Minimum", 3 round(sum(sal),2) "Sum", 4 round(avg(sal),2) "Average" 5 from emp 6 group by job SQL>/ JOB Maximum Minimum Sum Average --------- ---------- ---------- ---------- ---------- CLERK 1300 800 4150 1037.5 SALESMAN 1600 1250 5600 1400 PRESIDENT 5000 5000 5000 5000 MANAGER 2975 2450 8275 2758.33

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}