O'Reilly logo

Teradata SQL by Tom Coffing, Mike Larkins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4 - The TOP Command

“Do not remove a fly from your friend's forehead with a hatchet.”

-Chinese Proverb

 

TOP Command

images

SELECT TOP 3      Last_Name,                              Class_Code,                              Grade_PtFROM         Student_Table;

Last_Name Class_Code Grade_Pt
Hanson FR 2.88
Bond JR 3.95
Smith SO 2.00

This is the TOP command. By putting TOP 3 before the column names, you are telling your system that you only want to see the top three rows on your report. This example brings back 3 random rows. That is not what makes the TOP command great. It becomes great when you ORDER BY the data.

 

TOP Command ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required