Teradata RANDOM Number

access_time 4 months ago visibility41 comment 0

RANDOM function in Teradata returns a random integer number for each row of the results table. It is a Teradata extension to the ANSI SQL:2011 standard.

Function syntax

Random(lower_bound, upper_bound)

The limits for lower_bound and upper_bound range from -2147483648 to 2147483647 inclusively and upper_bound must be greater or equal to lower_bound.

Example

SELECT RANDOM(1,1000);

The output will be a random number between 1 and 1000. 

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

Follow Kontext

Get our latest updates on LinkedIn or Twitter.

Want to publish your article on Kontext?

Learn more

More from Kontext

visibility 660
thumb_up 0
access_time 5 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 ...

visibility 14
thumb_up 0
access_time 27 days ago

Teradata hash functions are used to decide data distributions for each row in Teradata tables. When data is inserted into a table, row hash of each record will be calculated first and then the bucket will be calculated, at last the AMP number and fallback AMP number (if fallback is enabled) will be ...

visibility 1654
thumb_up 0
access_time 10 months ago

Python JayDeBeApi module allows you to connect from Python to Teradata databases using Java JDBC drivers. In article Connect to Teradata database through Python , I showed how to use teradata package to connect to Teradata via Teradata ODBC driver. This article demos how to use this JayDeBeApi ...