Select top N records in SQL / Hive

access_time 2 years ago visibility5819 comment 0

In different databases, the syntax of selecting top N records are slightly different. They may also differ from ISO standards.

In Hive, use LIMIT N retrieve N records from the table. Remember to change N to an actual number.

Code snippet

info Last modified by Raymond at 2 years ago copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

Want to publish your article on Kontext?

Learn more

Kontext Column

Created for everyone to publish data, programming and cloud related articles.
Follow three steps to create your columns.

Learn more arrow_forward

More from Kontext

local_offer hadoop local_offer hive local_offer big-data-on-windows-10

visibility 25298
thumb_up 5
access_time 2 years ago

In this article, I’m going to demo how to install Hive 3.0.0 on Windows 10. Before installation of Apache Hive, please ensure you have Hadoop available on your Windows environment. We cannot run Hive without Hadoop.  I recommend to install Hadoop 3.x to work with Hive 3.0.0. There are two ...

local_offer teradata local_offer SQL local_offer teradata-sql-query

visibility 342
thumb_up 0
access_time 4 months ago

As other databases, Teradata provides many aggregation functions that can be used to retrieve SUM, COUNT, MAX, MIN and AVG values. These functions returns a single value per group. To retrieve the whole first row from each 'GROUP BY' group, windowing functions can be used.  The following code ...

local_offer teradata local_offer SQL local_offer teradata-sql-query

visibility 114
thumb_up 0
access_time 3 months ago

JSON data type is supported in Teradata from version 15.10. Together with native JSON type, a number of JSON functions are added to support extracting values from JSON, shredding JSON, etc.  info The following code snippets use string literal to demonstrate the usage of these functions; you ...

About column

Code snippets and tips for various programming languages/frameworks.

rss_feed Subscribe RSS