Member-only story

SQL Data Types: A Comprehensive Guide

btd
2 min readNov 12, 2023

--

SQL (Structured Query Language) supports several data types that allow you to define the type of data that can be stored in a database table. The exact list of data types can vary slightly between database management systems (DBMS) because each DBMS may have its own set of extensions or variations. However, I’ll provide a common list of SQL data types:

1. Numeric Types:

  • INT or INTEGER: Integer type.
  • SMALLINT: Small integer.
  • BIGINT: Large integer.
  • DECIMAL or NUMERIC: Exact numeric with a specified precision and scale.
  • FLOAT: Floating-point number.
  • REAL: Single-precision floating-point number.
  • DOUBLE or DOUBLE PRECISION: Double-precision floating-point number.

2. Character String Types:

  • CHAR(n): Fixed-length character string.
  • VARCHAR(n): Variable-length character string with a maximum length.
  • TEXT: Variable-length character string with no maximum length.

3. Date and Time Types:

  • DATE: Date only.
  • TIME: Time only.
  • DATETIME or TIMESTAMP: Date and time.

--

--

btd
btd

No responses yet