Overview
Theempleado table maintains employee records for staff members who perform operations within the system. It tracks basic employee information and role assignments, serving as a key audit trail component by linking employees to inventory movements, price updates, and product registrations.
Table Name: empleadoEngine: InnoDB
Character Set: utf8mb4
Primary Key:
id_empleado
Table Structure
Column Definitions
Primary key identifier for the employee. Auto-increments on insert.
Full name of the employee. Format: First name + Last name(s).
Job position or role. Values: “gerente” (manager) or “empleado” (employee/staff).
CREATE TABLE Statement
Indexes
| Index Name | Type | Columns | Purpose |
|---|---|---|---|
PRIMARY | PRIMARY KEY | id_empleado | Unique identifier |
Foreign Key Relationships
Child Tables (Referencing)
Theempleado table is referenced by three operational tables, establishing accountability for all system transactions:
movimiento_stock
Constraint:
Tracks which employee performed each stock movement
fk_mov_empTracks which employee performed each stock movement
actualizacion
Constraint:
Records which employee authorized each price change
fk_act_empRecords which employee authorized each price change
registro
Constraint:
Identifies which employee registered each new product
fk_reg_empIdentifies which employee registered each new product
Sample Data
Employee Profiles
Karina Sánchez (ID: 1)
Position: Gerente (Manager)
Responsibilities: Price updates, product registrations, inventory adjustments
Activity: High volume of actualizaciones and registros
Responsibilities: Price updates, product registrations, inventory adjustments
Activity: High volume of actualizaciones and registros
Miguel Esparza (ID: 2)
Position: Empleado (Staff)
Responsibilities: Stock entries, routine inventory movements
Activity: Primarily entrada (stock receiving) operations
Responsibilities: Stock entries, routine inventory movements
Activity: Primarily entrada (stock receiving) operations
Kennia De luna (ID: 3)
Position: Gerente (Manager)
Responsibilities: Stock exits, sales transactions
Activity: Focus on salida operations
Responsibilities: Stock exits, sales transactions
Activity: Focus on salida operations
Mariana Juárez (ID: 4)
Position: Gerente (Manager)
Responsibilities: Price management, inventory oversight
Activity: Mix of updates and adjustments
Responsibilities: Price management, inventory oversight
Activity: Mix of updates and adjustments
Guadalupe Hernández (ID: 5)
Position: Empleado (Staff)
Responsibilities: Stock movements, routine operations
Activity: General movimiento_stock transactions
Responsibilities: Stock movements, routine operations
Activity: General movimiento_stock transactions
Role Types
Gerente (Manager)
- Authorization Level: High
- Typical Operations:
- Price updates (
actualizacion) - Inventory adjustments
- Product registrations
- Supplier management
- Price updates (
- Count: 3 managers in sample data
Empleado (Staff)
- Authorization Level: Standard
- Typical Operations:
- Stock entries (receiving)
- Stock exits (sales)
- Routine inventory movements
- Count: 2 staff members in sample data
Common Queries
Employee Activity Summary
Stock Movement Activity by Employee
Recent Activity by Employee
Manager Performance Report
Employees by Role with Operation Counts
Business Rules
Role-Based Access: The
puesto field can be used to implement role-based access control (RBAC) in the application layer:gerente: Full access to price updates, registrations, and adjustmentsempleado: Limited to stock entries/exits