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_example
with a single column namedid
of typeBIGINT
. -
INSERT INTO bigint_example (id) VALUES (9223372036854775807);
- This inserts the value9223372036854775807
into theid
column of thebigint_example
table.
Helpful links
More of Postgresql
- How can I set a PostgreSQL interval to zero?
- How can I use PostgreSQL with YAML?
- How can I monitor PostgreSQL performance using Zabbix?
- How can I retrieve data from PostgreSQL for yesterday's date?
- How do I convert a string to lowercase in PostgreSQL?
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How do I use PostgreSQL's XMLTABLE to parse XML data?
- How can I use PostgreSQL's "zero if null" feature?
- How do I use PostgreSQL ZonedDateTime to store date and time information?
- How do I parse XML data using PostgreSQL?
See more codes...