Overview
Theprenda table is the central entity in the TiendaRopa database, representing individual clothing products. Each record stores a unique combination of product name, category, size, and color, along with current pricing and stock levels.
Table Name: prendaEngine: InnoDB
Character Set: utf8mb4
Primary Key:
id_prenda
Table Structure
Column Definitions
Primary key identifier for the garment. Auto-increments on insert.
Product name or description. Examples: “Camisa Oxford Slim”, “Vestido de Gala Rojo”
Current selling price in Mexican pesos. Precision: 10 digits total, 2 decimal places.
Current inventory quantity. Defaults to 0 if not specified. Updated by
movimiento_stock transactions.Foreign key reference to
categoria.id_categoria. Defines product category (Caballero, Dama, etc.).Foreign key reference to
talla.id_talla. Specifies size variant (ch, m, g, ech, eg).Foreign key reference to
color.id_color. Specifies color variant (Negro Nocturno, Blanco Pureza, etc.).CREATE TABLE Statement
Indexes
| Index Name | Type | Columns | Purpose |
|---|---|---|---|
PRIMARY | PRIMARY KEY | id_prenda | Unique identifier |
fk_prenda_talla | INDEX | id_talla | Foreign key lookup |
fk_prenda_color | INDEX | id_color | Foreign key lookup |
idx_prenda_nombre | INDEX | nombre | Product name searches |
idx_prenda_cat_talla | COMPOSITE | id_categoria, id_talla | Category + size filtering |
Foreign Key Relationships
Parent Tables (Referenced)
categoria
Constraint:
Column:
fk_prenda_catColumn:
id_categoria → categoria.id_categoriatalla
Constraint:
Column:
fk_prenda_tallaColumn:
id_talla → talla.id_tallacolor
Constraint:
Column:
fk_prenda_colorColumn:
id_color → color.id_colorChild Tables (Referencing)
movimiento_stock
Tracks inventory movements for this product
actualizacion
Records price change history
registro
Links products to suppliers
Sample Data
Example Records Explained
Record 1
Camisa Oxford Slim - Men’s slim-fit Oxford shirt
Price: $450.00 MXN | Stock: 25 units
Category: Caballero (1) | Size: M (2) | Color: Azul Marino (3)
Price: $450.00 MXN | Stock: 25 units
Category: Caballero (1) | Size: M (2) | Color: Azul Marino (3)
Record 3
Vestido de Gala Rojo - Red formal gala dress
Price: $1,350.00 MXN | Stock: 10 units
Category: Dama (2) | Size: M (2) | Color: Rojo Pasión (4)
Price: $1,350.00 MXN | Stock: 10 units
Category: Dama (2) | Size: M (2) | Color: Rojo Pasión (4)
Record 22
Chaqueta Cuero Sintético - Synthetic leather jacket
Price: $1,200.00 MXN | Stock: 8 units (low stock)
Category: Caballero (1) | Size: G (3) | Color: Negro Nocturno (1)
Price: $1,200.00 MXN | Stock: 8 units (low stock)
Category: Caballero (1) | Size: G (3) | Color: Negro Nocturno (1)
Common Queries
Get Products with Full Details
Low Stock Alert (< 15 units)
Products by Category and Price Range
Total Inventory Value
Business Rules
Variant Management: The same product name can exist multiple times with different combinations of size, color, or category. Each combination gets a unique
id_prenda.