Home » SQL & PL/SQL » SQL & PL/SQL » Query help (Oracle)
Query help (Oracle) [message #6974] Wed, 14 May 2003 08:30 Go to next message
Nazma Bepat
Messages: 34
Registered: May 2003
Member
Can someone please help me to create a query using the course table that will display the course number, prerequisite and cost. If the employee does not have a prerequisite put “No Prerequisite Listed”. Create an alias for the column.

Thanks

nazma
Re: Query help (Oracle) [message #6975 is a reply to message #6974] Wed, 14 May 2003 09:18 Go to previous messageGo to next message
Shane Kaszyca
Messages: 16
Registered: May 2003
Junior Member
SELECT course_number,'No Prerequisite Listed' as prerequisite,cost
FROM course
WHERE course_number = ''
union
SELECT course_number, prerequisite, cost
FROM course
WHERE course_number <> ''

Hope this helps. If your prerequisite is null rather than blank ('') check for null instead
********************************************
Can someone please help me to create a query using the course table that will display the course number, prerequisite and cost. If the employee does not have a prerequisite put “No Prerequisite Listed”. Create an alias for the column.
Re: Query help (Oracle) [message #6976 is a reply to message #6974] Wed, 14 May 2003 09:20 Go to previous messageGo to next message
Shane Kaszyca
Messages: 16
Registered: May 2003
Junior Member
What I meant to say, is "If your course_number" is null rather than blank(''). Hope that makes more sense
Re: Query help (Oracle) [message #7013 is a reply to message #6974] Thu, 15 May 2003 06:48 Go to previous message
Martin Chadderton
Messages: 35
Registered: May 2003
Member
Well, I've seen everything now....

How about just

SELECT
course_number,
NVL(prerequisite, 'No Prerequisite Listed'),
cost
FROM course
Previous Topic: Wanted to find all related columns in other tables
Next Topic: How to insert "&" with an INSERT statement ?
Goto Forum:
  


Current Time: Wed Apr 24 11:45:36 CDT 2024