Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Oct 1, 1996

Relating Two Data Records to Each Other

Question:
How can I relate 2 or more records in one file to each other?

Answer:
There are a few ways to do this. The main and most popular method is to use a technique called foreign keys. For instance, let's say you have a database with employees and departments. Each employee is assigned to a particular department. Both departments and employees have unique IDs associated with them. To associate an employee with a department, you store the department ID in the same record as the rest of the employee data. By doing this, you accomplish two things:

  1. The employee is associated with a department, allowing you to produce reports and other useful information.
  2. The department information is not duplicated on the employee record, allowing for easier updates of both sets of information later.
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date