Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import psycopg2
- conn = psycopg2.connect(user='postgres', host='localhost', password='123456')
- conn.autocommit = True
- cur = conn.cursor()
- cur.execute('CREATE DATABASE example;')
- cur.execute("""CREATE TABLE HARMKA
- (ID INT PRIMARY KEY NOT NULL,
- PHARMACY_LICENSE CHAR(100),
- STREET CHAR(150),
- CITY CHAR(30));""")
- cur.execute("INSERT INTO HARMKA VALUES(%s, %s, %s, %s)", (1, '12345', 'street', 'Denwer'))
- cur.close()
- conn.close()
Add Comment
Please, Sign In to add comment