Articles in this section
Category / Section

Generating Random Numbers in Bold BI®

Published: Apr 12, 2024

When working with Bold BI®, there are several ways to generate random numbers. These methods vary depending on the database management system you are using as a data store. Below are the methods for generating random numbers in SQL Server, PostgreSQL and MySQL.

SQL Server Random Number Generation

Using the RAND() Function

In SQL Server, the RAND() function is used to generate a random floating-point number between 0 and 1. You can use the below query in the expression.

RAND()

The above query will return a random floating-point value.

Using the NEWID() Function

The NEWID() function in SQL Server generates a unique identifier (GUID) for each row in the result set. This function can be used to generate random values for ordering or joining. Here’s an example:

NEWID()

This query will return a random unique identifier.

MySQL Random Number Generation

Using the RAND() Function

MySQL also provides a RAND() function similar to SQL Server, which generates a random floating-point number between 0 and 1. You can use the below query in the expression.

RAND()

This will produce a random floating-point value.

PostgreSQL Random Number Generation

Using the random() Function

In PostgreSQL Server, the random() function is used to generate a random floating-point number between 0 and 1. You can use the below query in the expression.

random()

The above query will return a random floating-point value.

postgresqlrandom.png

randomresult.png

Additional References

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
SM
Written by Siranjeevi Murugan
Updated Apr 12, 2024
Comments (0)
Please  to leave a comment
Access denied
Access denied