Loading Data Driven Insights
Preparing your learning content.
Preparing your learning content.
A beginner-friendly guide to SQL data types, why they matter, common data type groups, and how to use SQL Server data types when creating table columns.
On this page
Jump to a lesson section
Data types tell SQL what kind of value a column can store.
A column for a salary should store a number. A column for a name should store text. A column for a date should store a date value.
Data types keep data clean, accurate, and easier to query.
They also help SQL Server store values correctly and work with them efficiently.
A salary should be stored as a number, not text.
A date of birth should be stored as a date, not a normal sentence.
Different SQL data types store different kinds of values.
The exact data type names can vary between database systems, but the main idea stays the same.
Aa Text
Names, emails, departments123 Number
Age, salary, quantity1.23 Decimal
Price, tax, percentage▦ Date / Time
DOB, order date, login time✓ Boolean / Bit
Active, approved, completedBIT.When you create a table, each column should be assigned a suitable data type.
This helps SQL Server understand what kind of values each column is expected to store.
CREATE TABLE Employees (
employee_id INT,
employee_name VARCHAR(100),
salary DECIMAL(10, 2),
hire_date DATE,
is_active BIT
);
INT stores whole numbers.VARCHAR stores text.DECIMAL stores money-like or precise number values.DATE stores dates.BIT stores 0 or 1.After creating the table, the values should match the data types chosen for each column.
In this example:
employee_id stores whole numbers.employee_name stores text.salary stores decimal values.hire_date stores date values.is_active stores 1 for true and 0 for false.SQL Roadmap Progress
Topic 5 of 111
5% complete
Next in SQL Roadmap
Continue with the next SQL topic in the recommended roadmap order.
Continue learning →