Javatpoint Logo
Javatpoint Logo

SQL Data Types

The SQL data type defines a kind of value that a column can contain.

In a database table, every column is required to have a name and a data type.

Data Type varies from database to database. For example, MySQL supports INT but Oracle supports NUMBER for integer values.

These are the general data types in SQL.

Data-type Syntax Explanation
IntegerINTEGERThe integer data type is used to specify an integer value.
SmallintSMALLINTThe smallint data type is used to specify small integer value.
NumericNUMERIC(P,S)It specifies a numeric value. Here 'p' is precision value and 's' is scale value.
RealREALThe real integer is used to specify a single precision floating point number.
DecimalDECIMAL(P,S) It specifies a decimal value. Here 'p' is precision value and 's' is scale value.
Double precisionDOUBLE PRECISIONIt specifies double precision floating point number.
Float FLOAT(P)It specifies floating-point value e.g. 12.3, 4.5 etc. Here, 'p' is precision value.
CharacterCHAR(X)Here, 'x' is the character's number to store.
Character varyingVARCHAR2(X)Here, 'x' is the character's number to store
BitBIT(X)Here, 'x' is the number of bits to store
Bit varyingBIT VARYING(X)Here, 'x' is the number of bits to store (length can vary up to x).
DateDATE It stores year, month and days values.
Time TIMEIt stores hour, minute and second values
TimestampTIMESTAMPThe timestamp data type is used to store year, month, day, hour, minute and second values.
Time with time zoneTIME WITH TIME ZONE It is exactly same as time but also store an offset from UTC of the time specified.
Timestamp with time zoneTIMESTAMP with TIME ZONEIt is same as timestamp but also stores an offset from UTC of the time specified.
Next TopicSQL Operators




Please Share

facebook twitter google plus pinterest tumbler

Latest 4 Tutorials