![]() In this case, the person_id column is actually the rowid column. This time, however, we add another column named person_id whose data type is INTEGER and column constraint is PRIMARY KEY: DROP TABLE people The following statement drops table people and recreates it. ![]() When you create a table that has an INTEGER PRIMARY KEY column, this column is the alias of the rowid column. Note that you can also refer to the rowid column using its aliases: _rowid_ and oid. People Code language: SQL (Structured Query Language) ( sql )Īs you can see clearly from the output, SQLite implicitly creates a column named rowid and automatically assigns an integer value whenever you insert a new row into the table. Third, query data from the people table using the following SELECT statement: SELECT rowid, VALUES( 'John', 'Doe') Code language: SQL (Structured Query Language) ( sql ) ![]() Second, insert a row into the people table using the following INSERT statement: INSERT INTO people (first_name, last_name) ) Code language: SQL (Structured Query Language) ( sql ) The rowid column store 64-bit signed integer that uniquely identifies a row in the table.įirst, create a new table named people that has two columns: first_name, and last_name: CREATE TABLE people ( Whenever you create a table without specifying the WITHOUT ROWID option, you get an implicit auto-increment column called rowid. Summary: in this tutorial, you will learn about SQLite AUTOINCREMENT column attribute and when to use it in your table.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |