Sara_j_11
asked on
sql; table relationships
I have a table called all :
All table:
Al_id(primary key)
P_cd (foreign key relationship to table called prom) ; can be null
Prom table:
P_cd (primary key)
Now when I do a :
select * from all
where p_cd is null
I get some records where the p_code is null. Does that not mean that the foreign key relationship is violated? There are currently no null values in the prom table& Please clarify if there is some problem with this table&
All table:
Al_id(primary key)
P_cd (foreign key relationship to table called prom) ; can be null
Prom table:
P_cd (primary key)
Now when I do a :
select * from all
where p_cd is null
I get some records where the p_code is null. Does that not mean that the foreign key relationship is violated? There are currently no null values in the prom table& Please clarify if there is some problem with this table&
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No, the data in the question *DOES NOT* imply that there are records in the "prom" table with a null value. It only tells us there are records in the "all" table with a null value in the column that is a foreign key to the "prom" table. And, that is OK according to Oracle's documentation of how foreign keys work in a column where null values are allowed.