Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import sqlite3
- conn = sqlite3.connect("restaurante.db")
- cursor = conn.cursor()
- query = 'CREATE TABLE categorias(\
- id INTEGER PRIMARY KEY AUTOINCREMENT,\
- nombre TEXT UNIQUE NOT NULL\
- )'
- cursor.execute(query)
- query = 'CREATE TABLE platos(\
- id INTEGER PRIMARY KEY AUTOINCREMENT,\
- nombre TEXT UNIQUE NOT NULL,\
- id_categoria INTEGER NOT NULL,\
- FOREIGN KEY(id_categoria) REFERENCES categorias(id)\
- )'
- cursor.execute(query)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement