Numeric Data Type Aliases
Redpanda SQL accepts aliases that you can use interchangeably with the primary data types. During processing, Redpanda SQL maps these aliases to their corresponding primary data types.
The following sections describe the numeric data type aliases:
integer alias
The integer alias is an alternative name for the int data type. For example, the following two queries are functionally the same:
CREATE TABLE ExampleTable (
id INTEGER
);
-- Functionally the same as the previous table
CREATE TABLE AnotherTable (
id INT,
);
|
Even though you specify the |
long alias
The long alias is often used to represent larger integer values. For example:
CREATE TABLE LargeValues (
value LONG
);
-- Functionally the same as the previous table
CREATE TABLE LargeValuesEquivalent (
value BIGINT
);
|
Even though you specify the |
float alias
The float alias corresponds to the double precision data type, as in PostgreSQL. For example:
CREATE TABLE FloatExample (
price FLOAT
);
-- Functionally the same as the previous table
CREATE TABLE FloatEquivalent (
price DOUBLE PRECISION
);
|
Even though you specify the |
double alias
The double alias defines double precision floating-point numbers. For example:
CREATE TABLE DoubleExample (
measurement DOUBLE
);
-- Functionally the same as the previous table
CREATE TABLE DoubleEquivalent (
measurement DOUBLE PRECISION
);
|
Even though you specify the |
decimal alias
The decimal alias is an alternative name for the numeric data type. decimal(p, s) and numeric(p, s) are the same type. For example, the following two casts are functionally the same:
SELECT '12.50'::DECIMAL(5, 2);
-- Functionally the same as the previous cast
SELECT '12.50'::NUMERIC(5, 2);
See numeric type.