On 19/05/2009 9:37 PM, Nuno Lucas wrote: > On Mon, May 18, 2009 at 5:03 PM, Mitchell L Model <m...@acm.org> wrote: >> I may be misreading the select-core diagram on >> http://www.sqlite.org/lang_select.html but it appears that the down-arrow >> that would allow a query without a FROM clause should not be there. Is it >> really possible to have a SELECT with no FROM? If so, could someone provide >> an example; if not, would someone maintaining the documentation make a note >> of this? Thank you. > > Yes. > > An use-case could be when you need to pass results to a function > expecting table result data, but you actually have const data. Instead > of having a select from some table (that must exist for the SQL to be > valid), you can just issue a select with no "FROM" clause. > > sqlite> select 1,"Some Data" UNION select 2, "Some More Data"; > 1|Some Data > 2|Some More Data > > Note that although this is not standard SQL, some other engines also > have similar features, for example, Oracle let's you do "SELECT 1 FROM > DUAL", where "DUAL" means "not really from any table". In Oracle you > could use it, for example, to get the server date/time so you could > sync your client application clock. As SQLite is not a server, most > pratical examples are for running user defined functions.
It's handy for checking how things work e.g. sqlite> select (-1) % 7; -1 sqlite> -- it's not a real modulo operator :-( Cheers, John _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users