Table1 having two foreign keys cust_id and branch_id:
create table loan_details(branch_id int(5), cust_id int(5), amount int(10), foreign key(branch_id) references branch_details(branch_id), foreign key(cust_id) references cust_details(cust_id));
Table2 having primary key cust_id:
create table cust_details(cust_id int(5), cust_name varchar(25),primary key(cust_id));
Table3 having primary key branch_id:
create table branch_details(branch_id int(5), branch_name varchar(25),primary key(branch_id));
Selection from 3 tables using natural join:
SELECT cust_id,cust_name,amount FROM cust_details c JOIN loan_details l ON c.cust_id=l.cust_id JOIN branch_details b ON l.branch_id=b.branch_id;