dcsimg
Results 1 to 4 of 4

Thread: Link with a part of a table

  1. #1
    Join Date
    Jul 2004
    Location
    Saransk, Russia
    Posts
    6

    Question Link with a part of a table

    Tell me please how can I make a foreing key constraint for a table using from another not all primary key or not all data. For example, I need to link a table "subject" with primary key "dscp_num, depart" using depart as a foreing key. But there is no table with such primary key, there is only table "codif_values" where selecting records by condition "codif_num = 1" gives the relation with necesary primary key to link. Also I need to link "subject" table as a primary key table with the table "ses_curr". But this table doesn't include "depart" field. It includes field "reg_num" that is a primary key in table "students". This table include field "stgroup" as a foreing key for table "groups". The last table includes "speciality" field that is a foreing key for table "specialities". And only this table includes "depart" field. Tell me please how I can make a foreing key constraint for table "ses_curr" by table "subject".

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    Can you post the schema of both tables and the requirement.

  3. #3
    Join Date
    Jul 2004
    Location
    Saransk, Russia
    Posts
    6
    Current schema:
    Attached Images Attached Images

  4. #4
    Join Date
    Jul 2004
    Location
    Saransk, Russia
    Posts
    6
    The required relation:
    Attached Images Attached Images

Posting Permissions

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