0

I have made some tables and created relationship from phpmyadmin.
Relationship is as below
[IMG]http://img295.imageshack.us/img295/2411/relationship.jpg[/IMG]
Problem is that requisition table allow material id which is not in material table. what is the problem. How can I solve this.

Simply Foreign key can not be such value which is not in primary key. How can I do that

Attachments relationship.JPG 45.59 KB
2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by arctushar
0

If requisition table allows material ids (r_mat_id) which are not in material table, so where come this r_mat_id from? If this odd requirement is indeed necessary, you may omit foreign key definition in requisition table to get it function.

Btw, there seems to be a many to many realtionship between user and project. Therefore the complete primary key of permission table should consist of all primary key columns of both related table, thus it should be (user_id,user_name, prj_name, prj_id). On the other hand, if user_id is unique key of user table so why is user_name also part of its primary key, ditto for prj_name?

0

If requisition table allows material ids (r_mat_id) which are not in material table, so where come this r_mat_id from? If this odd requirement is indeed necessary, you may omit foreign key definition in requisition table to get it function.

Btw, there seems to be a many to many realtionship between user and project. Therefore the complete primary key of permission table should consist of all primary key columns of both related table, thus it should be (user_id,user_name, prj_name, prj_id). On the other hand, if user_id is unique key of user table so why is user_name also part of its primary key, ditto for prj_name?

I want that requisition table will notw allows material ids(r_mat_id) which is not in material table. How can I do that.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.