Last time we learned about database hierarchy. Now let's explore what types of information can actually be stored in those columns.
Just like you wouldn't store phone numbers in your calendar app, database columns have specific data types that determine what kind of information they can hold.
Engagement Message
Why might it matter what type of data goes in each column?
Numeric data types store numbers. There are two main categories: integers (whole numbers like 42, 100, -5) and decimals (numbers with decimal points like 19.99, 3.14159).
Integers take less storage space, while decimals can represent precise measurements and prices.
Engagement Message
Would you use an integer or decimal to store a book's price?
Text data types store words, sentences, and characters. The most common are VARCHAR (variable-length text up to a limit) and TEXT (for longer content).
VARCHAR(50) can hold up to 50 characters, while TEXT can hold thousands of characters like full book descriptions.
Engagement Message
Which text type would work better for storing customer names?
Date and time types store when something happened. DATE stores just the day (like 2024-03-15), while DATETIME includes the exact time (2024-03-15 14:30:22).
These types enable powerful date calculations and sorting by chronological order.
Engagement Message
Would you use DATE or DATETIME to track when customers place orders?
Boolean types store simple TRUE or FALSE values. Perfect for yes/no questions like "Is this book available?" or "Has this customer subscribed to emails?"
Many databases represent boolean as 1 (true) or 0 (false).
Engagement Message
What boolean column might be useful in a customer table?
