cheese1756
cheese1756

Reputation: 1939

Is column 0 in a SQLite database taken up by the ROWID?

Currently, I have a database where I am using random longs as my IDs, so I don't need an INTEGER PRIMARY KEY. Can I use my own IDs in column 0, or is column 0 automatically taken up by the implicit ROWID regardless?

Upvotes: 0

Views: 97

Answers (2)

CL.
CL.

Reputation: 180080

All tables have a rowid. It is not a normal column but used as the key of the table's B-tree structure.

If you declare a column as INTEGER PRIMARY KEY, that column is used as the rowid and is not actually stored in the table's data section.

If your primary key is an integer, you should declare it as INTEGER PRIMARY KEY to make storage and lookups more efficient.

Upvotes: 1

Oli
Oli

Reputation: 3536

You can use you own ID's. ROW ID can be used separately (SQLITE)

Upvotes: 1

Related Questions