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 use PostgreSQL with YAML?
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How do I use PostgreSQL ZonedDateTime to store date and time information?
- How can I retrieve data from PostgreSQL for yesterday's date?
- How do I use PostgreSQL and ZFS together?
- How can I extract the year from a PostgreSQL timestamp?
- How do I use PostgreSQL's XMLTABLE to parse XML data?
- How can I monitor PostgreSQL performance using Zabbix?
- How do I use PostgreSQL's XMIN and XMAX features?
- How can I use PostgreSQL XML functions to manipulate XML data?
See more codes...