title: sqlite3.OperationalError: near "WHERE" using NOT IN clause
body: <p>I'm creating a port scanner using python. When it finds an ip address I want it added to my &quot;Devices&quot; table.  However I need to check to make sure this same IP is not already in my tables from an earlier scan.  So I'm trying to run the following SQL in Python:</p>
  <p><em><strong>cursorObj.execute(&quot;INSERT INTO Devices VALUES('&quot;+ipAddrFound+&quot;', null, null, null, null) WHERE '&quot;+ipAddrFound+&quot;' NOT IN (Select ipAddr from Devices)&quot;)</strong></em></p>
  <p>However, when I run this I get the following error:
  <strong>sqlite3.OperationalError: near &quot;WHERE&quot;: syntax error</strong></p>
  <p>I'm not understanding what the problem is. Any advice?</p>
  <p>Thanks in advance.</p>