What is SQL data types in SQL Database?

Answer: SQL data types define that what type of data; a column can have in a table in SQL Database. Each column in a table has column name and its data type. Based on the requirement and design of database table, SQL Developer decides what data type, a column should have during creating a table.

For example, an employee table can have multiple columns e.g. employee name and age. So, we need to define data type also for these columns. Hence, employee name and age can be defined as VARCHAR(20) and INT respectively.

Here is how columns definition and their data types looks like

CREATE TABLE Employee (
    EmployeeID int,
    LastName varchar(255),
    FirstName varchar(255),
    Age int,
);

Here are some frequently used SQL Data types examples available in SQL Server.
Varchar(size)

INT ,FLOAT, REAL, BOOLEAN, DATETIME, DATA, TIME, TIMESTAMP, XML etc.

NOTE:

Different database may offer different data types. For example, for an integer data type, Microsoft SQL Server, ORACLE and MYSQL offer as “INT”, “number” and “int integer” respectively.

Related Posts