I am new to SQL. I want to check that a table exist in data base or not. If it does not exist than create it. Also I want to check that a record exist in table or not. If exists than update it with new data, If does not exist than insert a new record in table. Here is the code. I don't know how to check for a existing table,record.
import sqlite3 as lite con = lite.connect('test.db') cur = con.cursor() con.execute('''CREATE TABLE EMPLOYEE (ITEMA TEXT PRIMARY KEY NOT NULL, ITEMB CHAR(50) NOT NULL, ITEMC CHAR(50), ITEM0 TEXT ITEM1 TEXT ITEM2 TEXT ITEM3 TEXT ITEM4 TEXT);''') con.execute("INSERT INTO EMPLOYEE (ID,NAME,ADDRESS,MOBILE_NUMBER,TRANSPORT_FOR_LUNCH,ONLY_DROP,KIDS,ADULTS) \ VALUES (%s,%s',%s,%s,%s,%s,%s,%s)" %(ia,ib,ic,i0,i1,i2,i3,i4));