Dave123 Dave123 - 10 months ago 41
Python Question

How to delete record from table where field is equal to header?

I have a sqlite table which contains duplicate headers which I would like to remove. This is my current statement.


This statement, when executed, deletes the entire table.

Answer Source

Don't use double quotes for strings!

delete from table where field = 'field';

The SQL standard for string delimiters is single quotes. Sometimes double quotes are used, but they are also used as escape characters for column names. So your code was just where field = field and that deletes all non-NULL values.