S
S
Samad_Samadovic2021-10-04 02:15:48
Python
Samad_Samadovic, 2021-10-04 02:15:48

How to write information to sql using the WHERE method?

cur.execute(f"""INSERT INTO HGF (id_, Алгебра_1) VAlUES(?, ?) WHERE id_ = 0""", (1, A),)

Error:
sqlite3.OperationalError: near "WHERE": syntax error

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vindicar, 2021-10-04
@Vindicar

INSERT does not require WHERE, as it creates a new record in the table.
If you need to update an existing entry, use UPDATE.

G
GoAi, 2021-10-04
@GoAi

Try like this

cur.execute(f"""INSERT INTO HGF (id_, Алгебра_1) VAlUES(?, ?) WHERE id_ = "0"""", (1, A),)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question