0

In a "base" table of SQLite, there is a reference column:

refX

Another "content" table contains this same column, but many of its records are not listed in the base table.

How do I delete the records in the "content" table that are NOT in the "base" table?

Confused
  • 6,048
  • 6
  • 34
  • 75

1 Answers1

2
DELETE FROM Content WHERE refX NOT IN (SELECT refX FROM Base);
Confused
  • 6,048
  • 6
  • 34
  • 75
CL.
  • 173,858
  • 17
  • 217
  • 259
  • Having deleted tens of thousands of records, the database is still the same size on the disk. Is this normal? – Confused Mar 02 '18 at 18:00
  • 1
    See [change sqlite file size after “DELETE FROM table”](https://stackoverflow.com/q/2143800/11654). – CL. Mar 02 '18 at 18:02
  • "Attached databases can be vacuumed by appending the appropriate schema-name to the VACUUM statement." – CL. Mar 02 '18 at 18:09
  • Sorry, I'm so new to this I have NO IDEA what a schema-name actually is, what it's talking about... nothing. No clues. – Confused Mar 02 '18 at 18:11