'how to make the first column of id always equal to the value of the row? even after adding and deleting rows
how to edit an sql table using sqlite3 to create a column with values corresponding to the row number. I have a list
['7' '19' '11' '11' 'Комплекс 1300 RUB' '17:00' '15 апреля']
['8' '191' 'nn' '11' 'Комплекс 1300 RUB' '17:00' '15 апреля']
['10' '19' 'ss' '11' 'Стрижка 1100 RUB' '17:00' '15 апреля']
['11' '19' 'ss' '1' 'Стрижка 1100 RUB' '17:00' '15 апреля']
['12' '191' 'mm' '11' 'Комплекс 1300 RUB' '17:00' '15 апреля']
['13' '19' 'ss' '11' 'Стрижка 1100 RUB' '17:00' '15 апреля']
['14' '19 'ss' '1' 'Стрижка 1100 RUB' '17:00' '15 апреля']
The first column name is 'id' I want the id column to always match the row number, even after deleting or adding a new row to the table
this sql command doesn't work for some reason
cursor.execute("UPDATE mytable SET id = rowid")
how to make the first column of id always equal to the value of the row? even after adding and deleting rows
I want it to look like this
['1' '19' '11' '11' 'Комплекс 1300 RUB' '17:00' '15 апреля']
['2' '191' 'nn' '11' 'Комплекс 1300 RUB' '17:00' '15 апреля']
['3' '19' 'ss' '11' 'Стрижка 1100 RUB' '17:00' '15 апреля']
['4' '19' 'ss' '1' 'Стрижка 1100 RUB' '17:00' '15 апреля']
['5' '191' 'mm' '11' 'Комплекс 1300 RUB' '17:00' '15 апреля']
['6' '19' 'ss' '11' 'Стрижка 1100 RUB' '17:00' '15 апреля']
['7' '19 'ss' '1' 'Стрижка 1100 RUB' '17:00' '15 апреля']
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
