title: Generalisation and Categorisation in SQL
body: <p>I have to implement a database in which there is categorization and generalisation. A customer entity exists which can be categorized into Person, Government or Company. Further there exists an overlap generalisation in which the customer can be an E-Commerce or Walk-in or both and there is a distinct generalisation in which the customer can either be an Employee or a regular Customer.</p>
  
  <p>I have implemented the tables as follows:</p>
  
  <p><strong>Customer</strong></p>
  
  <pre><code>CREATE TABLE Customer
  (
      Customer_id CHAR(4),
      First_order_date DATE,
      PRIMARY KEY(Customer_id)
  );
  </code></pre>
  
  <p><strong>Person</strong></p>
  
  <pre><code>CREATE TABLE Person
  (
      Customer_id CHAR(4),
      PRIMARY KEY(Customer_id)
  );
  </code></pre>
  
  <p><strong>Company</strong></p>
  
  <pre><code>CREATE TABLE Company
  (
      Customer_id CHAR(4),
      PRIMARY KEY(Customer_id)
  );
  </code></pre>
  
  <p><strong>Goverment</strong></p>
  
  <pre><code>CREATE TABLE Government
  (
      Customer_id CHAR(4),
      PRIMARY KEY(Customer_id)
  );
  </code></pre>
  
  <p><strong>Employee</strong></p>
  
  <pre><code>CREATE TABLE Employee
  (
      Customer_id CHAR(4),
      Employee _cutomer_name CHAR(15),
      Employee_discount_rate FLOAT,
      PRIMARY KEY(Customer_id) REFERENCES Customer(Customer_id)
  );
  </code></pre>
  
  <p><strong>Regular</strong></p>
  
  <pre><code>CREATE TABLE Regular
  (
      Customer_id CHAR(4),
      Regular_cutomer_name CHAR(15),
      Regular_cutomer_address CHAR(80),
      PRIMARY KEY(Customer_id) REFERENCES Customer(Customer_id)
  );
  </code></pre>
  
  <p><strong>WalkIn</strong></p>
  
  <pre><code>CREATE TABLE WalkIn
  (
      Customer_id CHAR(4),
      Walkin_cutomer_name CHAR(15),
      Walkin_cutomer_address CHAR(80),
      PRIMARY KEY(Customer_id) REFERENCES Customer(Customer_id)
  );
  </code></pre>
  
  <p><strong>ECommerce</strong></p>
  
  <pre><code>CREATE TABLE ECommerce
  (
      Customer_id CHAR(4),
      Ecommerce_cutomer_name CHAR(15),
      Ecommerce_cutomer_email CHAR(80),
      PRIMARY KEY(Customer_id) REFERENCES Customer(Customer_id)
  );
  </code></pre>
  
  <p>How do I ensure that the generalisation and categorisation constraints are met in my database?</p>