In a one-to-one relationship, each row in the first table is linked to exactly one row in another table. If this relationship is applied, we can say that both the tables have an exactly equal number of rows any time.
We will take a look at the unidirectional and bidirectional ways to show a one-to-one relationship between the tables.
Here, we will consider the
PersonDetail classes to show a demo. So, let's first create the classes and tables for both.
Use the following script to create the tables if you are not using
Use the following script to create the
CREATE TABLE `passport_detail` ( `id` bigint(20) NOT NULL ...