Relationships vs. Joins
-
Hi, I was wondering when designing a database with multiple tables with PKs and FKs in place, why would I think to map those FKs and PKs between tables hence making relationships while I can retrieve whatever I need with joins without creating any relationships?
-
Hi, I was wondering when designing a database with multiple tables with PKs and FKs in place, why would I think to map those FKs and PKs between tables hence making relationships while I can retrieve whatever I need with joins without creating any relationships?
Hi ADO.net Support you Option by GUI this help you to make relationships and can make it by coding
-
Hi, I was wondering when designing a database with multiple tables with PKs and FKs in place, why would I think to map those FKs and PKs between tables hence making relationships while I can retrieve whatever I need with joins without creating any relationships?
Creating the relationships ensures database integrity. If there is a relationship between table A and table B, where table A's PK is a FK in table B, then SQL server will not allow you to delete records in table A that has child records in table B. I would not be surprised if there were not also performance benefits when joining table A and B aswell but I am not sure if this is the case.
-
Hi, I was wondering when designing a database with multiple tables with PKs and FKs in place, why would I think to map those FKs and PKs between tables hence making relationships while I can retrieve whatever I need with joins without creating any relationships?
You can get records using joins from any two tables. But if u are not using PKs and FKs how can u assure that a particular row or record in a child table is associated to a particular row in the master or parent table. By using PKs and FKs database forces a rule on data table so invalid data cannot be inserted. Joins are used to fetch record from more than 1 tables but donot force the rules on datbase tables.
Do good and have good.