|
Establishing Relationships
From NeoWiki
Revision as of 02:43, 4 August 2007 (edit) Lorinda (Talk | contribs) (types of relationships section) ← Previous diff |
Revision as of 03:04, 4 August 2007 (edit) (undo) Lorinda (Talk | contribs) (more of the article) Next diff → |
||
Line 4: | Line 4: | ||
==Types of Relationships== | ==Types of Relationships== | ||
- | Relationships can be one-to-one or one-to-many. In a one-to-one relationship, one record in one table relates to one and only one record in another table. In a one-to-many relationship, one record in one table relates to more than one record in another table. In our database, the relationship between Field Trips and Sightings is one to many; on any given field trip, the birder would (hopefully!) see many birds. | + | Relationships can be one-to-one or one-to-many. In a one-to-one relationship, one record in one table relates to one and only one record in another table. In a one-to-many relationship, one record in one table relates to more than one record in another table. In our database, the relationship between Field Trips and Sightings is one to many; on any given field trip, the birder would (hopefully!) see many birds. Note that at least one of the fields you are relating must be a primary key field. |
==Creating the Relationships== | ==Creating the Relationships== | ||
+ | #With the database open, go to the {{menu|Tools}} menu and choose {{menu|Relationships}} | ||
+ | #In the floating window, click on the '''Field Trips''' and then click the {{button|Add}} button. A small window named {{window|Field Trips}} appears in the larger {{window|Relation Design}} window. | ||
+ | #repeat with the '''Sightings''' | ||
+ | #close the floating window | ||
+ | #click on the the {{prefName|ID}} field in the {{Window|Field Trips}} sub-window; drad from there to the {{prefName|Field Trips ID}} field in the {{Window|Sightings}} sub-window. A line appears connecting these two fields, with a '''1''' the {{window|Field Trips}} end and an '''n''' next to the {{Window|Sightings}} window. This identifies a one-to-many relationship. | ||
+ | #click on the hard drive symbol in the toolbar to save the changes you have made, and close the window. |
Revision as of 03:04, 4 August 2007
Part of the power of Base is that it is a relational Database, allowing you to relate different tables of data. In order to make use of this power, we need establish the relationships between the various tables. In our case, not all the tables need to be related. The tables we "termed" covenience tables in the first article of this series, do not need to be related by an official process, as they will be used primarily for combo boxes and/or list boxes. The essential tables do need to be related to each other.
Types of Relationships
Relationships can be one-to-one or one-to-many. In a one-to-one relationship, one record in one table relates to one and only one record in another table. In a one-to-many relationship, one record in one table relates to more than one record in another table. In our database, the relationship between Field Trips and Sightings is one to many; on any given field trip, the birder would (hopefully!) see many birds. Note that at least one of the fields you are relating must be a primary key field.
Creating the Relationships
- With the database open, go to the Tools menu and choose Relationships
- In the floating window, click on the Field Trips and then click the Add button. A small window named Field Trips appears in the larger Relation Design window.
- repeat with the Sightings
- close the floating window
- click on the the ID field in the Field Trips sub-window; drad from there to the Field Trips ID field in the Sightings sub-window. A line appears connecting these two fields, with a 1 the Field Trips end and an n next to the Sightings window. This identifies a one-to-many relationship.
- click on the hard drive symbol in the toolbar to save the changes you have made, and close the window.