title: Oracle: Best practice to handle Flag
body: <p>I have designed an ER diagram for a DVD shop which allows rentals only to registered customers and purchases can be from anyone. A DVD can obviously cannot be rented after it is purchased.</p>
  
  <p>Every DVD can be purchased or bought. </p>
  
  <p><strong>Question:</strong></p>
  
  <p>What is the best way of enforcing in the database that a DVD cannot be rented after it is purchased.</p>
  
  <p><strong>My Solution:</strong></p>
  
  <p>I have a Sold_flag in DVD which is a Char(1 byte). It stores a one if it is sold and a zero if available purchased or rent. So if its a one it cant be rented.</p>
  
  <p>Similarly if a DVD is being rented it has a flag. Storing one if it is rented and zero if is available to rent or purchase. </p>
  
  <p>Are these two flags the best approach at dealing with these issues? </p>
  
  <p>I am string them as char(1 byte) is this the best way of storing them ?</p>
  
  <p>Situation:</p>
  
  <p>Member (<strong>Member_Num</strong>, Name, Address, Telephone_Num, Join_Date)</p>
  
  <p>DVD (<strong>DVD_ID</strong>, Film_ID, Sold_Flag,Rented_Flag)</p>
  
  <p>Rental (<strong>Member_Num, DVD_Num, Rented_On</strong>, Returned_On, Price, Fine)</p>
  
  <p>Purchase (<strong>DVD_ID</strong>, Member_Num, Price, Sold_On)</p>
  
  <p>Film (<strong>Film_ID</strong>, Director, Name, Rent_Price, Sale_Price)</p>
  
  <p><img src="https://i.stack.imgur.com/9IvxF.png" alt="enter image description here"></p>