Sqlite Random Function

SQLite: random Function

This SQLite post explains how to use the SQLite random function with syntax and examples.

Description

The SQLite random function can be used to return a random number.

Syntax

The syntax for the random function in SQLite is:

random()

Parameters or Arguments

There are no parameters or arguments for the random function.

Note

  • The random function will return a value between -9223372036854775808 and +9223372036854775807.

Applies To

The random function can be used in the following versions of SQLite:

  • SQLite 3.8.6, SQLite 3.8.x, SQLite 3.7.x, SQLite 3.6.x

Example

Let's look at some SQLite random function examples and explore how to use the random function in SQLite.

For example:

sqlite> SELECT random();
Output:  -8257945920605071060     (your result will vary)

sqlite> SELECT random();
Output:  -290446534240950472      (your result will vary)

sqlite> SELECT random();
Output:  6411371429727670350      (your result will vary)