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
| Database System | Support Status | Since Version | Notes |
|---|---|---|---|
| MySQL | Native | 8.0 | MySQL supports standard numeric types with varying precision defaults. |
| PostgreSQL | Native | 9.1 | PostgreSQL has precise control over numeric type precision and scale. |
| SQL Server | Native | 2016 | SQL Server supports a range of numeric types with user-definable precision. |
| Oracle | Native | 12c | Oracle has flexible support for various numeric types and can handle high precision arithmetic. |
| SQLite | Native | 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: Native since 8.0
PostgreSQL: Native since 9.1
SQL Server: Native since 2016
Oracle: Native since 12c
SQLite: Native since 3.0