I have a database with 1000 records.
I am trying to create an SQL statement so if the number of records grows above 1000, then the oldest records are deleted (i.e. the new records above 1000 ‘replace’ the oldest records).
I am using SQLite, but I assume the usual SQL syntax will fit here.
I have a database with 1000 records. I am trying to create an SQL
Share
If you use an auto-increment field, you can easily write this to delete the oldest 100 records:
Or, if no such field is present, use
ROWID:Or, to leave only the latest 1000 records: