![]() ![]() Create a cursor object by invoking the cursor() object on the (above created) Connection object. The cursor() method returns a cursor object using which you can communicate with SQLite3. To add records to an existing table in SQLite database −Ĭreate a connection object using the connect() method by passing the name of the database as a parameter to it. ![]() If you retrieve the contents of the table using SELECT command, you can see the updated values as − Sqlite> UPDATE CRICKETERS SET AGE = AGE+1 Following UPDATE statement increases the age of all the records in the CRICKETERS table by 1 − If you haven’t used the WHERE clause values of all the records will be updated. Sqlite> SELECT * FROM CRICKETERS WHERE FIRST_NAME = 'Shikhar' įirst_Name Last_Name Age Place_Of_B Country If you retrieve the record whose FIRST_NAME is Shikhar you observe that the age value has been changed to 45 − Sqlite> UPDATE CRICKETERS SET AGE = 45 WHERE FIRST_NAME = 'Shikhar' Sqlite> insert into CRICKETERS values('Rohit', 'Sharma', 32, 'Nagpur', 'India') įollowing Statement modifies the age of the cricketer, whose first name is Shikhar − Sqlite> insert into CRICKETERS values('Virat', 'Kohli', 30, 'Delhi', 'India') Sqlite> insert into CRICKETERS values('Kumara', 'Sangakkara', 41, 'Matale', 'Srilanka') Sqlite> insert into CRICKETERS values('Jonathan', 'Trott', 38, 'CapeTown', 'SouthAfrica') Sqlite> insert into CRICKETERS values('Shikhar', 'Dhawan', 33, 'Delhi', 'India') SET column1 = value1, column2 = value2., columnN = valueNĪssume we have created a table with name CRICKETERS using the following query −Īnd if we have inserted 5 records in to it using INSERT statements as − Syntaxįollowing is the syntax of the UPDATE statement in SQLite − To update specific rows, you need to use the WHERE clause along with it. You can update the values of existing records in SQLite using the UPDATE statement. UPDATE Operation on any database implies modifying the values of one or more records of a table, which are already available in the database. Python SQLite - Establishing Connection.Python PostgreSQL - Database Connection. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |