Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

foreign key constraint

Status
Not open for further replies.

venky

Programmer
Jun 7, 1999
5
0
0
US
Visit site
hi,<br>
I am new to mysql but have experience on oracle and am implemnting a web db solution with mysql. <br>
<br>
I create two tables <br>
<br>
Cities which has 2 fields<br>
<br>
citycode mediumint primary key<br>
cityname varchar(20) <br>
<br>
and <br>
<br>
pincodes <br>
<br>
pincode mediumint primary key <br>
areaname varchar(20) <br>
citycode mediumint references cities (citycode ) <br>
match full<br>
<br>
the not null constraint is specified for the primary and foreign key fields . <br>
<br>
My problem is even after doing this the pincodes table<br>
is allowing entries for citycodes not in the cities master <br>
table .<br>
<br>
where am i going wrong or are there any other constraints<br>
needed to implement this.<br>
<br>
bye
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top