Master-detail relationship

from Wikipedia, the free encyclopedia

In software development, a master-detail relationship is understood to be a relationship between two blocks of displayed data in a computer program, with the second block (detail) containing more detailed information on the data of the first block (master).

Database application, user interface

With regard to database applications , the term is used in particular for the frequently occurring case that the first block contains exactly one and the second block contains a plurality of data records associated with the content of the first block . This is usually shown as a combination of form fields for the “master” data record with a table below or to the right for the “detail” data records.

Example:

A screen mask or website with the personal data of a customer and, as detailed data, the orders of this customer listed below.

Data model

A master-detail interface on the user interface of the computer program most often results from a corresponding structure of the database , namely a 1: n - relationship between two database tables (in the above example, between a customer table and an orders table) .

Database query

Database data that are in a master-detail relationship cannot (or not always correctly) be read from the database with a single SQL query. Since master and detailed data have to be read and written back separately, the data structure also determines the internal architecture of the program by creating separate datasets or direct views . Forms and reports in database applications often consist of program parts with a master-detail relationship.