SQL Data Types in DBMS
SQL Data Types in DBMS
In DBMS, SQL data types define the kind of value that can be
stored in a table column. Each column must be declared with an
appropriate data type. The main categories are:
1. Numeric Data Types:
- INT / INTEGER: Whole numbers (e.g., 100, -5)
- SMALLINT / BIGINT: For smaller or larger integers
- DECIMAL(p,s) / NUMERIC(p,s): Fixed-point numbers
- FLOAT / REAL / DOUBLE: Decimal numbers (approximate)
2. Character/String Data Types:
- CHAR(n): Fixed-length text
- VARCHAR(n): Variable-length text
- TEXT: Long text like paragraphs
3. Date and Time Data Types:
- DATE: Stores date (YYYY-MM-DD)
- TIME: Stores time (HH:MM:SS)
- DATETIME / TIMESTAMP: Stores date and time together
4. Boolean Data Type:
- BOOLEAN: TRUE, FALSE or NULL
SQL Data Types in DBMS
5. Binary Data Types:
- BINARY / VARBINARY: Binary strings
- BLOB: Large binary files (e.g., images)
These types ensure data integrity and efficient data handling in
SQL-based databases.