Tables are where your data actually lives. A well-designed CREATE TABLE statement defines each column's type and rules, so bad data never enters your analytics pipeline in the first place.
Key Points
- Define columns with name + data type: customer_name VARCHAR(100)
- Add a PRIMARY KEY, usually id INT AUTO_INCREMENT
- Use NOT NULL for mandatory fields and DEFAULT for automatic values
- Add FOREIGN KEY constraints to connect related tables
- Inspect any table's structure later with DESCRIBE table_name;
- Clone a structure quickly with CREATE TABLE new_t LIKE old_t;
Example: CREATE TABLE customers (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, city VARCHAR(50), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
.png)