title: How to create relationships in MySQL
body: <p>In class, we are all 'studying' databases, and everyone is using Access. Bored with this, I am trying to do what the rest of the class is doing, but with raw SQL commands with MySQL instead of using Access.</p>
  
  <p>I have managed to create databases and tables, but now how do I make a relationship between two tables?</p>
  
  <p>If I have my two tables like this:</p>
  
  <pre><code>CREATE TABLE accounts(
      account_id INT NOT NULL AUTO_INCREMENT,
      customer_id INT( 4 ) NOT NULL ,
      account_type ENUM( 'savings', 'credit' ) NOT NULL,
      balance FLOAT( 9 ) NOT NULL,
      PRIMARY KEY ( account_id )
  )
  </code></pre>
  
  <p>and</p>
  
  <pre><code>CREATE TABLE customers(
      customer_id INT NOT NULL AUTO_INCREMENT,
      name VARCHAR(20) NOT NULL,
      address VARCHAR(20) NOT NULL,
      city VARCHAR(20) NOT NULL,
      state VARCHAR(20) NOT NULL,
      PRIMARY KEY ( customer_id )
  )
  </code></pre>
  
  <p>How do I create a 'relationship' between the two tables? I want each account to be 'assigned' one customer_id (to indicate who owns it).</p>