Guest User

Untitled

a guest
Jan 25th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. import psycopg2
  2. conn = psycopg2.connect(user='postgres', host='localhost', password='123456')
  3. conn.autocommit = True
  4. cur = conn.cursor()
  5. cur.execute('CREATE DATABASE example;')
  6. cur.execute("""CREATE TABLE HARMKA
  7. (ID INT PRIMARY KEY NOT NULL,
  8. PHARMACY_LICENSE CHAR(100),
  9. STREET CHAR(150),
  10. CITY CHAR(30));""")
  11. cur.execute("INSERT INTO HARMKA VALUES(%s, %s, %s, %s)", (1, '12345', 'street', 'Denwer'))
  12. cur.close()
  13. conn.close()
Add Comment
Please, Sign In to add comment