creating a "is a" relationship

  • Hello

    I have tables Employee, engineer, and programmer. I want to create a "is a" relationship. So that the engineer and programmer table will be an "is a" relationship of the employee. I am not sure how to implement this in sql server.

    many thanks in advance

    Steve

  • Sorry, if I understand you correct, why do you have three tables at all?

    Isn't a programmer at the same time also an employee?

    However, is this what you're after

    
    
    ALTER TABLE SpezialfondsKurse

    ADD CONSTRAINT c_Spezialfonds FOREIGN KEY
    (
    kaid
    )REFERENCES Kapitalanlagen (id)

    ON DELETE CASCADE
    ON UPDATE CASCADE

    GO

    Frank

    http://www.insidesql.de

    http://www.familienzirkus.de

    Edited by - Frank Kalis on 12/29/2003 05:24:45 AM

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Thanks for you reply.

    Yes l do need the 3 tables, as a programmer "is a" employee and engineer "is a" employee. The programmer and engineer both inherit from the employee table.

    I was hopping you could tell me how to do this using the SQL Enterprize manager.

    Many thanks in advance

    Steve

  • - Open your table in design view

    - Right-click on properties

    - Choose Relations (?!? Sorry, in german its' called Beziehungen) tab

    - Add new

    - Fill in the required informations as Parent and Child Table, columns in both tables...

    Frank

    http://www.insidesql.de

    http://www.familienzirkus.de

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Hello

    Thanks for you help.

    Steve

  • You should only need two tables a job_description table (i.e. Engineer, programmer, tester, etc) and an employees table that stores the foreign key from the job_description table.

    Edward M. Sokolove


    Edward M. Sokolove

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

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