TicketMerc/Interfaz/conticket.sql

24 lines
820 B
SQL

CREATE DATABASE IF NOT EXISTS conticket;
USE conticket;
-- Tabla para almacenar los asientos
CREATE TABLE asientos (
id INT AUTO_INCREMENT PRIMARY KEY,
artista VARCHAR(50) NOT NULL, -- Nombre del artista/concierto
dia INT NOT NULL, -- Día del evento (22, 23, 24)
asiento VARCHAR(10) NOT NULL, -- Identificador del asiento (ej: 1A, 2B)
estado ENUM('disponible', 'vendido') DEFAULT 'disponible', -- Estado del asiento
precio DECIMAL(10, 2) NOT NULL
);
-- Tabla para registrar las ventas
CREATE TABLE ventas (
id INT AUTO_INCREMENT PRIMARY KEY,
asiento_id INT NOT NULL, -- ID del asiento vendido
fecha_venta DATETIME DEFAULT CURRENT_TIMESTAMP, -- Fecha y hora de la venta
precio DECIMAL(10, 2) NOT NULL, -- Precio del boleto
FOREIGN KEY (asiento_id) REFERENCES asientos(id)
);