Thanks a lot for your reply Ambrus. Can you please tell me which grammar rule in parse.y file parses aggregate function ?
Thanks a lot for your time Prakash On Mon, Sep 21, 2015 at 2:07 PM, Zsb?n Ambrus <ambrus at math.bme.hu> wrote: > On Mon, Sep 21, 2015 at 9:11 AM, Prakash Premkumar > <prakash.prax at gmail.com> wrote: > > I'm reading the sqlite parser grammar. > > > > I could not find the grammar rules which parses aggregate functions like > > MAX,MIN,SUM,COUNT,TOTAL. > > > > Can you please tell me how the aggregate functions are parsed (the > grammar > > rule that parses them) > > A call to an aggregate function is parsed the same way as a call to an > ordinary function. Sqlite then looks up the function name and number > of arguments to determine if this corresponds to an ordinary function > or an aggregate function, and changes the meaning of the query > according to that. > > The page http://sqlite.org/lang_select.html details how the meaning of > a SELECT statement changes if the selected expression contains an > aggregate function: it becomes an aggregate query even if there is no > GROUP BY clause, and it computes one result row from all the input > rows. Aggregate functions can also be used in the expression of > ordinary aggregate queries, containing a GROUP BY clause, or in the > HAVING clause of such a query. > > I probably forgot a few more uses of aggregate functions, but in most > other contexts, an aggregate function found in an expression results > in an error. > > Ambrus > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >