如何在SQLite中将行号列添加到视图中?

如何在SQLite中将行号列添加到视图中?,sqlite,views,rowid,Sqlite,Views,Rowid,在SQLite中,我可以使用 select rowid,* from tab; 比如说- sqlite> create table tab(content); sqlite> insert into tab values('first row'); sqlite> insert into tab values('second row'); sqlite> insert into tab values('third row'); sqlite> select * f

在SQLite中,我可以使用

select rowid,* from tab;
比如说-

sqlite> create table tab(content);
sqlite> insert into tab values('first row');
sqlite> insert into tab values('second row');
sqlite> insert into tab values('third row');
sqlite> select * from tab;
content
first row
second row
third row
sqlite> select rowid,* from tab;
rowid|content
1|first row
2|second row
3|third row
但是,此技术不适用于视图-

sqlite> create view v(content) as select 'first row' union select 'second row' union select 'third row';
sqlite> select * from v;
content
first row
second row
third row
sqlite> select rowid,* from v;
rowid|content
|first row
|second row
|third row
在上面的玩具示例中,我可以在创建视图v时添加一个行号列,但在实际使用中,我的视图通常是更复杂的表联接或递归CTE。如何将行号列添加到任意视图中