Creating a new VIEW (SQL Server)

  • I have the following tables:

    Candidates Table: c. CandidateID, C. FirstName, c. LastName, c. Email, c. Nationality, c. English, c. Spanish, c. French, c. Portugese, c. OtherLanguage, c. OtherLanguageLevel, c. DOB

    PandC Table: a.ID, a. PostingID, a. CandidateID, a. CategoryType

    Postings Table: p. PostingID

    Education Table: e. IDEduc, e. CandidateID, e. DegreeID

    Degrees Table: d. Id, d. Degree, d. DegreeLevel

    CandidateExperience Table: x. cid, x. exp

    where c.CandiadteID=a.CandidateID=e.CandidateID=x.cid

    where a.PostingID=p.PostingID

    where e.DegreeID=d.ID

    I need to create a view using joins or any appropriate method  to get all the values for above said columns based on CandiadateID.

    i.e. for each CandidateID, I need the FirstName, LastName, Email, Nationality, English, Spanish, French, Portugese, OtherLanguage, OtherLanguageLevel, DOB, PostingID, CategoryType, DegreeID, Degree, exp

    Thanks in advance

    Affu Q

  • Is this a joke?

     

    Create view Candidate

    AS

    SELECT c.CandidateID, c.FirstName, c.LastName, c.Email, c.Nationality, c.English, c.Spanish, c. French, c. Portugese, c. OtherLanguage, c. OtherLanguageLevel, c. DOB, a.PostingID, a.CategoryType, e.DegreeID, d.Degree, x.exp

    FROM CandidateTable c

    INNER JOIN Pandc a ON c.CandidateID = a.CandidateID

    INNER JOIN Posting p ON a.PostingID = p.postingID

    INNER JOIN Education e ON c.CandidateID = e.CandidateID

    INNER JOIN Degree d ON e.degreeID = d.ID

    INNER JOIN CandidateExperience x ON c.CandidateID = x.cid

  • Sounds a lot like a homework question... or someone's trying to learn sql all by himself!

  • I think it is a homework question. You may want to set up  a separte table for languages with canditate id or set up a check constraint for langauge column and then try to do all the joins.  


    Tajammal Butt

  • Thank you Loner....

    I am trying to learn SQL by following some tutorials and I came across this problem.

    Thanks again for all your help.

    Affu Q

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply