Data Type Postgresql

Data Type Postgresql almost the same as Mysql Data Type or Data Type Redshift – PostgreSQL is a source of object-relational open database systems that gets a strong reputation for reliability, data integrity, and truth. It runs on all major operating systems, including Linux, UNIX (AIX, BSD, HP-UX, SGI IRIX, Mac OS X, Solaris, Tru64), and Windows and can support  C / C ++, Java, PHP, Net programming interfaces , Perl, Python, Ruby, Tcl, ODBC, and others.
In this period I will discuss the types of Data Type Postgresql , including:
Data Type Postgresql
Data Type in Postgresql

List of Data Type Postgresql

1.  Type of numeric 
The numeric type consists of two, four, and integers eight bytes, four and eight byte floating-point numbers, and decimals are chosen precision.
Name
Storage Size
Description
Range
smallint
2 bytes
small-range integers
-32,768 to 32,767
integer
4 bytes
typical choice for integers
-2147483648 until 2147483647
bigint
8 bytes
large-range integers
-9223372036854775808 To 9223372036854775807
decimal
variable
user-defined precision, right
up to 131,072 digits before the decimal point; up to 16,383 digits after the decimal point
numeric
variable
user-defined precision, right
up to 131,072 digits before the decimal point; up to 16,383 digits after the decimal point
real
4 bytes
variable-precision, not right
6 decimal digits of precision
double precision
8 bytes
variable-precision, not right
15 decimal digits of precision
smallserial
2 bytes
small autoincrementing integers
1-32767
serial
4 bytes
autoincrementing integers
1-2147483647
bigserial
8 bytes
large autoincrementing integers
1-9223372036854775807
2. Type of currency ( Monetary Types)
Save a number of currencies with fixed precision fractions. However, this is not recommended. Floating point numbers may not be used to handle money because of the potential for rounding errors.
Name
Storage Size
Description
Range
money
8 bytes
Amount of currency
-92233720368547758.08 to +92233720368547758.07
Data Type in Postgresql (currency)
3. Character ( Character Types)
SQL defines two main character types: different characters (n) and characters (n), where n is a positive integer.
These two types can store strings up to n characters (not bytes) in length, Notations varchar (n) and char (n) are aliases for different characters (n) and characters (n), respectively.
Name
Storage Size
Description
Range
character varying (n), varchar (n)
variable-length with boundary
character (n), char (n)
fixed-length, blank padded
text
infinite length variable
4. Binary Data Types
Binary strings are distinguished from string characters in two ways. First, special binary strings allow storing zero and other “non-printable” octets
True type supports two external formats for input and output
  1. Hex Format Bytea
    “hex” format encodes binary data as 2 hexadecimal digits per byte, the most significant (SELECT E ‘\\xDEADBEEF’;).
  2. Bytea Escape Format
    It takes an approach that represents binary strings as sequences of ASCII characters, while changing those bytes that cannot be represented as ASCII characters to special escape sequences .
Read Also :   SQL Server Monitoring Tools Download
Name
Storage Size
Description
Range
bytea
1 or 4 bytes plus the actual binary string
variable-length binary string
5. Date / Time Type
PostgreSQL supports a full set of SQL date and time types, all functions and operators described below which take time or stamp input actually come in two variants: one that takes time with a time zone or timestamp with a time zone, and one that takes time without time zone or timestamp without time zone. For brevity, this variant is not displayed separately. Also, the + and * operators come in commutative pairs (for example both dates + integers and integers + dates); we only show one of each pair.
Dates are calculated according to the Gregorian calendar, even in the year before the calendar was introduced.
Name
Storage Size
Description
Low Value
High Value
Resolution
timestamp [( p )] [without time zone]
8 bytes
both date and time (no time zone)
4713 BC
294276 AD
1 microsecond / 14 digits
timestamp [( p )] with time zone
8 bytes
both date and time, with time zone
4713 BC
294276 AD
1 microsecond / 14 digits
date
4 bytes
date (no time of day)
4713 BC
5874897 AD
1 day
time [( p )] [without time zone]
8 bytes
time of day (no date)
00:00:00
24:00:00
1 microsecond / 14 digits
time [( p )] with time zone
12 bytes
times of day only, with time zone
00: 00: 00 + 1459
24: 00: 00-1459
1 microsecond / 14 digits
interval [  fields ] [( p )]
16 bytes
time interval
-1780000 years
1,800,000 years
1 microsecond / 14 digits

Some discussion about Data Type Postgresql , hopefully useful, Thank for Visit.

About Admin 23 Articles
Web Programming, Database Programming

Be the first to comment

Leave a Reply

Your email address will not be published.


*