>> Putting the 'ORDER BY' clause in view won't work? > > It will work just fine, in that the results you see will appear in the ORDER > you asked for.
I believe that's not always true and is not required by SQL standard. Most probably 'select * from view_name' will return rows in the order written in the view. But 'select * from view_name where some_column = some_value' can already return rows in completely different order. And 'select * from table_name, view_name where some_condition' will almost certainly ignore any ORDER BY in the view. So ORDER BY in the view doesn't guarantee you anything. Pavel On Fri, Jul 1, 2011 at 10:19 AM, Simon Slavin <[email protected]> wrote: > > On 1 Jul 2011, at 3:07pm, Alessandro Marzocchi wrote: > >> 2011/7/1 Simon Slavin <[email protected]> >> >>> On 1 Jul 2011, at 11:20am, Alessandro Marzocchi wrote: >>> >>>> Isn't it possible to use a view for that? >>> >>> You can use a VIEW if you want, but VIEWs don't sort the table either. A >>> VIEW is just a way of saving a SELECT query. When you consult the VIEW >>> SQLite executes the SELECT. >> >> Putting the 'ORDER BY' clause in view won't work? > > It will work just fine, in that the results you see will appear in the ORDER > you asked for. > > However, it has no influence on how data is stored. In fact no table data is > stored for a VIEW at all. The thing stored is the parameters given when you > created the VIEW. Every time you refer to a VIEW in a SQL statement SQL goes > back and looks at the VIEW specification again. > > Simon. > _______________________________________________ > sqlite-users mailing list > [email protected] > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

