From a2b498c291d9c21474f128f37c89482908bf35b0 Mon Sep 17 00:00:00 2001
From: Bruce Momjian
Date: Wed, 28 May 2003 04:35:28 +0000
Subject: [PATCH] Add info about selecting a random row.
---
doc/FAQ | 12 +++++++++---
doc/src/FAQ/FAQ.html | 14 +++++++++++---
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/doc/FAQ b/doc/FAQ
index c188796c0eb..234267d2814 100644
--- a/doc/FAQ
+++ b/doc/FAQ
@@ -1,7 +1,7 @@
Frequently Asked Questions (FAQ) for PostgreSQL
- Last updated: Mon May 26 15:25:04 EDT 2003
+ Last updated: Wed May 28 00:35:16 EDT 2003
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
@@ -58,7 +58,7 @@
Operational Questions
4.1) What is the difference between binary cursors and normal cursors?
- 4.2) How do I SELECT only the first few rows of a query?
+ 4.2) How do I SELECT only the first few rows of a query? A random row?
4.3) How do I get a list of tables or other things I can see in psql?
4.4) How do you remove a column from a table, or change it's data
type?
@@ -627,7 +627,7 @@
See the DECLARE manual page for a description.
- 4.2) How do I SELECT only the first few rows of a query?
+ 4.2) How do I SELECT only the first few rows of a query? A random row?
See the FETCH manual page, or use SELECT ... LIMIT....
@@ -637,6 +637,12 @@
evaluate only the first few records requested, or the entire query may
have to be evaluated until the desired rows have been generated.
+ To SELECT a random row, use:
+ SELECT col
+ FROM tab
+ ORDER BY random()
+ LIMIT 1;
+
4.3) How do I get a list of tables or other things I can see in psql?
You can read the source code for psql in file
diff --git a/doc/src/FAQ/FAQ.html b/doc/src/FAQ/FAQ.html
index c63696aa587..23e7c92d06b 100644
--- a/doc/src/FAQ/FAQ.html
+++ b/doc/src/FAQ/FAQ.html
@@ -10,7 +10,7 @@
alink="#0000ff">
Frequently Asked Questions (FAQ) for PostgreSQL
- Last updated: Mon May 26 15:25:04 EDT 2003
+ Last updated: Wed May 28 00:35:16 EDT 2003
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
@@ -83,7 +83,7 @@
4.1) What is the difference between binary
cursors and normal cursors?
4.2) How do I SELECT only the
- first few rows of a query?
+ first few rows of a query? A random row?
4.3) How do I get a list of tables or other
things I can see in psql?
4.4) How do you remove a column from a
@@ -799,7 +799,7 @@
description.
4.2) How do I SELECT only the
- first few rows of a query?
+ first few rows of a query? A random row?
See the FETCH manual page, or use
SELECT ... LIMIT....
@@ -811,6 +811,14 @@
records requested, or the entire query may have to be evaluated
until the desired rows have been generated.
+ To SELECT a random row, use:
+
+ SELECT col
+ FROM tab
+ ORDER BY random()
+ LIMIT 1;
+
+
4.3) How do I get a list of tables or other
things I can see in psql?
--
2.39.5