Lab -5_Answers.ham - Lab Chapter 5- Aggregate Functions: 1....

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

View Full Document Right Arrow Icon
Lab Chapter 5- Aggregate Functions: 1. Write a SELECT statement to determine how many courses do not have a prerequisite. SELECT COUNT (course_no) FROM course WHERE prerequisite IS NULL 2. Write a SELECT statement to determine the total number of students enrolled in the program. Count the students only once, no matter how many courses they are enrolled in. SELECT COUNT (DISTINCT student_id) FROM enrollment 3. Write a SELECT statement to determine the average cost for all courses. If the course cost contains a NULL value, substitute the value by 0. SELECT AVG (NVL (cost, 0)) FROM course 4. Write a SELECT statement to determine the date of the most recent enrollment. SELECT MAX (enroll_date) FROM enrollment 5. Write a SELECT statement to determine how many employees in each department in the EMP table. SELECT deptno, COUNT (ename) FROM emp GROUP BY deptno 6. Write a SELECT statement to show the list of prerequisites and count how many times each appears in the course table. SELECT prerequisite, COUNT (prerequisite) FROM course GROUP BY prerequisite
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/27/2011 for the course IT GEIT3341 taught by Professor Sara during the Spring '11 term at Prince Mohammad Bin Fahd University, Dhahran.

Page1 / 2

Lab -5_Answers.ham - Lab Chapter 5- Aggregate Functions: 1....

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online