SQL Data Type
SQL Data Type
Topperworld.in
Data Types
• Data types are used to represent the nature of the data that can be stored in
the database table. For example, in a particular column of a table, if we want
to store a string type of data then we will have to declare a string data type
of this column.
• An SQL developer must be aware of what type of data will be stored inside
each column while creating a table.
• The data type guideline for SQL is to understand what type of data is
expected inside each column and it also identifies how SQL will interact with
the stored data.
For every database, data types are primarily classified into three categories.
1) Numeric Datatypes
2) Date and Time Database
3) String Database
There are nine subtypes which are given below in the table. The table
contains the range of data in a particular type.
©Topperworld
SQL
-263 (- 263 -1
BigInt
9,223,372,036,854,775,808) (9,223,372,036,854,775,807)
bit 0 1
©Topperworld
SQL
The subtypes of this datatype are given in the table with the range.
©Topperworld
SQL
©Topperworld
SQL
There are four subtypes of this datatype which are given below:
Datatypes Description
©Topperworld
SQL
A data type is used to store both the data,date, and time in the
DATETIME
record.
XML Datatype
DataType Description
Spatial Dataype
A datatype is used for storing planar spatial data, such as points, lines, and
polygons, in a database table.
©Topperworld
SQL
DataType Description
Array Datatype
SQL Server does not have a built-in array datatype. However, it is possible
to simulate arrays using tables or XML data types.
Datatype Properties
Date and time These are used to store date and time values. Examples
data types include DATE, TIME, and TIMESTAMP
©Topperworld
SQL
Datatype Properties
Binary data These are used to store binary data, such as images or
types audio files. Examples include BLOB and BYTEA.
Boolean data This data type is used to store logical values. The only
type possible values are TRUE and FALSE.
XML data type This data type is used to store XML data.
©Topperworld