title: Delete from a SQL Table based on another table
body: <p>I have 2 SQL tables: <strong>TableA</strong> and <strong>TableB</strong>. Both these tables have the same exact columns and types. TableA contains more data. TableB contains the data that I want to delete in TableA. Before actually deleting data, I want to select the data from TableA first to verify that the count matches TableB. How would I do a SELECT statement for this type of query? One thing that makes this a little trickier is that the tables do not contain a primary key. A lot of questions I saw related to this one involved using some sort of id in the query. That's not an option in my case. Once I know this, I should be able to form my deletion query. The columns are name, age, and gender. Again, none of these columns are a primary key.</p>
  <p>When I run</p>
  <pre><code>SELECT COUNT(*) FROM TableA
  </code></pre>
  <p>I get a count of <strong>100,000</strong></p>
  <p>When I run</p>
  <pre><code>SELECT COUNT(*) FROM TableB
  </code></pre>
  <p>I get a count of <strong>10,000</strong></p>
  <p>I know this query is wrong, but when I run</p>
  <pre><code>SELECT COUNT(*) FROM TableA WHERE EXISTS (SELECT * FROM TableB)
  </code></pre>
  <p>I get a count of <strong>100,000</strong>. How can I select the data from TableA, so that it matches the data in TableB?</p>