trainingtrains Logo

91-9990449935

 0120-4256464

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
IntegerINTEGERinteger number.
SmallintSMALLINTsmall integer number.
NumericNUMERIC(P,S)where 'p' is precision value and 's' is scale value.
RealREALsingle precision floating point number
DecimalDECIMAL(P,S) where 'p' is precision value and 's' is scale value.
Double precisionDOUBLE PRECISIONdouble precision floating point number
Float FLOAT(P)where 'p' is precision value
CharacterCHAR(X)where 'x' is the character's number to store
Character varyingVARCHAR2(X)where 'x' is the character's number to store
BitBIT(X)where 'x' is the number of bits to store
Bit varyingBIT VARYING(X) '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
TimestampTIMESTAMP it stores year, month, day, hour, minute and second values
Time withTIME WITH exactly same as time but also store an offset from UTC
time zone TIME ZONEof the time specified
timestamp with TIMESTAMP WITH same as timestamp but also stores an offset from UTC of
time zoneTIME ZONEthe time specified.
Next TopicSQL Operators