35,10,0,50,1
25,600,60,0,3000,5000,25,800
90,150,1,50,12,30,50,1,70,12,1,50,1,1,1,5000
0,2,1,0,2,40,15,5,2,1,0,20,0,1
welcome to wplecturer.com
welcome to wplecturer.com
welcome to wplecturer.com...
welcome to wplecturer.com...
welcome to wplecturer.com
welcome to wplecturer.com
welcome to wplecturer.com
welcome to wplecturer.com
welcome to wplecturer.com
welcome to wplecturer.com

Translate

How does a foreign key help?

More
2 weeks 5 days ago #3302 by ekatsa
How does a foreign key help? was created by ekatsa
How does a foreign key help?

Please Log in to join the conversation.

More
2 weeks 5 days ago - 2 weeks 5 days ago #3303 by ekatsa
Replied by ekatsa on topic How does a foreign key help?
The FOREIGN KEY constraint is used to prevent actions that would destroy links between tables. A FOREIGN KEY is a field (or collection of fields) in one table, that refers to the PRIMARY KEY in another table (google).

If you have the header Orders Table, then at the Detail Orders Table must exist the Primary Key of an order as foreign key in order to be a relation for the two tables. So we know what are the products of this order, the detal table includes one record per product ( if this producy has 3 products we may have quantity 3, but one row).We can not delete the Header order if there are record(s) in the Detail Order, and we know this from Foreign Key ( of course we may use DELETE CASCADE).I hope to help
Last edit: 2 weeks 5 days ago by ekatsa.

Please Log in to join the conversation.

Time to create page: 0.355 seconds