Полезная информация

next up previous contents index
Next: Data types Up: Customizing Queries Previous: Controlling DEFAULT Values

Column Labels

 You may have noticed the text that appears at the top of each column in the SELECT output. That is called the column label. Usually, the label is the name of the column being selected. However, you can control what text appears at the top of each column using the AS keyword. For example, figure [*] shows the use of AS so the column label buddy appears at the top of the column.

  
Figure: Controlling column labels
\begin{figure}\begin{list}{}{
\setlength{\rightmargin}{\leftmargin}
\raggedrigh...
...r Cindy
\par Sam~
\par Mike~
\par Mark~
\par (4~rows)\end{list}\par
\end{figure}

You may have noticed that the query in figure [*] on page [*] has the column label ?column?. The database server returns this label when there is no suitable label. In that case, the result of an addition doesn't have an appropriate label. Figure [*] shows the same query with an appropriate label added using AS.
  
Figure: Computation using a column label
\begin{figure}\begin{list}{}{
\setlength{\rightmargin}{\leftmargin}
\raggedrigh...
...\par total
\par -{}-{}-{}-{}-
\par ~~~~4
\par (1~row)\end{list}\par
\end{figure}


Bruce Momjian
1999-11-21