Set your Publisher ID in src/config/ads.ts to display live ads.
MySQL Introduction & Data Types
MySQL is an open-source Relational Database Management System (RDBMS) developed by Oracle, renowned for extreme query speed, reliability, and widespread deployment.
Relational Architecture & Schema Design
A relational database organizes data into rows and columns within strictly defined tables. Each table has a defined schema that enforces data integrity, primary keys, and relationships via foreign keys.
Data is structured according to normalized entity schemas to prevent redundant data duplication.
CREATE DATABASE IF NOT EXISTS codexia_store;
USE codexia_store;
CREATE TABLE Users (
UserID INT AUTO_INCREMENT PRIMARY KEY,
Username VARCHAR(50) NOT NULL UNIQUE,
Email VARCHAR(100) NOT NULL UNIQUE,
AccountBalance DECIMAL(10, 2) DEFAULT 0.00,
CreatedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB;Core MySQL Data Types
Choosing optimal data types reduces disk consumption and dramatically speeds up in-memory buffer indexing:
| Category | Data Type | Storage Size | Ideal Use Case |
|---|---|---|---|
| Integer | INT / BIGINT | 4 / 8 Bytes | Primary keys, quantities, counters |
| Decimals | DECIMAL(M, D) | Variable | Exact currency & financial amounts (no floating-point drift) |
| Strings | VARCHAR(N) | Length + 1 Byte | Usernames, emails, addresses up to N chars |
| Timestamp | TIMESTAMP | 4 Bytes | Automatic record creation/update timestamps |
Set your Publisher ID in src/config/ads.ts to display live ads.
Test Yourself With Exercise
Which MySQL data type should always be used for storing financial currency values to avoid floating-point approximation errors?