title: Declaring foreign key in Apache Derby database
body: <p>I am using Apache Derby database with <em><strong>ij</strong></em> 10.10.</p>
  <p>I have two tables. First is <code>usertable</code> and the second is <code>logintable</code>.
  In my <code>usertable</code> I have two columns: <code>userid</code> and <code>name</code>.
  My <code>logintable</code> table has two columns: <code>userid</code> and <code>password</code>.
  I need to set one column in <code>logintable</code> as foreign key where the primary key is in the <code>usertable</code>.</p>
  <p>I used the following command to create the table:</p>
  <pre class="lang-sql prettyprint-override"><code>create table usertable (userid varchar(10) primary key, name varchar(20));
  </code></pre>
  <p>How do I write the <code>logintable</code> to set the <code>userid</code> as a foreign key referring to the above primary key?</p>
  <p>Can anyone please help me out?</p>