
π Late Night Chronicles: #4 Understanding MySQL Data Types
In the previous post, we explored SQL basics and how we interact with databases. But hereβs π π What kind of data can we actually store in MySQL? Thatβs where Data Types come in. πΉ What are Data Types? Data types define what kind of value a column can store . Think of it like rules: Name β text Age β number Date β date Without data types, data would become messy and inconsistent. πΉ Types of Data in MySQL MySQL mainly supports: π Character (String) types π’ Numeric types π Date & Time types πΌοΈ Binary / Large Object types πΉ 1. Character (String) Data Types Used to store text values π CHAR(n) Fixed length Faster retrieval Wastes space VARCHAR(n) Variable length Saves space Slightly slower than CHAR π Example use cases: Name Address City πΉ 2. TEXT Data Types Used for large text data TINYTEXT β up to 255 characters TEXT β up to 65,535 characters MEDIUMTEXT β up to 16 MB LONGTEXT β up to 4 GB π‘ Stored outside the table (uses pointer internally) π Used for: Comments Reviews Resume Feedback πΉ 3
Continue reading on Dev.to
Opens in a new tab
