Data types in SQL.
SQL Data types: -
In previous article we read about SQL and related information. If you don't know what is SQL then
Go here
What is SQL?
In this article we are going to discuss about the Data types in SQL. How many data types in SQL.
If you want to know Data types in SQL in a simple way then read full article.
Data types in SQL are following
Exact numeric types: - SQL has the following exact numeric data types. In exact numeric data types we have 9 types:-
1. Int: - The range of int ranges from -2,147,483,648 to +2,147,483,648. It requires storage of 4 bytes.
2. Bigint: - Bigint ranges from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,808. It requires storage of 8 bytes.
3. Smallint: - It ranges from -32,768 to +32,768. It requires storage of 2 bytes.
4. Tinyint: - Its range is from 0 to 255. It requires storage of 1 bytes.
5. Bit: - bit data type ranges from 0 to 1. It requires storage of 1 bytes.
6. Money: - The range of this data type ranges from -922,337,203,685,477.5808 to +922,337,203,685,477.5808. It requires 8 bytes of storage.
7. Smallmoney: - The range of this data type ranges from -214,748.3648 to +214,748.3648. It requires 4 bytes.
8. Decimal: - Its range is from -10 ^ 38 + 1 to + 10 ^ 38 + 1.
9. Numeric: - Its range is also from -10 ^ 38 + 1 to + 10 ^ 38 + 1.
Datetime type: - There are following types of datetime data types in SQL.
1. Date: - This data type stores the value of year, month and day. It requires 3 bytes of storage.
2. Time: - This data type stores the value of hour, minute and second.
3. Smalldatetime: - This data type requires 8 bytes of storage.
Character data type: - There are following types of character data types in SQL.
1. Char
2. Varchar
3. Varchar (max)
4. Text
Unicode character type: - Unicode character are of the following types.
1. nchar
2. nvarchar
3. nvarchar (max)
4. ntext
Binary data type: - There are following types of binary data types in SQL.
1. Binary
2. Varbinary
3. Varbinary (max)
4. Image
Boolean data type: - Boolean data type has only two values true or false.
Leave a Comment