Business Studies, asked by tonysusanth6362, 10 months ago

If customer has multiple addresses the address column of the table customer can be changed to

Answers

Answered by sourasghotekar123
0

Answer:

Foreign Key

Explanation:

  • I may build an Address table with columns Street, Town, and CustomerId if I have a customer with multiple addresses. Then I may insert numerous records for each client to have multiple addresses.
  • If a customer has many addresses connected with him or her, use a foreign key relationship between the customer and address tables.
  • By making CustomerId a primary key in the Customer table and a foreign key in the Address table, you can enforce the foreign key link between customers and their addresses. When a customer record is destroyed or inactivated, this ensures that no orphan records are left.
  • Use a third table CustomerAddress if the same address can be allocated to several customers, aka many-to-many between customers and addresses (junction table). The (CusomerId, AddressId) pair, as well as any other associated information particular to this combination, should be saved in the junction table.

#SPJ2

Answered by arshikhan8123
0

Answer:

The concept of The Foreign Key of Database Management is applicable here.

Group of columns or simply columns in a relational database management proving a link between data in two separate table is a Foreign Key. By referencing the primary key of another table hence establishing a link between them, foreign key acts as a cross reference between the tables.

In such reference we should also know the meaning of the primary key, the column or the group of columns containing values which help in uniquely identifying each row in a table is a Primary Key.

Explanation:

Now let us see how it is done,

• Firstly, build a customer table with the customer details with the  column of Customer Id.

• Second, build an Address table with all the details mentioned in the address like-Town, street, house number etc. Also add to it a column of Customer Id for customers having multiple addresses.

• Enter the records correctly.

• A Customer Id column is made as a primary key in the Customer table and Foreign Key in the Address table. This way we can enforce the link between the two tables.

• Now when a customer record will be destroyed, all the linked data will also get destroyed.

Hence we conclude that, if a customer has multiple addresses, the customer Id column of the Address table can be changed to a foreign key and a primary key in the customer table.

#SPJ2

Similar questions