|
-
Problem is not with insert into statement
Hi
Very Good Morning.
First of all have a look at your table Structure.
Table : Teacher Table : Department
[B]IID pk [/B] dname
fname [I]department_number pk[/I]
lname [B]s_iid fk[/B]
[I]department_number fk[/I]
Now Remember the fundamental of primary key- foreign key.
Without entering Primary key , can u enter foreign key?
NO
In your case you are doing same thing dear.
[B]Suppose you are entering record into "Teacher",[/B]
You get an error, becouse nothing is there into "department_number" field of table "Department", so if primary key is null, then can u enter into foreign one?
[B]Suppose you are entering record into "Department",[/B]
You get an error, becouse nothing is there into "S_iid" field of table "Teacher", so if primary key is null, then can u enter into foreign one?
Now got it?
What happen with it?
so remove s_iid of tabel of "department"
I dont know ur requirement but it is useless.
As u have "department_no" into "Teacher" its useless.
So,
Take Care
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|