SQL Database Data Types
DATA TYPES represents the type of data an object is holding. Data Types are defined for columns of a table, local/global variables, input/output arguments of procedures etc..
Each database system (MS SQL Server, MYSQL, DB2, Oracle etc.) have its own long list of data types but several data types are common in most of them. This article will list down common data types across various database systems.
Numeric Data Type
Few numeric data type has syntax of data_type(x). Here x is meant for precision value.
Date Time Data Type
datetime: This data type is used to store complete date and time information. The date to be stored has range from 01/01/1753 to 12/31/9999. This data type takes 8 bit for storage purpose. This data type is also termed as timestamp in few database systems.
date: This data type is used to store only date information.
time: This data type is used to store only time specific information.
Few numeric data type has syntax of data_type(x). Here x is meant for precision value.
String Data Type
char(x): This data type is space padded to fill the number of characters specified. Here x is the number of characters to store.
varchar(x): This type got its name from Varying Characters. This data type doesn’t pad unnecessary space. Here x is the number of characters to store
text: This type is used to store long textual information.
Few numeric data type has syntax of data_type(x). Here x is meant for precision value.
Other Data Type
blob: Binary Large Object. This type is used to store large amount of binary date such as images or other type of files.
money: In few databases also termed as currency. The type is used to storage money/currency information
binary: The data type is used to store information in binary string format.