Assignment #3
Date and Conversion Functions Answers
1. Determine the Start Time for all sections of course 20. The time should be displayed as Month,
Date, Year, Hour, and Minute, with a column alias of Start Time (4 rows).
SELECT TO_CHAR(start_date_time,’MM/DD/YYYY HH:MI’)
2. Determine the difference in days between the first start time of a class and the last start time
for a course when the course has more than one section (18 rows).
SELECT MAX(start_date_time) – MIN(start_date_time),
course_no, COUNT(course_no)
3. Display the start time of section 140 with the following format:
Start Time
4. Write a SELECT statement to determine how many students enrolled in February 2007 (157
rows).
5. Show a list of course numbers, their description and their prerequisites. If the prerequisite is
6. Using DECODE, write a query that checks the phone number of students. If the area code is
212, remove it. If it is anything else., put a 1- in front of the phone number. Display the student
name and the phone number. If they have no phone number, display “No Phone”.
SELECT first_name||’ ‘||last_name Student,
DECODE(SUBSTR(phone,1,3),’212′,