Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Create a view from multiple tables

750180Feb 3 2010 — edited Feb 3 2010
Hi all,

I am a newbie, so sorry if this is a "basic" question.

I had 3 tables TAB1, TAB2 and TAB3

TAB1 has
STU_ID(pk), NAME, GRADE, ADDRESS
TAB2 has
COURSE_ID(pk), STU_ID(fk), COURSE_NAME, ROOM_NUM, TIME, DAY
TAB3 has
MENTOR_NAME, TITLE, AVAILABLE_DAYS

Now I want to create a view(or query) that returns STU_ID, COURSE_NAME, NAME, GRADE, MENTOR_NAME and TITLE.
When I tried writing a query like
SELECT a.STU_ID, b.COURSE_NAME, a.NAME, a.GRADE, c.MENTOR_NAME, a.TITLE
FROM TAB1 a, TAB2 b, TAB3 c
WHERE a.STU_ID=b.STU_ID

I am getting multiple results..like I'm getting Mentor name 4 times, name 4 times like that.

So can anybody help me in writing the query for this....a "VIEW" would be appreciated.

Thanks In Advance
Srra
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 3 2010
Added on Feb 3 2010
9 comments
1,263 views