It refers to organizing rows and interpreting columns and tables of a relational database. It provides and improves the whole performance and integrity of information and records. It is also called a ‘Relational Database‘ because it consists of one or more data in columns or tables. Each row is attached to another record, and each table describes the data information in a table as each information is related to another.
It defines how Relationship works by making data in both tables and having a unique consistency for each row. Each data is classified and dependent on another one. Here, users can add records and tables regarding the information. A sample data can be prepared for creating a query that determines some database in which you can add or copy data. A “Database“ is mainly a collection of related data, which contains the same types of data related to each other, and the tables will be related to each other in a particular database.
Uses–
• Use for storage in devices
• Used in various data structures
• Used for storing information systems
Adding data–
A datasheet is a simple look at your data in rows and columns. We can create a new web table; Access automatically creates two views. A table open in a Datasheet view resembles an Excel worksheet.
Steps –
• Select the views in the Datasheet view.
• Similarly, add some data.
• You can now see inserting new data and update the existing data.
• Click Yes, and you will see that the selected record has been added to it.
CREATE RELATIONSHIP
Create Relationships determines the related records of data from each table for the desired result. It defines by adding the tables we want to combine or relate to the Relationships Window by dragging the table to another one. It provides a detailed record of data in the table. A relationship can be created in MS access by combining data from two different tables, and each Relationship consists of two tables only.
Relationships are carried out from queries, i.e., we have to create queries to make a relationship between tables and records –
• One-to-One Relationship
• One to many Relationships.
• Many-to-many relationships.
Steps –
1. On the database, Click Relationships group.
2. Secondly, click Relationships.
3. Click Add tables in the Relationships group on the Design tab.
4. Select queries and then click Add.
5. After adding queries, click close.
6. Move it from one table to the other one.
7. Add, then separately click each one of the fields and drag it.
8. Click on the field name.
9. Select the field which you want and click create.
Edit a relationship –
You can also make changes and edit the Relationship of data. It allows changing the table Relationship by changing the tables or queries of both sides. Using facts, figures, charts, and information data, you can define relationships.
Steps –
• Double click the Relationship line; it becomes thicker when selected.
• On the database tab, click Edit Relationships as it appears.
• In the group, click Relationship and then Click All Relationships.
• Double click the Relationship line once again, or click Edit Relationship.
• Last one, click OK after making additional changes.
Update of Relationships
You can also update your information about data.
Steps –
1. Click Relationships in the Relationships group on the database tools.
2. Click All Relationships in the Relationships group on the design tab.
3. Click the relationship line for the Relationship you want to change.
4. Double-click the relationship line, and the Edit Relationships dialog box appears.
5. Select Enforce Referential Integrity.
6. Select either the Cascade Update Related Fields or the Cascade Delete Related Records, or you can also select both of them.
7. After making additional changes and then click OK. Delete a table relationship – If you want to remove a table relationship, you must delete the Relationship in the Relationship Window.
Steps –
1. Click Relationship in the Relationship group on the database.
2. Click All Relationships in the group on the design table.
3. Click the relationship line; it appears thicker when elected.
4. Press the DELETE key.
5. A confirmation message should be displayed that would you be sure to delete the data or not, so Click YES.
ONE-TO-ONE RELATIONSHIP
It is related to data in MS Access and is created only for its related fields, as it has primary records or unique content. As we can say also, it is a link between the information in two tables, where each record in each table only appears once.
In one-to-one Relationships, only one record in a table is associated with one and only one in the other. Each record in Table A can have only one matching record in Table B, and Table B can have only one matching record in Table A. This type of Relationship is not common because most information would be in one table. You might use a one-to-one relationship to divide a table with many fields. You can create a one-to-one Relationship by linking the index in one table and an index in another, which shares the same value and input. The best process is to create relationships to have the secondary table look up value from the first table.
Referential data integrity helps to keep data clean by deleting related records.
Steps of creating a one to one Relationship by adding a lookup field to a table:
1. Open a table.
2. In the Design view, add a new field.
3. Select the Data type value.
4. Select LOOKUP WIZARD; in this, the default is set to look up values of the other one.
5. Select NEXT.
6. Select the content you want to include in the table and press NEXT.
7. Add the field that contains the key people want to use in the Selected field, and select NEXT.
8. Set an order and change the width of the field.
9. Finally, on the final screen, clear the Enable Data.
ONE TO MANY RELATIONSHIPS –
In one to many relationships, one record in a table can be correlated with one or more than one record in another table. It returns related records when the value in the Customer ID field in the Orders table is the same as in the Customer ID field in the customer table. It can be identified by the infinity symbol on the line connecting the tables.
Steps –
• Click the Office icon on the upper left-hand corner.
• Click Access options, Access options dialog box appears.
• Click the Current Database button.
• Select Overlapping Windows in the Application Options Section, under Document windows options.
• Click OK.
Steps to create one to many relationships –
1) First, clear the layout by clicking on the option on the Design tab.
2) Add another table to the table task.
3) Click on the Save icon and enter tbl Tasks.
4) As the table name, go to the Relationship view.
5) Click on the show table option.
6) Add tbl projects and tbl Tasks and close the show Table dialog box.
7) Click the create button. We now have a one-to-many Relationship.
MANY TO MANY RELATIONSHIPS –
A many-to-many relationship exists when one or more items in one table can have a relationship with one or more items in another one. It contains orders placed by multiple customers, and a customer may place more than one order. It requires a little extra work up. It demonstrates a four-step process for creating an associate table to handle the Relationship. It occurs when both of the tables contain records that are related to more than one record. It would help if you created the third table because sometimes, Access doesn’t support a many-to-many Relationship. It contains a primary key and a foreign key to each data table. Many to many relationships are knowing data and taking the place of understanding how all the data fit together to accomplish the desired result. It is easier to spot during the Design process.
Steps to accommodate many to many Relationships –
• Delete the existing Relationship between the two tables.
• Create the table and include a foreign key field for both related data.
• Create a one-to-many relationship between each data table and the appropriate foreign key in the associate table.
• Delete foreign key fields in the many tables of the original one to many Relationships.
Associate table to base form on a query:
• Add all the non–key fields you must modify or may need from the many and one table.
• At the foreign key that represents the one side from the associate table.
It is a type of mathematical data which refers to the Relationship between two entities, i.e., A and B. This Relationship is usually implemented using an associative table; a logical model database table represents a many-to-many relationship between entity types. It occurs when multiple records in a table are associated with multiple records in another table.
For example – such as many to many relationships exists between employee and projects.