1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>NoSQL: Extracting information from tables</TITLE>
<LINK HREF="NoSQL-5.html" REL=next>
<LINK HREF="NoSQL-3.html" REL=previous>
<LINK HREF="NoSQL.html#toc4" REL=contents>
</HEAD>
<BODY BGCOLOR="#fff0e0">
<A HREF="NoSQL-5.html">Next</A>
<A HREF="NoSQL-3.html">Previous</A>
<A HREF="NoSQL.html#toc4">Contents</A>
<HR>
<H2><A NAME="s4">4. Extracting information from tables</A> </H2>
<H2><A NAME="ss4.1">4.1 General</A>
</H2>
<P>The following shows some examples of how the system is
usually used, which involves a combinations of operators.
Using the table named 'sample' the command:
<P>
<BLOCKQUOTE><CODE>
<PRE>
column NAME AMT TYP < sample | sorttable TYP | justify
</PRE>
</CODE></BLOCKQUOTE>
<P>gives the output:
<P>
<BLOCKQUOTE><CODE>
<PRE>
NAME AMT TYP
------ ---- ---
Bush 133 A
Hansen 23 A
Perry 244 B
Hart 1111 D
Holmes 1111 D
Jones 77 X
</PRE>
</CODE></BLOCKQUOTE>
<P>Note that the column COUNT was excluded by the
'column' operator, and that the order of the selected columns
was changed from that in the input table. Of course to save
the output in a file, (redirection of STDOUT into a file)
something like the following is used:
<P>
<BLOCKQUOTE><CODE>
<PRE>
column ... < sample | sorttable TYP | justify > file.out
</PRE>
</CODE></BLOCKQUOTE>
<P>An example using the operator 'row' on the table 'sample' is:
<P>
<BLOCKQUOTE><CODE>
<PRE>
row 'AMT < 900' < sample | column NAME AMT TYP |
sorttable NAME | justify
</PRE>
</CODE></BLOCKQUOTE>
<P>Note how the row selection expression is surrounded by single quotes,
to prevent its interpretation by the shell. Here we
select some rows using 'row', select some columns using
'column', sort what we have with 'sorttable', and print with
'justify'. The output is:
<P>
<BLOCKQUOTE><CODE>
<PRE>
NAME AMT TYP
------ --- ---
Bush 133 A
Hansen 23 A
Jones 77 X
Perry 244 B
</PRE>
</CODE></BLOCKQUOTE>
<HR>
<A HREF="NoSQL-5.html">Next</A>
<A HREF="NoSQL-3.html">Previous</A>
<A HREF="NoSQL.html#toc4">Contents</A>
</BODY>
</HTML>
|