[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/GHubPythonProjects/py4e/master/code2/db2.py [Back]  [Original]

import sqlite3

conn = sqlite3.connect('music.sqlite')
cur = conn.cursor()

cur.execute('INSERT INTO Tracks (title, plays) VALUES ( ?, ? )', 
    ( 'Thunderstruck', 20 ) )
cur.execute('INSERT INTO Tracks (title, plays) VALUES ( ?, ? )', 
    ( 'My Way', 15 ) )
conn.commit()

print 'Tracks:'
cur.execute('SELECT title, plays FROM Tracks')
for row in cur :
     print row

cur.execute('DELETE FROM Tracks WHERE plays < 100')

cur.close()


Web Proxy Viewer  |  New URL  |  Original Page