Page 270 - IT 402 v2.0 class 10
P. 270
So while entering data an error message is displayed when the user tries to save the record number 5 with
ity as blank. he error message is displayed because ntry re uired property was set to es . If the property
would have been set to No and the user would have saved the record then in such case the error message
would not have been displayed.
RELATIONSHIP
relationship refers to link between different tables of a database by matching the data on the basis of the
common rimary key field. elational databases support different types of relationships between tables which
are designed to enforce the concept of referential integrity. ase supports different types of relationships
among tables. s an example consider two tables: able and able where able has a foreign key to able .
In database relationship of the tables may be between:
One-to-one relationship: In this relationship, both the tables must have Primary Key Columns. It occurs
when there is exactly one record of able that corresponds to exactly one record with able .
One-to-many relationships: In this relationship, one of the tables must have a Primary Key column that
will be associated with all the columns of related tables. It occurs when each record in TableA can have
many linked records in able but each record in able may have only one corresponding record in
TableA.
Many-to-many relationships: In this relationship, none of the associated tables have Primary Key column.
It means that all the columns of rimary ey fields are associated with all the columns of related tables. It
occurs when each record in able may have many linked records in able and vice-versa.
onsider a database of shop in which there are ustomer table Item table Order table ddress table and
OrderedItems table with fields as: ustomerI OrderI ItemI etc.
There is one-to-one relationship between the CustomerID in the Customers table and the CustomerID in
the Address table. This relationship indicates that each customer may be associated with an address.
There is one-to-many relationship between the OrderID in the Orders table and the OrderID in the
OrderedItems table. This relationship indicates that each order may contain multiple items, but each
OrderedItem record may only correspond to a single order.
here is Many-to-many relationship between the ItemI in the Items table and the ItemI in the
OrderedItems table. This relationship indicates that each item of stock may be associated with many orders.
elationships between tables help to:
Save time as there is no need to enter the same data in separate tables that are connected
268 Touchpad Information Technology-X

