I have a table (server_ preference) which has these headers: guild_id - int mod_channel_role_id - int report_channel_id - int i want to check if guild_id exist in the guild id column if it does not i want to insert to the table new staff i have tried many things and haven’t found any thing that worked this was my last attempt
conn = sqlite3.connect("server_preference.db")
c = conn.cursor()
for guild in client.guilds:
c.execute("""IF NOT EXISTS ( SELECT guild_id FROM server_preference WHERE guild_id = ?)
BEGIN
INSERT INTO server_preference (guild_id) VALUES (:guild_id)
END""", guild.id)
conn.commit()
conn.close()
and I got this error:
sqlite3.OperationalError: near "IF": syntax error