Data Types in MySQL

Every MySQL column has a data type. The type determines what values the column can store, how MySQL interprets them, and how much storage or precision is available.

CREATE TABLE product (
    id INT UNSIGNED NOT NULL AUTO_INCREMENT,
    name VARCHAR(100) NOT NULL,
    price DECIMAL(10,2) NOT NULL,
    created_at DATETIME NOT NULL,
    PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

Main MySQL data-type groups

GroupExamplesTypical use
NumericINT, BIGINT, DECIMAL, FLOAT, DOUBLECounts, IDs, prices, measurements
Date & timeDATE, TIME, DATETIME, TIMESTAMP, YEARDates, timestamps, durations
Character/textCHAR, VARCHAR, TEXTNames, descriptions, text
BinaryBINARY, VARBINARY, BLOBRaw bytes and binary objects

Choose the narrowest type that correctly represents the values you need. For exact money-like values, prefer DECIMAL rather than approximate floating-point types.




Subscribe to our YouTube Channel here



plus2net.com




SQL Video Tutorials










✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer