in the diagram provided in the attachment.i have created a table for the entity loan and now i am facing difficulty in creating a table for payment.i know that payment is the dependent entity.is the following way of creating a table correct????

create table payment(
payment_number int,
payment_date date,
payment_amount int,
loan_number int,
primary key(loan_number,payment_number),
foreign key(loan_number)references loan(loan_number)
);

Yes.
I wonder, though, why you allow multiple payment_numbers. Make them unique and the primary key. In MySQL:

create table payment(
payment_number integer not null primary key,
payment_date date not null,
payment_amount float not null,
loan_number integer not null,
foreign key(loan_number) references loan(loan_number)
);

As payment is dependent attribute,we should make composite primary key(loan_number,payment_number)and loan_number will be the foreign key.pls correct me if i am wrong

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.