SQLite create pre-populated FTS table

好久不见. 提交于 2019-11-28 19:19:49

问题


Is there a way to create an FTS table in SQLite that is pre-populated with data from a SELECT query?

I know it’s possible to create a regular table that is prepopulated with data from a SELECT: CREATE TABLE foo AS SELECT ref_id, name FROM other_table

And we can create an FTS table like so: CREATE VIRTUAL TABLE bar USING FTS3(ref_id, name)

The point of doing this is to update my app’s SQLite database schema while avoiding reading in all of the data from other_table. I’m really hoping there’s some way to let SQLite do all the heavy lifting here (which is what it's really good at!).


回答1:


I'm not sure if you can do it in one statement, but you can do it in two... after your CREATE VIRTUAL TABLE statement, you can do: INSERT INTO bar SELECT * FROM other_table



来源:https://stackoverflow.com/questions/7477377/sqlite-create-pre-populated-fts-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!