Reply to Re: SQL - Foreign key with references of multiple tables with same primary key field

Your name:

Reply:


Posted by M A Srinivas on 04/09/07 06:34

On Apr 9, 9:48 am, "Chirag" <chirag.dpa...@gmail.com> wrote:
> I want to create a table with
>
> member id(primary key for Students,faculty and staff [Tables])
>
> and now i want to create issues[Tables] with foreign key as member id
> but in references i could not able to pass on reference as or
> condition for students, faculty and staff.
>
> Thank You,
> Chirag

Two options

1. Create multiple member tables
member_student,member_faculty,member_staff and
issues_student,issues_faculty,issues_staff

2. Create a new column called flag in both the tables like
Create table member ( memberid iNT, Flag Char(1) --S - Student,
F- Faculty, T - Staff)

Primary Key (flag,memberid)
Create table Issues (memberid INT, Flag Char(1) -- S - Student, F-
Faculty, T- Staff)
Primary Key (flag,memberid)

Now Reference two tables with flag and memberid.

If you want to refernce member table with student,faculty,staff you
need to handle in trigger

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация