Results 1 to 2 of 2

Thread: Another Query

  1. #1
    Join Date
    Sep 2003
    Posts
    15

    Unanswered: Another Query

    Hello All,

    This is another query I have to solve using SQL

    Assume the following:

    Transcript( stdid , crscode, Sem, Grade)
    Teaching(Profid, crscode, Sem)
    Professor( Id, ProfName, Dept)

    The query is : find all student ids who had taken a course from each professor in the 'MAT' department

    This is My attempt to solve the query :

    SELECT DISTINCT T.stdid
    FROM Transcript T, Professor P, Teaching Teach
    WHERE Teach.profid = P.id AND P.Dept = 'MAT' AND
    Teach.crscode = T.crscode

    Am I so far right ?

  2. #2
    Join Date
    Sep 2003
    Posts
    15
    Hi

    Here How I trace the answer :


    1. All 'MUS' professors : MUSPROF = id ( deptid= 'MUS' Professor)
    2. JOIN with Teaching to obtain which course taught by whom
    PROFCRS = (Teaching (JOIN profid=id) MUSPROF)

    3. STDCRS = (Transcript (JOIN crscode = crscode) PROFCRS)
    4. stdid, crscode (STDCRS).

    where :
    = project
    = select
    ??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •