SQLite Full-Text Search (FTS5) Cheatsheet/Use an external content table pattern

Separate storage from the FTS index when needed.

Section: Create FTS5 tables

Use an external content table pattern

sql
sql
CREATE TABLE articles (
  id INTEGER PRIMARY KEY,
  title TEXT,
  body TEXT
);
CREATE VIRTUAL TABLE articles_fts USING fts5(
  title,
  body,
  content='articles',
  content_rowid='id'
);
Explanation

Common when the app needs a normal table plus a search index over the same content.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Create FTS5 tables
Create an FTS5 virtual table
Store searchable text in an FTS5 index.
OpenIn sheetsqlsame section
Insert searchable content
Add rows to an FTS5 table.
OpenIn sheetsqlsame section
Search with MATCH
Find rows containing a term.
OpenIn sheetsql2 tag match
Run a phrase search
Search for words appearing together in order.
OpenIn sheetsql1 tag match
Run a prefix search
Match terms by prefix.
OpenIn sheetsql1 tag match
Rank results with bm25()
Sort by relevance score.
OpenIn sheetsql1 tag match