title: Python SQLite Insert operation
body: <p>this is the code from <a href="http://www.tutorialspoint.com/sqlite/sqlite_python.htm" rel="nofollow">Tutorialspoint.com</a> that i am looking at.</p>
  
  <pre><code>#!/usr/bin/python
  
  import sqlite3
  
  conn = sqlite3.connect('test.db')
  
  conn.execute('''CREATE TABLE COMPANY
     (ID INT PRIMARY KEY     NOT NULL,
     NAME           TEXT    NOT NULL,
     AGE            INT     NOT NULL,
     ADDRESS        CHAR(50),
     SALARY         REAL);''')
  
  conn.execute("INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) \
        VALUES (1, 'Paul', 32, 'California', 20000.00 )");   
  
  conn.commit()
  conn.close()
  </code></pre>
  
  <p>how do i add an integer variable to one of the values, let say AGE.For example, i tried this but i got a value error:</p>
  
  <pre><code>p=32
  conn.execute("INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) \
               VALUES(1,'Paul',?,'California',20000.00)",p)
  </code></pre>
  
  <p>Do i have to store all the variable in the list then add to the database like this?</p>
  
  <pre><code>list = [(1,'Paul',32,'California',20000.00)]
  for item in list:
      conn.execute("INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) \
                   VALUES(?,?,?,?,?)",item)
  </code></pre>