title: Database design approach: suggestions needed
body: <p>I am designing training video marketplace application. There is going to be Paid and Unpaid customers. For Unpaid customers, I want to provide few videos as free access for selected training package. </p>
  
  <p>For example, if there is total 10 training videos in a given training package, 4 videos are going to be free. But, to view remaining 6 videos, customer needs to purchase whole training package.</p>
  
  <p>I am not able to decide proper approach to design database tables for this scenario. </p>
  
  <p>Here is what I can think of. I am not sure this is going to be correct approach.</p>
  
  <p><strong>First Approach:</strong>
  I am assuming, I need three tables like below:</p>
  
  <ul>
  <li>Customer Table (Columns: customer_id, customer info)</li>
  <li>Training Video Table (Columns: video_id, video url, free_access as boolean)</li>
  <li>Purchase Table (columns: Customer_id as foreign key, video_id as Foreign Key) </li>
  </ul>
  
  <p>When user accessing any training video, I will check if the user is paid or unpaid. For this I will take help of Purchase_table. Then on the basis of boolean free_access column, video will be served/denied. But, this seems too costly performance wise (I might be wrong on this!).</p>
  
  <p><strong>Second Approach:</strong> 
  I should create view on top of Training Video Table for Paid and Unpaid users to minimise access of videos for unpaid users. But, I am not sure how this is going to be implemented.</p>
  
  <p>Should I go with approach one with some caching mechanism to avoid querying Purchase table for every video request. Do you think it is OK or can suggest any new approach.</p>
  
  <p>Any help will be appreciated!</p>
  
  <p>Thanks</p>