title: Converting an ER diagram to relational model
body: <p>I know how to convert an entity set, relationship, etc. into the relational model but what i wonder is that what should we do when an entire diagram is given? How do we convert it? Do we create a separate table for each relationship, and for each entity set? For example, if we are given the following ER diagram:</p>
  
  <p><img src="https://i.stack.imgur.com/I2s9c.jpg" alt="enter image description here"></p>
  
  <p>My solution to this is like the following:</p>
  
  <pre><code> //this part includes the purchaser relationship and policies entity set
  
  CREATE TABLE  Policies (
    policyid  INTEGER,
    cost  REAL,
    ssn  CHAR(11)  NOT NULL,
    PRIMARY KEY (policyid).
    FOREIGN KEY (ssn) REFERENCES Employees,
    ON DELETE CASCADE)
  
  
   //this part includes the dependents weak entity set and beneficiary relationship
  
   CREATE TABLE Dependents (
    pname  CHAR(20),
    age  INTEGER,
    policyid  INTEGER,
    PRIMARY KEY (pname, policyid).
    FOREIGN KEY (policyid) REFERENCES Policies,
    ON DELETE CASCADE)
  
  
   //This part includes Employees entity set
  
   CREATE TABLE Employees(
     ssn Char(11),
     name char (20),
     lot INTEGER,
     PRIMARY KEY (ssn) )
  </code></pre>
  
  <p>My questions are:</p>
  
  <pre><code>1)Is my conversion true?
  2)What are the steps for converting a complete diagram into relational model. 
  Here are the steps that i follow, is it true?
      -I first look whether there are any weak entities or key constraints. If there
       are one of them, then i create a single table for this entity set and the related        
       relationship. (Dependents with beneficiary, and policies with purchaser in my case)
      -I create a separate table for the entity sets, which do not have any participation  
       or key constraints. (Employees in my case)
      -If there are relationships with no constraints, I create separate table for them.
      -So, in conclusion, every relationship and entity set in the diagram are included 
       in a table.
  </code></pre>
  
  <p>If my steps are not true or there is something i am missing, please can you write the steps for conversion? Also, what do we do if there is only participation constraint for a relationship, but no key constraint? Do we again create a single table for the related entity set and relationship?</p>
  
  <p>I appreciate any help, i am new to databases and trying to learn this conversion.</p>
  
  <p>Thank you</p>