How can I list the students in the CIS department? (SQL Server Query)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sunflower2005
    New Member
    • Dec 2007
    • 2

    How can I list the students in the CIS department? (SQL Server Query)

    I need to write the SQL script for the above question.

    Student table contains students' IDs, names, Addresses.

    MajorMinor table contains 4 departments with unique code.
    Name is a field and CIS is an attribute. Code(primary key) is a field and CIS is 13.

    Student declares major. Declares table has StudentID and MajorMinorCode. The only student, his StudentID is 3579, has MajorMinorCode 13. (Meaning he is the only student who declared CIS as his major.)

    I created and populated my database in SQL Server Management.

    I am having trouble if I am selecting 2 tables or just one table with any other clauses?
    Any help is appreciated! Thanks!
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    That looks like an assignment / home work .

    Can you kindly post what you have tried to solve the mentioned problem.

    Comment

    • sunflower2005
      New Member
      • Dec 2007
      • 2

      #3
      Originally posted by debasisdas
      That looks like an assignment / home work .

      Can you kindly post what you have tried to solve the mentioned problem.
      Here you go.
      SELECT Student.Name
      FROM (Student INNER JOIN Declares ON Student.ID = Declares.Studen tID) INNER JOIN MajorMinor ON Declares.MajorM inorCode = MajorMinor.Code
      WHERE ((MajorMinor.Na me)="CIS"));

      Comment

      Working...