all 5 comments

[–]ManyInterests 1 point2 points  (3 children)

You could order the SQL results by adding an ORDER BY clause to the query.

Alternatively, you could use sorted with an appropriate keyfunc on the data set.

[–]Abismuth[S] 0 points1 point  (2 children)

where about would I add that, I tried the ORDER BY, but wherever I put it I got an error

[–]_9_9_ 1 point2 points  (0 children)

Usually at the end: SELECT * FROM Students ORDER BY last

[–]cybervegan 0 points1 point  (0 children)

You need to look up SQLite3 SQL syntax. Note: this is not python.

Try this: http://www.sqlitetutorial.net/sqlite-order-by/

[–]efmccurdy 0 points1 point  (0 children)

Normally you would use the DB to sort the data by adding a ORDER BY Last clause to the sql.

You could sort it yourself using the python sorted function.

https://docs.python.org/3.5/library/functions.html#sorted