title: MySQL on delete cascade, FK in source table
body: <p>I have 2 tables, customer and address. Customer has column address with FK referencing to table address.</p>
  <p>Table customer</p>
  <pre><code>create table customer
  (
      id int(11) not null primary key,
      ...
      address    int(11) null,
      constraint fk_customer_address
          foreign key (address) references address (id)
          on update cascade on delete cascade,
  )
  </code></pre>
  <p>Table address</p>
  <pre><code>create table address
  (
  id int(11) not null primary key,
  ...
  )
  </code></pre>
  <p>I want to have address id in customer table, because in future there will be more tables referencing to address table (Users.address, Business.address, etc) and one table for all addresses because of the same format.</p>
  <p>When I delete row in customer table, address row stays in DB.</p>
  <p>Is it possible to use this FK relation to delete row in address table, or do I have to delete it manually (programmatically)?</p>
  <p>Does this mean that when I delete row from address, customer row is deleted as well?</p>
  <p>Edit:<br />
  Yes, it does.</p>