You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Choosing the right data types and designing tables properly is crucial for performance, storage efficiency, and data integrity. This lesson covers SQL Server's data types, constraints, identity columns, and computed columns.
| Data Type | Range | Storage |
|---|---|---|
| TINYINT | 0 to 255 | 1 byte |
| SMALLINT | -32,768 to 32,767 | 2 bytes |
| INT | -2.1 billion to 2.1 billion | 4 bytes |
| BIGINT | -9.2 quintillion to 9.2 quintillion | 8 bytes |
| DECIMAL(p,s) | Fixed precision and scale | 5-17 bytes |
| FLOAT | Approximate, double-precision | 8 bytes |
| REAL | Approximate, single-precision | 4 bytes |
| MONEY | -922 trillion to 922 trillion | 8 bytes |
| SMALLMONEY | -214,748 to 214,748 | 4 bytes |
| BIT | 0, 1, or NULL | 1 bit |
Tip: Use DECIMAL for financial calculations (exact precision). Use FLOAT only for scientific or approximate calculations.
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.