postgresqlHow do I store a bigint value in a PostgreSQL database?
To store a bigint value in a PostgreSQL database, you can use the BIGINT data type. This data type stores a signed 8-byte integer value.
For example, the following code block creates a table with a BIGINT column and inserts a value:
CREATE TABLE bigint_example (
id BIGINT
);
INSERT INTO bigint_example (id) VALUES (9223372036854775807);
The output of the above code block would be:
INSERT 0 1
Code explanation
-
CREATE TABLE bigint_example (id BIGINT);- This creates a table namedbigint_examplewith a single column namedidof typeBIGINT. -
INSERT INTO bigint_example (id) VALUES (9223372036854775807);- This inserts the value9223372036854775807into theidcolumn of thebigint_exampletable.
Helpful links
More of Postgresql
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How can I use PostgreSQL with YAML?
- How can I use PostgreSQL's "zero if null" feature?
- How do I use PostgreSQL's XMIN and XMAX features?
- How can I use PostgreSQL and ZFS snapshots together?
- How do I use PostgreSQL ZonedDateTime to store date and time information?
- How can I monitor PostgreSQL performance using Zabbix?
- How can I retrieve data from PostgreSQL for yesterday's date?
- How can I extract the year from a PostgreSQL timestamp?
- How can I set a PostgreSQL interval to zero?
See more codes...