Home » SQL & PL/SQL » SQL & PL/SQL » Writing Quiry (merged)
Writing Quiry (merged) [message #382819] Sun, 25 January 2009 06:15 Go to next message
Rana_m_s
Messages: 2
Registered: January 2009
Junior Member
Hi
I have 4 tables in my database which are:

Course_table
--------------
CourseID, CourseName

Section_table
--------------
Sectionid, CourseID

SectionInstructor_table
------------------------
SectionID, InstructorID

Instructor_table
-----------------
InstructorID, InsName

Student_table
--------------
StudentName,StudentID

SectionStudents_table
---------------------
StudentID, SectionID

I need to write a very simple quiry that disply each Section with courseName and instructorname and list of students.
some section which are not assigned to instructor also it has to be displayed but without instructorname.

My Quiry:
Selecr InstructorName,CourseName,Sectionnumber,Studentname,StudentID
From Course_table, Section_table, SectionInstructor_table, Instructor_table, Student_table
Where Section_table.SectionID = SectionStudents_table.StudentID
And Student_table.StudentID = SectionStudents_table.StudentID
And Section_table.SectionID = SectionInstructor_table.SectionID
And SectionInstructor_table.InstructorID = Instructor_table.InstructorID
And Course_table.CourseID = Section_table.SectionID
And SectionInstructor_table.InstructorID = Instructor_table.InstructorID

The quiry did not return sections with no instructors?
Re: Writing Quiry [message #382824 is a reply to message #382819] Sun, 25 January 2009 07:09 Go to previous messageGo to next message
michael_bialik
Messages: 611
Registered: July 2006
Senior Member
Search for outer join

HTH
Re: Writing Quiry [message #382825 is a reply to message #382824] Sun, 25 January 2009 07:15 Go to previous messageGo to next message
Rana_m_s
Messages: 2
Registered: January 2009
Junior Member
How??
Re: Writing Quiry (merged) [message #382828 is a reply to message #382819] Sun, 25 January 2009 08:03 Go to previous message
Michel Cadot
Messages: 64121
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
How??

By clicking on the "Search" link above for example.
Or reading SQL Reference.

Also please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Post a Test case: create table and insert statements along with the result you want with these data.

Regards
Michel


Previous Topic: How to find a specific special characters from a string (merged 3)
Next Topic: Allow updating on few columns (3 threads merged by bb)
Goto Forum:
  


Current Time: Wed Dec 07 02:48:31 CST 2016

Total time taken to generate the page: 0.07679 seconds