color table stores available color options for clothing items. Colors are referenced by products through the id_color foreign key, providing consistent color naming across the inventory.
Table Structure
Primary key - Auto-incrementing unique identifier for each color
Color name (e.g., “Negro Nocturno”, “Azul Marino”, “Rojo Pasión”)
SQL Definition
TiendaRopa.sql
Sample Data
The database includes these default color options:Negro Nocturno
ID: 1 - Deep black color
Blanco Pureza
ID: 2 - Pure white color
Azul Marino
ID: 3 - Navy blue color
Rojo Pasión
ID: 4 - Passionate red color
Gris Oxford
ID: 5 - Oxford gray color
Relationships
Referenced By
prenda Table
Products reference colors through
id_color foreign keyCommon Queries
List All Colors
Products by Color
Color Popularity
Usage in Application
Colors are managed throughcolores.php:
- Create: Add new colors with custom names
- Update: Edit existing color names via modal dialog
- View: Display all colors in a sortable table
Colors cannot be deleted if they are referenced by existing products due to foreign key constraints. This prevents data integrity issues.
Business Rules
- Unique Names: While not enforced by database constraint, avoid duplicate color names for clarity
- Descriptive Names: Use evocative color names (e.g., “Negro Nocturno” instead of just “Negro”)
- Consistency: Maintain consistent naming conventions across all colors
- Language: Color names are stored in Spanish to match the application locale
Extension Possibilities
Color Codes
Color Codes
Add a
codigo_hex column to store hexadecimal color codes for visual representation in the UI:Color Categories
Color Categories
Group colors by category (warm, cool, neutral) for filtering:
Seasonal Colors
Seasonal Colors
Track which colors are available in specific seasons:
Related Documentation
prenda Table
Product catalog that references colors
Catalog Management
Using the color management interface
Database Relationships
Foreign key relationships overview
Managing Categories
User guide for catalog management