Difference between $this->db->replace() $this->db->update()
<p>I don't get the difference between query builder's Replace and Update. Especially the documentation for Replace...</p>

<blockquote>
  <p>This method executes a REPLACE statement, which is basically the SQL standard for (optional) DELETE + INSERT, <strong>using PRIMARY and UNIQUE keys as the determining factor.</strong></p>
</blockquote>

<p>...but I see no indication of using a PK in the example. Am I missing some fundamental knowledge here? (I understand Update just fine).</p>

<p>Replace</p>

<pre><code>$data = array(
    'title' =&gt; 'My title',
    'name'  =&gt; 'My Name',
    'date'  =&gt; 'My date'
);

$this-&gt;db-&gt;replace('table', $data);
</code></pre>

<p>Update</p>

<pre><code>$data = array(
    'title' =&gt; $title,
    'name' =&gt; $name,
    'date' =&gt; $date
);

$this-&gt;db-&gt;where('id', $id);
$this-&gt;db-&gt;update('mytable', $data);
</code></pre>

<p>Thanks.</p>