Monday, July 8, 2024

SQL DATA TYPES AND SIZES

  


 

DATATYPES AND SIZES

 Meaning

VARCHAR2(65535)

Means you can save 200 characters in the column

 

The maximum length for a VARCHAR2 column is 32,767 bytes or 8,168 characters. However, the maximum length can be increased to 4,000 bytes if

varchar2

  VARCHAR2 field is 65,535 characters

The NVARCHAR(MAX) type, which can store more than 2 GB of data in traditional SQL Server

 

Decimal(5,2)

means you can save an amount of 7 digits ( 5 digits before dot and 2 after dot

Decimal(64,2) is max

 INT

 -2,147,483,648 to 2,147,483,647

 

whether you give int or int(4) are sameQ

 STRING    (8000)

 Use n to define the string size in bytes and can be a value from 1 through 8,000, or use max to indicate a column constraint size up to a maximum storage of 2^31-1 bytes (2 GB)

 

DATATYPE

Example

Meaning

Min max values

Size in bytes

bigint

bigint

 

-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

8 bytes

int

int

stores values >

-2,147,483,648 to 2,147,483,647

4 bytes

smallint

smallint

 

-32,768 to 32,767

2 bytes

tinyint

tinyint

 

0 to 255

1 byte

 

No comments:

Post a Comment

Bank dm data model diagram and sql

  -- MySQL Script generated by MySQL Workbench -- Thu May  8 12:17:48 2025 -- Model: New Model    Version: 1.0 -- MySQL Workbench Forward En...