Drupal system has several options to save different types of information. Drupal allows to create content type which is collection of different fields to save information. Information can be student profile, examination result, employee salary, employee leave details etc. Some of the fields in content type are basic fields like text field, number fields etc. The reference fields is also a type of field available in content type which refer to other content or user or taxonomy. It means that the information for that filed is already inserted into the system and available with some other content or user or taxonomy. You just refer that field in your content type and link that field in your content type.
Lets see some examples which will help in understanding concept of reference field better.
- Take example of a school where all the details of students is entered into system. Each student is represents by a unique student ID in database. Now another information of result of each student need to inserted into system so create a content type of exam result. Each result relates to one of the student therefore a reference field need to be created into this “result” content type. This reference field will use “student ID” from “student profile” data. In this way results are referenced to students and a relationship is established.
- Assume a case of a organisation where employee details are fed into a database. Each employee is represented by a unique employee ID. There are some other details like employee salary and employee leave which need to be inserted into system so create a new content type for salary and leaves. Each of these content type will use a reference field from employee to get employee ID. This way each salary and leave is linked to concerned employee.
So reference field link information between two content type. You can take it like creating a table relationship. Whenever we create a database with multiple table, relationship between tables is also need to be created. Same thing applies to Drupal. Reference field allows you to create relationships.