On 30 Sep 2009, at 10:48pm, Petite Abeille wrote: > On Sep 30, 2009, at 11:41 PM, Simon Slavin wrote: > >> It would be technically possible to write some clever SQL to do it >> all >> in one operation. > > Why the "clever" characterization?
It's more SQL than most people bother to learn. What I was trying to get across was that my answer was not "This is basic SQL, dummy, learn it now." but more along the lines of "This solution is available, but it's more than most people would bother to do.". I did bother to tell him it was possible -- I thought it was worth mentioning in case he wanted to pursue it. I could have just not mentioned it. >> But it would be complicated to debug and ... well, >> do you really want to waste the time getting it right ? > > Hmmm... but then... why bother with a SQL engine in the first place? He appears to want a persistent database which can do complicated searches at a reasonable speed, and SQL is a good way to do that. >> And also make >> it difficult for anyone (including you) who has to modify your code >> later ? > > Hmmm... why? What's more complicated about SQL than, say, Python? He defined the problem in a procedural manner: do /this/, then do / that/. Which means he thinks about it in a procedural manner. Which means that his natural programming style would be to use a procedural system to write it in. Which means he'll find that easiest. Yes, he can drop everything and spend a day learning some complicated SQL, but isn't he best off using tools he is already familiar with ? Had he said that his system was running too slowly, or that speed was important I might have written something else. But premature optimisation is a huge time-waster when you just need to get your program written and easy to debug. Many people on this list are SQL experts. To them, a one line Python program that runs a 200 word SQL command with all sorts of rare clauses is natural. That's fine for them, but I was trying to provide a good solution, not to encourage the OP to use as many SQLite features as possible. I saw your own fine answers to the problem. One of the best things about lists like this is that a question gets many answers and the OP can pick the one that appeals most. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users