10
10
alink="#0000ff">
11
11
<H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1>
12
12
13
- <P>Last updated: Mon May 26 15:25:04 EDT 2003</P>
13
+ <P>Last updated: Wed May 28 00:35:16 EDT 2003</P>
14
14
15
15
<P>Current maintainer: Bruce Momjian (<A href=
16
16
"mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)<BR>
@@ -83,7 +83,7 @@ <H2 align="center">Operational Questions</H2>
83
83
<A href="#4.1">4.1</A>) What is the difference between binary
84
84
cursors and normal cursors?<BR>
85
85
<A href="#4.2">4.2</A>) How do I <SMALL>SELECT</SMALL> only the
86
- first few rows of a query?<BR>
86
+ first few rows of a query? A random row? <BR>
87
87
<A href="#4.3">4.3</A>) How do I get a list of tables or other
88
88
things I can see in <I>psql</I>?<BR>
89
89
<A href="#4.4">4.4</A>) How do you remove a column from a
@@ -799,7 +799,7 @@ <H4><A name="4.1">4.1</A>) What is the difference between binary
799
799
description.</P>
800
800
801
801
<H4><A name="4.2">4.2</A>) How do I <SMALL>SELECT</SMALL> only the
802
- first few rows of a query?</H4>
802
+ first few rows of a query? A random row? </H4>
803
803
804
804
<P>See the <SMALL>FETCH</SMALL> manual page, or use
805
805
<SMALL>SELECT</SMALL> ... <SMALL>LIMIT</SMALL>....</P>
@@ -811,6 +811,14 @@ <H4><A name="4.2">4.2</A>) How do I <SMALL>SELECT</SMALL> only the
811
811
records requested, or the entire query may have to be evaluated
812
812
until the desired rows have been generated.</P>
813
813
814
+ <P>To <SMALL>SELECT</SMALL> a random row, use:
815
+ <PRE>
816
+ SELECT col
817
+ FROM tab
818
+ ORDER BY random()
819
+ LIMIT 1;
820
+ </PRE>
821
+
814
822
<H4><A name="4.3">4.3</A>) How do I get a list of tables or other
815
823
things I can see in <I>psql</I>?</H4>
816
824
0 commit comments