🧩 SQL Data Types

Last Updated: January 2026


SQL Data Types define what kind of data a column can store. They help the database:

  • store data efficiently
  • validate input values
  • improve performance

Hinglish Tip 🗣: Data type column ka rule hota hai — kaunsa data allowed hai aur kaunsa nahi.


🗂️ Main Categories of SQL Data Types

CategoryPurpose
NumericStore numbers
Character / StringStore text values
Date & TimeStore date and time
BooleanStore true / false values
BinaryStore binary data
SpecialStore JSON,UUIDs,etc

🔢 Numeric Data Types

Used to store numbers.

Data TypeDescriptionRangeExample
INT / INTEGERWhole numbers-2147483648 to 214748364710, -5
SMALLINTSmaller range integers-32768 to 3276732000
TINYINTVery small integers0 to 255124
BIGINTVery large integers-9223372036854775808 to 92233720368547758079000
DECIMAL(p,s)Exact decimal valuesCustom rangeDECIMAL(5,2)
FLOAT / DOUBLEApproximate decimal values-3.4E+38 to 1.7E+3898.76

🔤 Character / String Data Types

Used to store text.

Data TypeDescriptionExample
CHAR(n)Fixed-length stringCHAR(5) → 'Amit '
VARCHAR(n)Variable-length stringVARCHAR(20) → 'Rahul'
TEXTLarge text dataDescription, comments
NVARCHAR(n)Unicode variable-length string (Hindi)NVARCHAR(20) → 'राहुल'
NCHAR(n)Unicode fixed-length string (Hindi)NCHAR(5) → 'राहुल'
LONGTEXTLarge text data (Unicode)Description, comments

Hinglish Tip 🗣: > CHAR fixed size leta hai, VARCHAR sirf jitna text ho utna hi space use karta hai.


📅 Date & Time Data Types

Used to store dates and time values.

Data TypeDescriptionRangeExample
DATE(YYYY-MM-DD)Stores date1000-01-01 to 9999-12-312026-01-07
TIME(HH:MM:SS)Stores time00:00:00 to 23:59:5914:30:00
DATETIME(YYYY-MM-DD HH:MM:SS)Date and time1000-01-01 00:00:00 to 9999-12-31 23:59:592026-01-07 14:30
TIMESTAMP(YYYY-MM-DD HH:MM:SS)Auto-updated date & time according to zone1970-01-01 00:00:01 to 2038-01-19 23:59:59 UTCSystem generated
YEAR Stores year1901 to 21552026
CURRENT_DATECurrent dateSystem generatedSystem generated
CURRENT_TIMECurrent timeSystem generatedSystem generated
CURRENT_TIMESTAMP/NOWCurrent date & timeSystem generatedSystem generated

✅ Boolean Data Type

Used to store true or false values.

Data TypeDescriptionStored As
BOOLEAN / BOOLLogical true or falseTRUE / FALSE
BITBinary 1 or 00 / 1

Binary Data Types

Used to store binary data like images, files, etc.

Data TypeDescriptionStored As
BLOBBinary large objectBinary data file,image etc
BINARYFixed-length binary dataBinary data

Special Data Types

Data TypeDescriptionExample
ENUMStores a set of possible valuesEnum('red', 'green', 'blue')
GEOMETRYStores geometric dataPOINT(1 2)
JSONStores key value data{"name": "Rahul"}
XMLStores Markup data<h1>Rahul</h1>
UUIDStores unique identifierUUID()