title: one to optional many Relationship
body: <p>I want to create one to optional many relation between following two table. </p>
  
  <pre><code>'FK_transactionmember' FOREGIN KEY ('MemberID') REFERENCES 'member' ('ID')
  </code></pre>
  
  <p>I create foreign key constrain witch is <strong>one-to-many</strong> relation(Above). In this case member ID must required for transaction, but member is optional.</p>
  
  <p><strong>How to control this optional situation?</strong></p>
  
  <p><strong>Memebr:</strong></p>
  
  <pre><code>CREATE TABLE `member` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `FirstName` varchar(30) DEFAULT NULL,
  `LastName` varchar(30) DEFAULT NULL,
  `PermanentAddress` varchar(100) DEFAULT NULL,
  `TemporaryAddress` varchar(100) DEFAULT NULL,
  `Zip` varchar(30) DEFAULT NULL,
  `City` varchar(30) DEFAULT NULL,
  `LastVisit` datetime DEFAULT NULL,
  `TotalVisit` datetime DEFAULT NULL,
  `Active` tinyint(1) DEFAULT NULL,
   PRIMARY KEY (`ID`)
   ) ENGINE=InnoDB DEFAULT CHARSET=latin1
  </code></pre>
  
  <p><strong>Transaction</strong></p>
  
  <pre><code>CREATE TABLE `transaction` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `MemberID` int(11) DEFAULT '0',
  `UserID` int(11) DEFAULT NULL,
  `Total` float DEFAULT NULL,
  PRIMARY KEY (`ID`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1
  </code></pre>