Friday, October 9, 2009

Financial Management-i.m Pandey

relationships. How to define an index

* Relational databases.

A relational database allows the simultaneous use of data from more than one table.

By using the relationships, avoiding duplication of data, saving memory and disk space, increasing the speed of execution and providing the user on working with tables.

To achieve a correct relational database is essential to make a previous study of the design database.

order to relate tables together shall specify a common field that contains the same value in both tables and the primary key field is one of them.

The tables are related in pairs, where one of them will be the main table (which part relation) and the other is the child table (destination of the relationship).


* Types of relationships.

can distinguish three types of relationships:


  • one to one:

When a record in a table can be related a single row of another table and vice versa.

For example: we have two tables with data from different populations and the other with a list of Mayors, a population can have only one mayor, and mayor is only one population.

  • Value One to Many:

When a record in a table (child table) can only be related to a single record from another table (table), and a record of another table (primary table ) may have more than one related record in the first table (child table).

For example: we have two tables with different data populations and one with residents, a population can have more than one resident, but an inhabitant belong (be registered) in a single population.


  • Many to Many Relationship:

When a record in a table can be related to more than one record of another table and vice versa.

For example: we have two tables with customer data and another with items that are sold in the company, a customer can place an order with multiple items, and an article could be sold to more than one client.

many to many relationships are usually represented by defining a intermediate table between the two tables. Following the example above would define a table line items related to customers and items.


0 comments:

Post a Comment