I have a simple database tables of 2 columns, the first being a lightbulb id
, and the 2nd being an integer status
(0/1) denoting whether the light is on or not. By default all of my light switches are assumed to be off. The number of lightbulbs is fixed, I only need to change the id with each row.
Here is my table:
cursor.execute(
'''
CREATE TABLE IF NOT EXISTS info(
id integer,
status integer
)
'''
)
What is a better way to initialize the table than to manually list each row as follows? (I know the number of lights is fixed to 10).
c.execute('INSERT INTO info VALUES(1,0)')
c.execute('INSERT INTO info VALUES(2,0)')
c.execute('INSERT INTO info VALUES(3,0)')
....
....
c.execute('INSERT INTO info VALUES(10,0)')