Number data types in SQL

In this chapter you will learn:

What is number data type?

Types of number data type

What is number data type?

The data type which store the value in the form of number, integer, decimal etc. is called number data type. Here you will get some number data types that are used to store different kinds of numeric data in sql.

Data types

Range

Used to store

Storage (Bytes)

int

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

Integer data (whole numbers)

4

smallint

(-32,768) to (32,767)

Integer data

2

tinyint

0 to 255

Integer data

1

bigint

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

Integer data

8

decimal

-10^38 +1 to 10^38 -1

Numeric data types with a fixed precision and scale

5 to 17

numeric

-10^38 +1 to 10^38 -1

Numeric data types with a fixed precision and scale

5 to 17

float

-1.79E+308 to -2.23E-308, 0 and 2.23E-308 to 1.79E+308

Floating Precision data

4 to 8

money

(-922,337,203,685,477.5808) to (922,337,203,685,477.5807)

Monetary data

8

smallmoney

(-214,748.3648) to (214,748.3647)

Monetary data

4

real

-3.40E + 38 to 3.40E + 38

Floating precision number

4

SUMMARY

In this chapter we have learned about numeric data types and types of numeric data. In the next chapter we will study about date data type and also we will know about types of date data type.