Precision differences between numeric types in SQL databases.

Store integers of varying range: SMALLINT (16-bit), INT (32-bit), BIGINT (64-bit). Choose based on expected data range to balance storage and precision. Unsigned variants double the range but are not standard SQL.

Compatibility

Show:
Database System Support Status Since Version Notes
MySQL ✓ Supported 8.0 MySQL supports standard numeric types with varying precision defaults.
PostgreSQL ✓ Supported 9.1 PostgreSQL has precise control over numeric type precision and scale.
SQL Server ✓ Supported 2016 SQL Server supports a range of numeric types with user-definable precision.
Oracle ✓ Supported 12c Oracle has flexible support for various numeric types and can handle high precision arithmetic.
SQLite ✓ Supported 3.0 SQLite supports INTEGER and REAL storage classes natively. It uses type affinity rather than strict enforcement — NUMERIC affinity will attempt to store values as integer or real.

Details

Understanding the differences in how numeric data is handled across different SQL engines can prevent silent data loss or precision issues.

Standard Syntax

Version Support

MySQL: Since 8.0 PostgreSQL: Since 9.1 SQL Server: Since 2016 Oracle: Since 12c SQLite: Since 3.0

Per-Database Syntax & Notes