|
Ramapo Masters of Science Tools and Concepts of Data Analysis: Dataweb Access: Multi-table Queries (home) Overview | Creating a 2 Table Query | Adding a Table to an Existing Query | Relationships Overview: Queries involving more than one table In a relational database it is common to have more than one table containing related data. Queries are capable of simultaneously drawing data from two or more tables provided that the tables are logically constructed for such a purpose and that a relationship has been defined between the tables. In order to form a relationship between tables each table should contain an primary key. This primary key is a field whose value is never repeated in the table ensuring a unique marker for that record in the table. Microsoft Access attempts to include a field named ID in each table. This field will be set to a data type of auto-number to insure that this field always contains a unique value. Two tables are joined through a relationship established between one or more field in each table. These fields must have logical relationship such as each being the userid associated with the data in the record.
Adding a Table to an Existing Query Once the database is open and you have switched to query view (See first three steps in section above.)
When you first create a multi-table query, MS Access may attempt to create a relationship between the tables. If this relationship is incorrect it must be deleted. To delete a relationship:
Relationships are key to creating a multi-table query. Tables must be joined through fields that match related records in each table. In this example, the user_id in each table marks information associated with a particular entry in the database. To create a relationship:
Site Designed and Maintained by rsciorra |