SQLite: LIKE clause won't work with DELETE
Question:
I was trying to delete rows in a table using the like clause, the query doesn’t produce an error but the query doesn’t delete the rows.
cur.execute("DELETE FROM urls WHERE url LIKE 'https%';")
Meanwhile the query to select the same works.
cur.execute("SELECT url FROM urls WHERE url LIKE 'https%';")
Answers:
You need to commit DML queries with con.commit()
.
PS: You need to label Python code with Python
tag.
I was trying to delete rows in a table using the like clause, the query doesn’t produce an error but the query doesn’t delete the rows.
cur.execute("DELETE FROM urls WHERE url LIKE 'https%';")
Meanwhile the query to select the same works.
cur.execute("SELECT url FROM urls WHERE url LIKE 'https%';")
You need to commit DML queries with con.commit()
.
PS: You need to label Python code with Python
tag.