|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
foreign key
at what situation foreign key's value can have null value?
and in what situation foreign key can't have null value? |
|
#2
|
||||
|
||||
|
foreign key can have a null value if the design of the application allows it
foreign key can be declared not null if every row in the child table must have a parent row you want examples? create table people ( id integer not null primary key , fullname varchar(50) not null , married_to integer null foreign key references people(id) ) being married is optional, so the FK may be null create table cities ( id integer not null primary key , cityname varchar(100) not null , country_code char(2) not null foreign key references country(code) ) a city must be in some country, so that FK is not null rudy http://r937.com/ |
|
#3
|
|||
|
|||
|
thx... for the explanation...
|
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > foreign key |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|