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
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