SQL Data Types -My SQL, SQL Server, and MS Access

.
 Data Types in SQL (SQL Data Types) - MySQL, SQL Server, and MS Access 

What are SQL Data types?
In SQL data types are used to represent the nature of the column means what value the column holds integer, character, money, date and time, binary, and so on. In a database, each column is required to have a name and data type.

Example: In a Name column of a Student table, if we want to store only Name have alphabet then we will have to declare a string data type of this column.

Types of Data Type in SQL 
Data types are mainly classified into three categories for every database. 
  • String Data types 
  • Numeric Data types 
  • Date and Time Data types

My SQL Data Types

String Data Type 
  • CHAR(size) 
  • VARCHAR(size) 
  • BINARY(size) 
  • VARBINARY(size) 
  • TINYBLOB 
  • TINYTEXT 
  • TEXT(size) 
  • BLOB(size) 
  • MEDIUMTEXT 
  • MEDIUMBLOB 
  • LONGTEXT 
  • LONGBLOB 
  • ENUM(val1, val2, val3, ...) 
  • SET(val1, val2, val3, ...)
Numeric Data Type 
  • BIT(size) 
  • TINYINT(size) 
  • BOOL 
  • BOOLEAN 
  • SMALLINT(size) 
  • MEDIUMINT(size) 
  • INT(size) 
  • INTEGER(size) 
  • BIGINT(size) 
  • FLOAT(size, d) 
  • FLOAT(p) 
  • DOUBLE(size, d) 
  • DOUBLE PRECISION(size, d) 
  • DECIMAL(size, d) 
  • DEC(size, d)
Date and Time Date Type
  • DATE 
  • DATETIME(fsp)
  • TIMESTAMP(fsp)
  • TIME(fsp)
  • YEAR

SQL Server Data Types

String Data Type 
  • char(n)
  • varchar(n)
  • varchar(max)
  • text
  • nchar
  • nvarchar
  • nvarchar(max)
  • ntextbinary(n)
  • varbinaryvarbinary(max)
  • image
Numeric Data Types
  • bit
  • tinyint
  • smallint
  • int
  • bigint
  • decimal(p,s)
  • numeric(p,s)
  • smallmoney
  • money
  • float(n)
  • real
Date and Time Data Type
  • datetime
  • datetime2
  • smalldatetime
  • date
  • time
  • datetimeoffset
  • timestamp


Hope !!! The above Tutorial on SQL data type is helpful for you...

Team, 
QA acharya

Data Type in SQL With Example

Post a Comment

0 Comments