MySQL + SQL · Lesson 34

MySQL Data Types

MySQL Data Types

Every column needs a data type that decides what kind of value it can store. Choosing the right type saves space and prevents errors.

Numeric Types

TypeUse
INTWhole numbers (roll_no, age)
DECIMAL(8,2)Exact money values (fees)
FLOAT/DOUBLEApproximate decimals

String Types

TypeUse
CHAR(n)Fixed length (state code)
VARCHAR(n)Variable length (name, email)
TEXTLong text (remarks)

Date & Time

TypeUse
DATE2026-06-01
DATETIMEDate + time
TIMESTAMPAuto-updated time

Summary

  • Numeric: INT, DECIMAL, FLOAT. String: CHAR, VARCHAR, TEXT. Date: DATE, DATETIME, TIMESTAMP.
  • Use DECIMAL for money, VARCHAR for names.
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

WhatsApp