Please read the following table in HTML format from a webpage and then answer the question in detail according to the table. Each table cell is defined by a <td> and a </td> tag. Each table row starts with a <tr> and ends with a </tr> tag. 'rowspan=m' and 'colspan=n' represents a cell spaning over 'm' rows and 'n' columns.

Webpage title:
Ralph Northam
Table title:
Electoral history
Table:
<table id='hittask' contenteditable='False'>
<tr> <th colspan=2 rowspan=1 > Party </th><th colspan=1 rowspan=1 > Candidate </th><th colspan=1 rowspan=1 > Votes </th><th colspan=1 rowspan=1 > % </th><th colspan=1 rowspan=1 > ± </th></tr>
<tr> <td colspan=1 rowspan=1 >  </td><td colspan=1 rowspan=1 > Democratic </td><td colspan=1 rowspan=1 > Ralph Northam </td><td class="highlighted"  colspan=1 rowspan=1 > 17,307 </td><td colspan=1 rowspan=1 > 54.3% </td><td colspan=1 rowspan=1 > +16.1 </td></tr>
<tr> <td colspan=1 rowspan=1 >  </td><td class="highlighted"  colspan=1 rowspan=1 > Republican </td><td class="highlighted"  colspan=1 rowspan=1 > Nick Rerras </td><td class="highlighted"  colspan=1 rowspan=1 > 14,499 </td><td colspan=1 rowspan=1 > 45.5% </td><td colspan=1 rowspan=1 > 16.2 </td></tr>
<tr> <td colspan=1 rowspan=1 >  </td><td colspan=1 rowspan=1 > Write-ins </td><td colspan=1 rowspan=1 >  </td><td colspan=1 rowspan=1 > 45 </td><td colspan=1 rowspan=1 > 0.1% </td><td colspan=1 rowspan=1 > +0.1 </td></tr>
<tr> <th colspan=3 rowspan=1 > Majority </th><td colspan=1 rowspan=1 > 2,808 </td><td colspan=1 rowspan=1 > 8.8% </td><td colspan=1 rowspan=1 > 14.7 </td></tr>
<tr> <th colspan=3 rowspan=1 > Total votes </th><td colspan=1 rowspan=1 > 31,851 </td><td colspan=1 rowspan=1 > 100.0% </td><td colspan=1 rowspan=1 >  </td></tr>
</table>
Question:
Who did Ralph Northam beat and by how many votes did each of the candidates receive? 
Answer:
Ralph Northam defeated Nick Rerras, a Republican, by 17,307 votes to 14,499.