Creating auto-increment values using principal table.