postgresqlHow do I use PostgreSQL float type?
PostgreSQL float type is a data type used to store real numbers with precision up to 8 bytes. It is a variable precision type, which means that the actual number of bytes allocated to store the number depends on its value.
Example code
CREATE TABLE float_example (
id serial PRIMARY KEY,
float_number float
);
INSERT INTO float_example (float_number)
VALUES (3.1415);
SELECT * FROM float_example;
Output example
id | float_number
----+--------------
1 | 3.1415
(1 row)
In the example code above:
CREATE TABLE float_example
creates a table calledfloat_example
with anid
column of typeserial
as primary key and afloat_number
column of typefloat
.INSERT INTO float_example
inserts a row into the table with a value of3.1415
for thefloat_number
column.SELECT * FROM float_example
retrieves all the records from the table.
Helpful links
More of Postgresql
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How can I use PostgreSQL's "zero if null" feature?
- How can I use PostgreSQL and ZFS snapshots together?
- How do I use PostgreSQL ZonedDateTime to store date and time information?
- How do I use PostgreSQL with Qt?
- How do I use PostgreSQL and ZFS together?
- How do I use regexp_replace in PostgreSQL?
- How can I create a hierarchical query in PostgreSQL?
- How can I set a PostgreSQL interval to zero?
- How can I monitor PostgreSQL performance using Zabbix?
See more codes...