Search
 
SCRIPT & CODE EXAMPLE
 

SQL

how to insert string variable into sqlite database

def create_db():
    with con:
        cur = con.cursor()
        cur.execute("DROP TABLE IF EXISTS Contacts")
        cur.execute("CREATE TABLE Contacts (First Name TEXT, Last Name TEXT, Phone TEXT, Email TEXT);")
        cur.execute("INSERT INTO Contacts VALUES (?, ?, ?, ?);", (firstname, lastname, phone, email))

        ## call commit on the connection...
        con.commit()
Comment

PREVIOUS NEXT
Code Example
Sql :: sql join exists 
Sql :: mysql extract month 
Sql :: oracle view source 
Sql :: remove password from root mysql 
Sql :: postgres get database encoding 
Sql :: connect mysql docker 
Sql :: sql update query 
Sql :: how to describe a table in sqlite3 
Sql :: mysql copy table1 to table2 
Sql :: add column to table sql 
Sql :: select sql in descending order 
Sql :: date_add mysql 
Sql :: show all users in mysql 
Sql :: oracle update with sequence 
Sql :: reset auto increment in mysql 
Sql :: sql replace null with 0 
Sql :: login to database mysql terminal 
Sql :: mysql one week ago 
Sql :: mysql sysdate - 1 day 
Sql :: select count of distinct values sql 
Sql :: postgresql restore from dump 
Sql :: is there any command to change postgres password 
Sql :: Object of class mysqli_result could not be converted to string 
Sql :: mysql load data infile csv 
Sql :: date in where on datetime column clause mysql 
Sql :: sql create table if not exists 
Sql :: sql delete join 
Sql :: clear a table in mysql 
Sql :: mysql how to change default charset 
Sql :: postgres set default schema 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =