Linking Of Tables Database Online: Sometimes it may be extremely important to establish connections between tables in the database. It does not present any difficulty with the help of Freejobalerted.in relational database builder as the Linking functionality is embedded into it. So, let’s see how to implement it step by step.
Let us assume that we have 2 tables: Players and Teams. The first table includes the players’ names and the players’ numbers. The second table contains such fields as teams’ names, their cities, and rating.
So, after all the fields are added to find the linking button in the Forms menu.
After you press the button, a window, in which it is necessary to establish relations between forms, will appear. In order to do it after all the necessary web components are chosen establish one of the available linking types: has many, has and belongs to many, belongs to, has one, and then indicates fields in relation to which linking will take place.
The linking type Belongs to implies that many players belong to one team. If you add a new player you should remember that he can play only in one team, which will be established in the second webform. You can show the available members of the team as a dropdown list, from which it is possible to choose only one member. Entering a new record, you need to choose the team he plays for. There is a possibility of viewing all the records that relate to a particular group. All you need is to click on the name link and show all the linked teams with the help of the corresponding option.
The records will be reflected in a table. There is a possibility of their sorting and export to Excel.
The next considered linking type is Has and belongs to many.
In this case, if you add new players there is a possibility to choose more than one team. When you add some data to the “Players” database the fields, in relation to which the linking takes place, will be reflected on the form, after that you can choose a group for a player.
The addition of records contained in the “Players” form to the “Teams” form occurs in the same way.
The “Records” menu includes tables, in which data from both forms are kept. Moreover, a column is added to every table – a field that was indicated during the process of establishing connections between the tables. In our case records kept in the field are shown as a dropdown list. (Compositions for with players or on the contrary).
For example, if you choose a record in the linking field (let’s say, Andrey Shevchenko, playing for Dinamo), then all the information on it will be reflected: city, Dinamo club rating, as well as the list of all players of Dinamo.
In order to get acquainted with such a linking type Has many, we will need to create an additional table. It will contain information about the teams’ coaches. It is obvious here that every team can have only one coacher and, correspondingly, every coacher can work only with one team. We need to choose forms, a linking type, as well as a column according to which an interaction will take place. For example, let’s link the “Coachers” web-form and the “Teams” form on the basis of the “Name” form.
Linking Of Tables Database Online (Important Notice)
In case any additional records are added in the “Coachers” field you will need to indicate the name of the team for which training this or that coacher is responsible for. In order for the records kept in the second form of the “Name” field to be shown a dropdown list will be used. Its peculiarity consists in the fact that it is possible to choose only one element – team’s name – from this list. Moreover, one more column with teams’ names from the second database will be added to the “Coachers” table. If you click on the link you will go over to the given record. Information about a coacher: his name, salary, and name of the team, which he trains will be reflected.