Mercurial > urweb
comparison doc/manual.tex @ 1188:86653ff6a0cb
Update manual for COUNT(col)
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 16 Mar 2010 16:02:54 -0400 |
parents | 9d3ccb8b39ac |
children | 1da49fd79e20 |
comparison
equal
deleted
inserted
replaced
1187:ad9829c3c12c | 1188:86653ff6a0cb |
---|---|
1645 $$\begin{array}{l} | 1645 $$\begin{array}{l} |
1646 \mt{val} \; \mt{sql\_count} : \mt{tables} ::: \{\{\mt{Type}\}\} \to \mt{agg} ::: \{\{\mt{Type}\}\} \to \mt{exps} ::: \{\mt{Type}\} \to \mt{sql\_exp} \; \mt{tables} \; \mt{agg} \; \mt{exps} \; \mt{int} | 1646 \mt{val} \; \mt{sql\_count} : \mt{tables} ::: \{\{\mt{Type}\}\} \to \mt{agg} ::: \{\{\mt{Type}\}\} \to \mt{exps} ::: \{\mt{Type}\} \to \mt{sql\_exp} \; \mt{tables} \; \mt{agg} \; \mt{exps} \; \mt{int} |
1647 \end{array}$$ | 1647 \end{array}$$ |
1648 | 1648 |
1649 $$\begin{array}{l} | 1649 $$\begin{array}{l} |
1650 \mt{con} \; \mt{sql\_aggregate} :: \mt{Type} \to \mt{Type} \\ | 1650 \mt{con} \; \mt{sql\_aggregate} :: \mt{Type} \to \mt{Type} \to \mt{Type} \\ |
1651 \mt{val} \; \mt{sql\_aggregate} : \mt{tables} ::: \{\{\mt{Type}\}\} \to \mt{agg} ::: \{\{\mt{Type}\}\} \to \mt{exps} ::: \{\mt{Type}\} \to \mt{t} ::: \mt{Type} \\ | 1651 \mt{val} \; \mt{sql\_aggregate} : \mt{tables} ::: \{\{\mt{Type}\}\} \to \mt{agg} ::: \{\{\mt{Type}\}\} \to \mt{exps} ::: \{\mt{Type}\} \to \mt{dom} ::: \mt{Type} \to \mt{ran} ::: \mt{Type} \\ |
1652 \hspace{.1in} \to \mt{sql\_aggregate} \; \mt{t} \to \mt{sql\_exp} \; \mt{agg} \; \mt{agg} \; \mt{exps} \; \mt{t} \to \mt{sql\_exp} \; \mt{tables} \; \mt{agg} \; \mt{exps} \; \mt{t} | 1652 \hspace{.1in} \to \mt{sql\_aggregate} \; \mt{dom} \; \mt{ran} \to \mt{sql\_exp} \; \mt{agg} \; \mt{agg} \; \mt{exps} \; \mt{dom} \to \mt{sql\_exp} \; \mt{tables} \; \mt{agg} \; \mt{exps} \; \mt{ran} |
1653 \end{array}$$ | |
1654 | |
1655 $$\begin{array}{l} | |
1656 \mt{val} \; \mt{sql\_count\_col} : \mt{t} ::: \mt{Type} \to \mt{sql\_aggregate} \; (\mt{option} \; \mt{t}) \; \mt{int} | |
1653 \end{array}$$ | 1657 \end{array}$$ |
1654 | 1658 |
1655 $$\begin{array}{l} | 1659 $$\begin{array}{l} |
1656 \mt{class} \; \mt{sql\_summable} \\ | 1660 \mt{class} \; \mt{sql\_summable} \\ |
1657 \mt{val} \; \mt{sql\_summable\_int} : \mt{sql\_summable} \; \mt{int} \\ | 1661 \mt{val} \; \mt{sql\_summable\_int} : \mt{sql\_summable} \; \mt{int} \\ |
1658 \mt{val} \; \mt{sql\_summable\_float} : \mt{sql\_summable} \; \mt{float} \\ | 1662 \mt{val} \; \mt{sql\_summable\_float} : \mt{sql\_summable} \; \mt{float} \\ |
1659 \mt{val} \; \mt{sql\_avg} : \mt{t} ::: \mt{Type} \to \mt{sql\_summable} \; \mt{t} \to \mt{sql\_aggregate} \; \mt{t} \\ | 1663 \mt{val} \; \mt{sql\_avg} : \mt{t} ::: \mt{Type} \to \mt{sql\_summable} \; \mt{t} \to \mt{sql\_aggregate} \; \mt{t} \; \mt{t} \\ |
1660 \mt{val} \; \mt{sql\_sum} : \mt{t} ::: \mt{Type} \to \mt{sql\_summable} \mt{t} \to \mt{sql\_aggregate} \; \mt{t} | 1664 \mt{val} \; \mt{sql\_sum} : \mt{t} ::: \mt{Type} \to \mt{sql\_summable} \mt{t} \to \mt{sql\_aggregate} \; \mt{t} \; \mt{t} |
1661 \end{array}$$ | 1665 \end{array}$$ |
1662 | 1666 |
1663 $$\begin{array}{l} | 1667 $$\begin{array}{l} |
1664 \mt{class} \; \mt{sql\_maxable} \\ | 1668 \mt{class} \; \mt{sql\_maxable} \\ |
1665 \mt{val} \; \mt{sql\_maxable\_int} : \mt{sql\_maxable} \; \mt{int} \\ | 1669 \mt{val} \; \mt{sql\_maxable\_int} : \mt{sql\_maxable} \; \mt{int} \\ |
1666 \mt{val} \; \mt{sql\_maxable\_float} : \mt{sql\_maxable} \; \mt{float} \\ | 1670 \mt{val} \; \mt{sql\_maxable\_float} : \mt{sql\_maxable} \; \mt{float} \\ |
1667 \mt{val} \; \mt{sql\_maxable\_string} : \mt{sql\_maxable} \; \mt{string} \\ | 1671 \mt{val} \; \mt{sql\_maxable\_string} : \mt{sql\_maxable} \; \mt{string} \\ |
1668 \mt{val} \; \mt{sql\_maxable\_time} : \mt{sql\_maxable} \; \mt{time} \\ | 1672 \mt{val} \; \mt{sql\_maxable\_time} : \mt{sql\_maxable} \; \mt{time} \\ |
1669 \mt{val} \; \mt{sql\_max} : \mt{t} ::: \mt{Type} \to \mt{sql\_maxable} \; \mt{t} \to \mt{sql\_aggregate} \; \mt{t} \\ | 1673 \mt{val} \; \mt{sql\_max} : \mt{t} ::: \mt{Type} \to \mt{sql\_maxable} \; \mt{t} \to \mt{sql\_aggregate} \; \mt{t} \; \mt{t} \\ |
1670 \mt{val} \; \mt{sql\_min} : \mt{t} ::: \mt{Type} \to \mt{sql\_maxable} \; \mt{t} \to \mt{sql\_aggregate} \; \mt{t} | 1674 \mt{val} \; \mt{sql\_min} : \mt{t} ::: \mt{Type} \to \mt{sql\_maxable} \; \mt{t} \to \mt{sql\_aggregate} \; \mt{t} \; \mt{t} |
1671 \end{array}$$ | 1675 \end{array}$$ |
1672 | 1676 |
1673 \texttt{FROM} clauses are specified using a type family. | 1677 \texttt{FROM} clauses are specified using a type family. |
1674 $$\begin{array}{l} | 1678 $$\begin{array}{l} |
1675 \mt{con} \; \mt{sql\_from\_items} :: \{\{\mt{Type}\}\} \to \mt{Type} \\ | 1679 \mt{con} \; \mt{sql\_from\_items} :: \{\{\mt{Type}\}\} \to \mt{Type} \\ |
1966 &&& a(E) & \textrm{other aggregate function} \\ | 1970 &&& a(E) & \textrm{other aggregate function} \\ |
1967 &&& (E) & \textrm{explicit precedence} \\ | 1971 &&& (E) & \textrm{explicit precedence} \\ |
1968 \textrm{Nullary operators} & n &::=& \mt{CURRENT\_TIMESTAMP} \\ | 1972 \textrm{Nullary operators} & n &::=& \mt{CURRENT\_TIMESTAMP} \\ |
1969 \textrm{Unary operators} & u &::=& \mt{NOT} \\ | 1973 \textrm{Unary operators} & u &::=& \mt{NOT} \\ |
1970 \textrm{Binary operators} & b &::=& \mt{AND} \mid \mt{OR} \mid \neq \mid < \mid \leq \mid > \mid \geq \\ | 1974 \textrm{Binary operators} & b &::=& \mt{AND} \mid \mt{OR} \mid \neq \mid < \mid \leq \mid > \mid \geq \\ |
1971 \textrm{Aggregate functions} & a &::=& \mt{AVG} \mid \mt{SUM} \mid \mt{MIN} \mid \mt{MAX} \\ | 1975 \textrm{Aggregate functions} & a &::=& \mt{COUNT} \mid \mt{AVG} \mid \mt{SUM} \mid \mt{MIN} \mid \mt{MAX} \\ |
1972 \textrm{Directions} & o &::=& \mt{ASC} \mid \mt{DESC} \\ | 1976 \textrm{Directions} & o &::=& \mt{ASC} \mid \mt{DESC} \\ |
1973 \textrm{SQL integer} & N &::=& n \mid \{e\} \\ | 1977 \textrm{SQL integer} & N &::=& n \mid \{e\} \\ |
1974 \end{array}$$ | 1978 \end{array}$$ |
1975 | 1979 |
1976 Additionally, an SQL expression may be inserted into normal Ur code with the syntax $(\mt{SQL} \; E)$ or $(\mt{WHERE} \; E)$. Similar shorthands exist for other nonterminals, with the prefix $\mt{FROM}$ for $\mt{FROM}$ items and $\mt{SELECT1}$ for pre-queries. | 1980 Additionally, an SQL expression may be inserted into normal Ur code with the syntax $(\mt{SQL} \; E)$ or $(\mt{WHERE} \; E)$. Similar shorthands exist for other nonterminals, with the prefix $\mt{FROM}$ for $\mt{FROM}$ items and $\mt{SELECT1}$ for pre-queries. |