I am using Apache Derby database with ij 10.10.
I have two tables. First is usertable
and the second is logintable
.
In my usertable
I have two columns: userid
and name
.
My logintable
table has two columns: userid
and password
.
I need to set one column in logintable
as foreign key where the primary key is in the usertable
.
I used the following command to create the table:
create table usertable (userid varchar(10) primary key, name varchar(20));
How do I write the logintable
to set the userid
as a foreign key referring to the above primary key?
Can anyone please help me out?