Home Tutorials SQL Tutorial Common Data Types
Common Data Types

Common Data Types


Common SQL Data Types

Definition: A data type is a label that tells the database what kind of information to expect in a specific column. Every column in a SQL table must have a defined data type.

Why: Beginner tutorials focus on these core types because they cover 90% of everyday data needs. Using the correct data type ensures data integrity, saves storage space, and allows the database to perform mathematical operations or date calculations correctly.


Most Common Data Types

Below are the foundational data types you will encounter in almost every SQL database:

Category Data Type Description & Usage
Numeric INT Stores whole numbers (integers) without decimals. Used for IDs, ages, and quantities.
Text VARCHAR(size) Stores variable-length text. The "size" represents the maximum number of characters (e.g., VARCHAR(255)).
Numeric DECIMAL(p,s) Used for exact numbers with decimals, like money or percentages. p is the total digits, s is digits after the decimal.
Temporal DATE Stores dates in the format YYYY-MM-DD. Used for birthdays, order dates, or deadlines.
Boolean BOOLEAN Stores TRUE or FALSE values. Used for flags like "is_active" or "has_paid".

Key Notes

  • VARCHAR vs. CHAR: VARCHAR only uses the space needed for the text you enter, while CHAR uses a fixed amount of space even if the text is shorter. VARCHAR is generally preferred for names and descriptions.
  • Precision Matters: Choosing INT when you actually need decimals (like 19.99) will cause the database to round your numbers, leading to data errors.
  • Database Variation: While these types are standard, some databases have slightly different names (e.g., TEXT in some systems is used for very long descriptions instead of VARCHAR).

🏋️ Test Yourself With Exercises

Take our quiz on Common Data Types to test your knowledge.

Browse Quizzes »