Oracle 9i Help [message #6847] |
Thu, 08 May 2003 06:27 |
Nazma Bepat
Messages: 34 Registered: May 2003
|
Member |
|
|
I have the following question:
Display the course number, description, created date and cost of every course that has a prerequisite of 350.
My answer:
Select course_number, description, cost,
from course
where prerequisite is not null
and cost = 350
My answer does not work. Can someone please let me know why.
Thanks
Nazma
|
|
|
Re: Oracle 9i Help [message #6848 is a reply to message #6847] |
Thu, 08 May 2003 06:49 |
|
Barbara Boehmer
Messages: 9077 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
It is hard to guess without seeing your table structure. In general you need to:
SELECT columns_you_want
FROM tables_that_columns_you_want_are_in
WHERE join_tables_by_common_fields
AND additional_filters
/
Applying that to what information you have given, if all of the columns are in the course table, then:
SELECT course_number, description, created_date, cost
FROM course
WHERE prerequisite = 350
/
However, I suspect that not all of the columns that you want are in the course table, so you will probably need something like:
SELECT course_number, description, created_date, cost
FROM course, other_table
WHERE course.some_column = other_table.some_column
AND prerequisite = 350
/
You need to figure out what tables the columns that you want are in and do a describe of those tables to make sure that you have the correct column names, for example:
SQL> DESCRIBE course
|
|
|
|
Re: Oracle 9i Help [message #6862 is a reply to message #6850] |
Fri, 09 May 2003 00:09 |
robin baby
Messages: 13 Registered: May 2003
|
Junior Member |
|
|
if u want to add a new colum in the table u can alter the table then update ,f u watc to add that perticular column only in ur query then u can write the query like select (columns),coursecost+100 newcoursecost from tablename
|
|
|
Re: Oracle 9i Help [message #6865 is a reply to message #6862] |
Fri, 09 May 2003 00:40 |
|
Barbara Boehmer
Messages: 9077 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
Additionally, if you want to preserve the case and spacing of the label, then you will need to place it within double quotes: "New Course Cost".
|
|
|