title: MySQL String Comparison with Percent Output
body: <p>I am trying to compare two entries of 6 numbers, each number which can either can be zero or 1 (i.e 100001 or 011101). If 3 out of 6 match, I want the output to be .5. If 2 out of 6 match, i want the output to be .33 etc.</p>
  
  <p>Here are the SQL commands to create the table</p>
  
  <pre><code>CREATE TABLE sim
  (sim_key int,
   string int);
  
  INSERT INTO sim (sim_key, string)
  VALUES (1, 111000);
  
  INSERT INTO sim (sim_key, string)
  VALUES (2, 111111);
  </code></pre>
  
  <p>My desired output to compare the two strings, which share 50% of the characters, and output 50%. </p>
  
  <p>Is it possible to do this sort of comparison in SQL? Thanks in advance </p>