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_examplecreates a table calledfloat_examplewith anidcolumn of typeserialas primary key and afloat_numbercolumn of typefloat.INSERT INTO float_exampleinserts a row into the table with a value of3.1415for thefloat_numbercolumn.SELECT * FROM float_exampleretrieves all the records from the table.
Helpful links
More of Postgresql
- How can I use PostgreSQL and ZFS snapshots together?
- How can I monitor PostgreSQL performance using Zabbix?
- How do I use PostgreSQL ZonedDateTime to store date and time information?
- How can I use PostgreSQL on the Yandex Cloud platform?
- How can I set a PostgreSQL interval to zero?
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How can I use PostgreSQL's "zero if null" feature?
- How can I extract the year from a PostgreSQL timestamp?
- How can I extract the year from a date in PostgreSQL?
- How do I use PostgreSQL's XMIN and XMAX features?
See more codes...