Assign3 Ans
Assign3 Ans
COUNT(DISTINCT student_id)
enrollment e
enroll_date >=TO_DATE('01-FEB-2007')
enroll_date <TO_DATE('01-MAR-2007')
5. Show a list of course numbers, their description and their prerequisites. If the prerequisite is
null, substitute None using NVL and a data conversion function.
SELECT course_no, NVL(TO_CHAR(prerequisite) ,'None')
FROM course
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',
SUBSTR(phone,5),
null, 'No phone',
'1-'||phone) Phone
FROM student