Rokko
Rokko

Reputation: 57

How to assign ID using VIRTUAL TABLE?

I found out, that in virtual table Integer Primary Key doesn't work the same way like in normal table. SQLite VIRTUAL TABLE ID assigns "null" value for each row... My question is, how to assign ID for each column using VIRTUAL TABLE (USING fts3)?

Upvotes: 0

Views: 334

Answers (1)

Mateusz Herych
Mateusz Herych

Reputation: 1605

It's already there and it's named rowid.

Here's an example:

sqlite> create virtual table search using fts3(text);
sqlite> insert into search values ('london new york');
sqlite> insert into search values ('san francisco');
sqlite> select rowid,* from search;
1|london new york
2|san francisco

Same applies for non virtual tables.

Upvotes: 1

Related Questions