[Tutor] SQLite3 DB Field Alphabetizing

Alan Gauld alan.gauld at btinternet.com
Tue Oct 12 16:23:50 CEST 2010

"David Hutto" <smokefloat at gmail.com> wrote

> > Did you include an ORDER BY?
> See three posts above, line 6.

Looks like our posts crossed in transit :-)

So you order by graphname, and you only have a single field of that 
But then when you put it into the list you only use part of graphname 
to a string and stripped:


So what did the field look like before you modified it? Since that is 
determines the way that ORDER BY ordered it? And what is
graphname[0] before you convert it to a string? (It looks like it
is already a string?!)

Its unusual to have to extract sub fields from a SQL result since to
maximise the power of SQL its better to store all "subfields" in
separate fields of the table.

One of the complexities of debugging any database program is that
almost as much depends on the data structures and content as it
does on the code. Without seeing the data that is beintg operated
upon its hard to be precise.

What happens if you execute the SQL at the sqlite interactive
prompt? Does it give the same result?

PS. You don't need the commit() for a SELECT statement, you aren't
changing anything.

Alan G.

More information about the Tutor mailing list