Chapter 8 - The WHERE Clause

“I saw the angel in the marble and carved until I set him free.”

- Michelangelo

Using Limit to bring back a Sample

LIMIT { ALL | <integer-number> }

The following is an example using LIMIT:

SELECT *

FROM Employee_table

LIMIT 3 ;

image

Redshift offers a unique capability in its SQL to limit the number of rows returned from the table's data. It is a LIMIT clause and it is normally added at end of a valid SELECT statement with the above example and syntax. This example uses a LIMIT clause to reduce the rows returned, but in reality, the limiting of rows comes from the WHERE clause.

Using Limit With an Order By Statement

Get Amazon Redshift: A Columnar Database SQL and Architecture now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.