Click here to Skip to main content
15,881,852 members
Home / Discussions / Database
   

Database

 
AnswerRe: MongoDB Transactions Pin
k505414-Feb-19 6:09
mvek505414-Feb-19 6:09 
QuestionC# MongoDB Question Pin
Kevin Marois10-Feb-19 7:58
professionalKevin Marois10-Feb-19 7:58 
AnswerRe: C# MongoDB Question Pin
k505412-Feb-19 6:07
mvek505412-Feb-19 6:07 
AnswerRe: C# MongoDB Question Pin
jschell23-Feb-19 11:11
jschell23-Feb-19 11:11 
QuestionSQLite how to delete rows in a table (C++) Pin
steve_94966138-Feb-19 5:08
professionalsteve_94966138-Feb-19 5:08 
AnswerRe: SQLite how to delete rows in a table (C++) Pin
k50548-Feb-19 7:21
mvek50548-Feb-19 7:21 
GeneralRe: SQLite how to delete rows in a table (C++) Pin
steve_949661310-Feb-19 21:30
professionalsteve_949661310-Feb-19 21:30 
GeneralRe: SQLite how to delete rows in a table (C++) Pin
k505413-Feb-19 7:14
mvek505413-Feb-19 7:14 
You should probably use a DATETIME field type for DataOra, but if you know that all your timestamps are 'YYYY/MM/DD hh:mm:ss', then then comparing as strings should work out OK.

How you truncate your data is somewhat dependent on exactly what your need is. If you just want to delete approximately 5000 records, you could do
SELECT count(*) FROM EVENT where DataOra < 'YYYY/MM/DD 00:00:00'
and adjust the date and or time up/down until you get about 5000 and then use that date as your comparison. Or maybe you would be happy with just deleting records before Feb 01/2019 in which case you could just use '2019/02/01 00:00:00' as your comparison

Alternatively, if you want to delete exactly 5000 records, ordering by timestamps, then this might work for you:
SQL
CREATE TEMP TABLE TMP(id INTEGER PRIMARY KEY AUTOINCREMENT, DataOra text);
INSERT INTO TMP(DataOra) SELECT DataOra from EVENT  order by DataOra;
DELETE FROM EVENT where DataOra <= (SELECT DataOra from TMP where id = 5000);

hope this helps. Don't forget to back up your data before you begin - just in case!
GeneralRe: SQLite how to delete rows in a table (C++) Pin
steve_949661320-Feb-19 20:55
professionalsteve_949661320-Feb-19 20:55 
GeneralRe: SQLite how to delete rows in a table (C++) Pin
k505421-Feb-19 7:15
mvek505421-Feb-19 7:15 
GeneralRe: SQLite how to delete rows in a table (C++) Pin
steve_949661325-Feb-19 4:25
professionalsteve_949661325-Feb-19 4:25 
AnswerRe: SQLite how to delete rows in a table (C++) Pin
Mycroft Holmes8-Feb-19 12:50
professionalMycroft Holmes8-Feb-19 12:50 
GeneralRe: SQLite how to delete rows in a table (C++) Pin
steve_949661310-Feb-19 21:56
professionalsteve_949661310-Feb-19 21:56 
GeneralRe: SQLite how to delete rows in a table (C++) Pin
Mycroft Holmes11-Feb-19 10:53
professionalMycroft Holmes11-Feb-19 10:53 
AnswerRe: SQLite how to delete rows in a table (C++) Pin
Richard MacCutchan8-Feb-19 22:44
mveRichard MacCutchan8-Feb-19 22:44 
GeneralRe: SQLite how to delete rows in a table (C++) Pin
steve_949661310-Feb-19 21:58
professionalsteve_949661310-Feb-19 21:58 
Questionfinding periods Pin
joost.versteegen8-Feb-19 4:22
joost.versteegen8-Feb-19 4:22 
AnswerRe: finding periods Pin
joost.versteegen9-Feb-19 10:40
joost.versteegen9-Feb-19 10:40 
Questionupdate temp table with results from sub query (actually it is a function) Pin
joost.versteegen7-Feb-19 3:32
joost.versteegen7-Feb-19 3:32 
AnswerRe: update temp table with results from sub query (actually it is a function) Pin
ZurdoDev7-Feb-19 4:36
professionalZurdoDev7-Feb-19 4:36 
GeneralRe: update temp table with results from sub query (actually it is a function) Pin
joost.versteegen7-Feb-19 4:45
joost.versteegen7-Feb-19 4:45 
AnswerRe: update temp table with results from sub query (actually it is a function) Pin
Richard Deeming7-Feb-19 8:34
mveRichard Deeming7-Feb-19 8:34 
GeneralRe: update temp table with results from sub query (actually it is a function) Pin
joost.versteegen7-Feb-19 11:20
joost.versteegen7-Feb-19 11:20 
GeneralRe: update temp table with results from sub query (actually it is a function) Pin
joost.versteegen7-Feb-19 20:33
joost.versteegen7-Feb-19 20:33 
QuestionTables left and right Pin
Member 141362635-Feb-19 5:21
Member 141362635-Feb-19 5:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.