Common SQL Data Types in Database
Simple guide to understand common SQL Data Types in Database like Numeric, String, Date, Binary, and Boolean with practical tips. Learn differences between DBMS systems.
2026-08-23 ยท 4 min read
Hello my friend! Today we learn about SQL Data Types in Database!
When we create table in database, every column must have a Data Type. Data type tell database what kind of value can save into that column. Is it number, text, date, or true/false boolean value?

๐ก Important Note: Different DBMS (Database Management System) like MySQL, PostgreSQL, MS SQL Server, or Oracle have small differences in data type names, but basic concept is very similar!
1. ๐ข Numeric Data Types (Numbers)
Numeric data types are used to store numbers like age, quantity, price, or salary.
A. Exact Numeric Data Types
Store numbers with exact precision (no rounding error):
- TINYINT: Very small integer (0 to 255).
- SMALLINT: Small integer.
- INT / INTEGER: Standard integer number for ID, age, or quantity.
- BIGINT: Large integer number for huge counter or big ID.
- DECIMAL(p, s) / NUMERIC: Exact decimal number for price or money.
B. Approximate Numeric Data Types
Store numbers with floating point precision:
- FLOAT / REAL / DOUBLE: Store decimal number with floating point.
๐ก Tip for Money & Price: For salary or product price, ALWAYS use
DECIMAL(10, 2)orNUMERIC! Do NOT useFLOATfor money becauseFLOATcan cause small decimal rounding calculations error!
2. ๐ค Character & String Data Types (Text)
String data types are used to store names, descriptions, emails, or phone numbers.
A. Regular Character Data Types
- CHAR(n): Fixed length text. If you define
CHAR(10)and type"Sok", it still use 10 spaces. - VARCHAR(n): Variable length text. If you define
VARCHAR(50)and type"Sok", it only use 3 spaces!
B. Unicode Character Data Types
- NCHAR(n): Fixed length Unicode text.
- NVARCHAR(n): Variable length Unicode text. Used for multi-language text like Khmer Unicode characters (
Khmer: แแถแแถแแแแแ).
๐ก Tip for Text & Khmer Font: Use
VARCHAR(50)for normal English text like email or username to save disk space. In MS SQL Server, always useNVARCHARfor Khmer language text so characters don't turn into question marks????!
3. ๐ Date & Time Data Types
Used to store date of birth, order created time, or event schedules.
- DATE: Store date only (
YYYY-MM-DD, example:2026-08-24). - TIME: Store time only (
HH:MM:SS). - DATETIME / TIMESTAMP: Store both date and exact time (
2026-08-24 14:30:00).
๐ก Tip for Date: Use
DATEcolumn for user birthday. UseTIMESTAMPorDATETIMEfor order created time so you know exact minute and second order was placed!
4. ๐พ Binary Data Types
Used to store binary data like images, files, or encrypted hash bytes.
- BINARY / VARBINARY: Store binary bytes data.
- BLOB (Binary Large Object): Store large binary files like images, audio, or PDF documents.
๐ก Tip for Images & Files: Storing big image files directly into database
BLOBcolumn will make database size super big and backup slow! Best practice in real app is save image file to cloud storage (like S3 or CDN), and only save image URL string (VARCHAR) in database table!
5. โ๏ธ Miscellaneous Data Types
Special data types for specific use cases:
- BIT / BOOLEAN: Store
1or0(TRUEorFALSE) for status likeis_activeoris_paid. - JSON: Store structured JSON objects directly inside column (available in PostgreSQL & MySQL).
- XML / CLOB / CURSOR / TABLE: Special types for large text document or stored procedure logic.
๐ก Tip for Boolean Status: For user status like active or inactive, use
BOOLEANorBIT(1)! It is fast and clean.
๐ Data Types Reference by DBMS System
Here are reference charts for data types in different popular database engines:
๐น PL/SQL (Oracle) Data Types

๐น MS SQL Server Data Types

๐น PostgreSQL Data Types

Happy learning database my friend! If you have any question about SQL data types, leave comment below! ๐