-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBBDD.py
More file actions
27 lines (17 loc) · 659 Bytes
/
BBDD.py
File metadata and controls
27 lines (17 loc) · 659 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import sqlite3
miConexion = sqlite3.connect("BaseDatos")
miCursor = miConexion.cursor()
#miCursor.execute("CREATE TABLE PRODUCTOS (NOMBRE_ARTICULOS VARCHAR(50), PRECIO INTEGER, SECCION VARCHAR(20))")
#miCursor.execute("INSERT INTO PRODUCTOS VALUES('BALON',15,'DEPORTES')")
"""variosProductos = [
("Camiseta",10,"Deportes"),
("Jarron",90,"Ceramica"),
("Camion",20,"Jugueteria")
]
miCursor.executemany("INSERT INTO PRODUCTOS VALUES (?,?,?)", variosProductos)"""
miCursor.execute("SELECT * FROM PRODUCTOS")
variosProductos = miCursor.fetchall()
for producto in variosProductos:
print(producto[0])
miConexion.commit()
miConexion.close()