01. juli 2005 - 14:55Der er
8 kommentarer og 1 løsning
Hvorfor relationer
Jeg har efterhånden fået lavet en hel del databaser, men jeg bruger kun relationer i forespørgsler, ikke for selve tabellerne. Er der nogen grund til at lave om på den praksis?~)
Lets say you have a table containing postal code and another customers. You could have a customer which uses postal code 7100 (Vejle) Now you can go into the postal code table and delete the record for Vejle. If you had use relationships and referential integrity you would not be allowed to.
When you design your tables there is a field type (lookup wizard) this is actually a wizrad which makes the relationships for you. Then if you go in the Relationships window you will be able to see how the tables are relaed. You can then alter the relationship types by right clicking on the thin line.
Synes godt om
Slettet bruger
04. juli 2005 - 08:28#4
Ok I understand.
But what happens to the relations if you have to "bring in" a linked table to work on the db. Deleting the linked table and then importing it and vice versa?~)
You should still be able to link tables which are linked with tables which are not. Whet do you mean by "Deleting the linked table and then importing it and vice versa?~)"? Do you mean actually replacing a linked table with a local table?
You can always remove a relationship and make it again when you have imported.
Lets say you have an Order/Order Detail relationship. If you used referential integrity and Cascade Deletes then by deleting a record in the Order table would also deleted related Order Detail records, without any extra code.
So there are a number of advantages using relationships.
Synes godt om
Slettet bruger
04. juli 2005 - 12:48#6
Sorry, I'm so slow with the reply but I got lots of projekts going.
It's because I have had problems developing with linked tables. It has slowed everything down (to the point of complete stops in some occassions), so therefore I import those linked tables, develop and then link to the backend again. If I had a lot of relations they would disappear when I delete the tables. So, actually the question is: Do the relations come back automatically if you delete a table and import it again (I think I can guess the answer!~)
As it is from my viewpoint I don't gain enough by working with the relations, so.... I will properly continiue as is!~)
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.