datatyps in posgresql

Post on 10-May-2015

94 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Datatyps in posgresql

TRANSCRIPT

Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring PartnerBaabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd

Title of the presentation

• PostgreSQL has a rich set of native data types available to users. Users may add new types to PostgreSQL using the CREATE TYPE command.

Major Data types

Numeric Types

Numeric Types

•Data Types• Smallint :- 2 bytes,• integer :- 4 bytes• bigint :- 8 bytes• Store whole numbers • Attempts to store values outside of the allowed range will result in an error.•Example• Smallint :- sint_type_room • integer :- fk_int_voucher_no• bigint :- pk_bigint_cu_id bigint

Numeric Types•Data Type

• numeric can store numbers with up to 1000 digits of precision and perform calculations exactly. • It is very slow compared to the floating-point

•Syntax: NUMERIC(precision, scale)• decimal :- is equavalent to numeric in sql standard.

Example monetary amounts.

Numeric Types• Data types

•real •double precision these types are usually for Binary Floating-Point ArithmeticPostgreSQL also supports the SQL-standard notations float and float(p)

Example prize_per_room, total_amount, balance_amount etc

Numeric TypesData Type

•serial notational convenience for creating unique identifier columns .

SyntaxCREATE TABLE tablename ( colname SERIAL );

ExampleCREATE TABLE

tbl_customer(pk_bint_cu_id bigint primary key serial);

Character Types

Character Types• character varying(n)– varchar(n)variable-length with limitcharacter(n)– char(n)fixed-length

• Example name,place,email Special Character Types– "char“ :-1 byte

• single-byte internal type

– Name:-64 bytes internal type for object name

Date/Time Types

Date/Time Types

Date/Time Types

Date/Time Types

Date/Time Types

Boolean Type

Monetary Types

Binary Data Types

Boolean Type

Geometric Types

Network Address Types

Network Address Types

Bit String Types

Arrays

Pseudo-Types

If this presentation helped you, please visit our page facebook.com/baabtra and like it.

Thanks in advance.

www.baabtra.com | www.massbaab.com |www.baabte.com

Contact Us

top related