Common SQL Data Types: by Leonamel Amolo
Common SQL Data Types: by Leonamel Amolo
DATA TYPES
BY; LEONAMEL AMOLO
Sql data • In SQL the columns of a table are
defined to store a specific kind of value
such as numbers, dates, or text; these are
types called data types. With over thirty types
of SQL server data types to choose
from, data types can seem intimidating,
but in reality, there are just a few
commonly used in databases.
• Once you understand data types in
general, it isn’t a complicated subject.
You’ll also come to understand why there
is a need for data types and the reason
there so many varieties.
What are SQL Server Data Types?
• John • 12
• Sue • Twenty three
• Bob • Twenty and four years
• Sally • VIII
• Roque • Otcho
Can you see the issue with these ages?
They’re all in an inconsistent format.
Not only are they hard to read, but
sorting and calculating the data is
difficult. By using SQL Server data
types, which enforce the expected type
of data to be stored, we can achieve a
much better result. Here is the same
table with the ages shown as integers
Name Age
• John • 12
• Sue • 23
• Bob • 24
• Sally •8
• Roque •8
When age is defined as an integer the expectation is data are
entered as whole numbers.
Also, without getting into technical details, you can see storing
the age as an integer takes up much less space than the age in the
first table. This may not seem like a huge consideration with
small databases, but when working with data on smartphones or
“big data” scenarios, these considerations add up.
Once the system understands the data type, it can then sort the
data in an order that makes sense as well as perform calculations.
Thank you!