Created
January 8, 2014 07:05
-
-
Save stefanmonkey/8312916 to your computer and use it in GitHub Desktop.
table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import MySQLdb as mdb | |
con = mdb.connect('localhost', 'testuser', '123456', 'testdb'); | |
with con: | |
cur = con.cursor() | |
cur.execute("DROP TABLE IF EXISTS Writers") | |
cur.execute("CREATE TABLE Writers(Id INT PRIMARY KEY AUTO_INCREMENT, \ | |
Name VARCHAR(25))") | |
cur.execute("INSERT INTO Writers(Name) VALUES('Jack London')") | |
cur.execute("INSERT INTO Writers(Name) VALUES('Honore de Balzac')") | |
cur.execute("INSERT INTO Writers(Name) VALUES('Lion Feuchtwanger')") | |
cur.execute("INSERT INTO Writers(Name) VALUES('Emile Zola')") | |
cur.execute("INSERT INTO Writers(Name) VALUES('Truman Capote')") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment