Post by desl.. » Fri, 12 Jun 1992 09:06:43

A few days ago I asked this innocent question (on 15 newsgroups, granted):

Quote:>Hello Networld!

>I seek a grammar for the relational database language SQL.  I am
>constructing a parser for SQL in C, so I plan to take this grammar and run
>it through YACC and LEX.

>A YACC/LEX ready text file would be most desirable, though any working
>grammar, no matter how it's formatted, will do.  Any hints to lead me to
>such a  grammar are also appreciated.

Boy did *that* open up a can of worms.  Good worms, but worms still the
same.  To summarize this summary, I did get a yacc/lex grammar.  I also got
a BNF grammar, an offer for some new ANSI grammars, and the name of lots of
potential archives.  So net people, don't lose hope!  If you really want
something out there that you KNOW should be out there, you can find it.
All you need is NEWS (la la la la), all you need is NEWS... (and a little
help from an ARCHIE)

me a  reply that was a summary of his similar request for a grammar a few
months back. This post is an amalgam of his summary and the other direct
replies to my post.


I got lists from ARCHIE sites around the world.  Much thanks to Matt

the grammar at the ftp site under the name 'SQL.source.Z' in
directory pub/netnews/alt.sources/volume90/oct.  Sweden is probably *not*
the closest source for this grammar, but with the one ARCHIE list that I
had at the time seemed to be the site that had what I was looking
for.  The grammar is one that was written by Leroy Cain in 1990 and
includes a LEX grammar, a YACC grammar, the parser/lexical analyzer
generated from those grammars, a utility for generating variations on
ANSI-SQL (embedded, module, and internal), a makefile, and of course the
obligatory README file.

Complete Reference."  Thanks especially to Charles for sending me the typed
BNF grammar for SQL from that book.

"packages a C lexical analyzer and YACC grammer for SQL with their PCYACC
package.  Their package costs ~$500 but there are no problems with taking
their grammer  and moving it to other YACC implementations.  They can be
contacted at:

   ABRAXAS Software, Inc.
   7033 SW Macadam Ave.
   Portland Oregon 97219 USA
   Phone: (503) 244-5253
   Fax:   (503) 244-8375"

grammar in the comp.compilers archive.  Either FTP it from or get it by mailing 'send sql.shar' to


in my quest for a public domain database package which supports SQL.  It
looks like you can get what your looking for at the following location:
anonymous ftp...   /pub/sql.shar" ... "It seems to
include a YACC/LEX ready text file..."  She also asks if I know of any PD
database packages which support SQL.  I don't -- what about anyone else out
there on the net?


So that leaves me with the SQL grammar in BNF and in yacc/lex.  I also have
an exhaustive list of FTP sites with the files with the word SQL in them.
Anyone who would like a copy of the grammar(s) or the FTP sites just give
me a ring.  Thanks.


|                                        |   Standard disclaimer for rent.  |
|  Dennis Slade Jr.                      |         +++++++++++++++          |
|  Box 3533, Vassar College              |         Inquire within.          |
|  Poughkeepsie, NY  12601               +----------------------------------+

|                                        |  AIESEC: in a country near you!  |


1. Summary of Summary of Summary of Totals....

Hello all....I appreciate any input since I am considering taking a butter
knife to my wrist. J/K.  What I am trying to do is get a Grand Summary of
all outstanding amount whether they are zero balances or not....currently
the only way I see anything is having a report with ALL invoices + payments
(under their columns) listed which gives me a total per customer # + name
for invoices (Sum Debit) and payments (Sum Credit).  This way I get it per
customer no problem, if I add the field "Balance" it gives me a total of all
invoices of all customer together being a FULL total no subtractions
splitting only where the customer changes but still it's the same
total...example   cust.A blah blah blah Total = 322,089.21.....cust. B blah
blah blah Total = 322,089.21, etc..  Now if I remove the body to only get
the Sub-Summary without listing all payments and invoices and put "Balance"
I get the same effect.

I have several fields that intertwine..
Amount, Shipping Charge, Credit, Balance=Sum Debit-Sum Credit,
Total....which is.... Sum(Amount)+Shipping Charge, Sum Debit...which
is....Summary=Total of Totals, Sum Credit...which is....Summary=Total of
Credit...which is the payments.

Would appreciate any input if any other information is needed..don't
hesitate to ask.  Thanx for any help.

2. SQL query with UDF in Access

3. Summary fields or Summary table?

4. Search for a Subdirectory??

5. How to make calculations based on several summary fields included in a sub-summary part

6. Parallel Data Query - When Most Beneficial ?

7. Summary of a Summary?

8. Can't update record

9. Need duplications, but need summary, stuck!

10. report/summary query design help needed

11. Need help about cross summary query in Oracle8i.

12. SUMMARY ( Open CLient-Library help needed )

13. Varchar summary needed