Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create database circo;
- use circo;
- create table usuario(
- idUsuario smallint not null auto_increment,
- nombreUsuario varchar(50) not null,
- apellidoUsuario varchar(50) not null,
- cedulaUsuario varchar(10) not null,
- edadUsuario date not null,
- userUsuario varchar(50) not null,
- passwordUsuario varchar(50) not null,
- Primary key(idUsuario)
- );
- create table direccion(
- idDireccion smallint not null auto_increment,
- nombreDireccion varchar(50) not null,
- Primary key(idDireccion)
- );
- INSERT INTO direccion (nombreDireccion) VALUES
- ('Malecón Simón Bolívar'),
- ('Cdla. Kennedy'),
- ('Urdesa Central'),
- ('Sauces 8'),
- ('La Alborada'),
- ('Centro de Guayaquil'),
- ('Los Ceibos');
- create table evento(
- idEvento smallint not null auto_increment,
- nombreEvento varchar(50) not null,
- fechaEvento date not null,
- horaInicioEvento time not null,
- cantidadPersonasEvento smallint not null,
- idDireccion smallint not null,
- Primary key(idEvento),
- foreign key(idDireccion) references direccion(idDireccion)
- on delete restrict
- on update cascade
- );
- INSERT INTO evento (nombreEvento, fechaEvento, horaInicioEvento, cantidadPersonasEvento, idDireccion) VALUES
- ('Malabarismo', '2024-02-05', '18:00:00', 500, 1),
- ('Payaso Show', '2024-02-08', '15:30:00', 300, 2),
- ('Acrobacias Estelar', '2024-03-12', '15:45:00', 700, 3),
- ('Magia Mística', '2024-03-15', '17:00:00', 200, 4),
- ('Un Show de Circo', '2024-03-18', '10:15:00', 300, 5),
- ('Circo Infantil Aventuras', '2024-01-22', '14:00:00', 200, 6),
- ('Trapecistas Show', '2024-03-25', '16:30:00', 300, 7),
- ('Circo Emoción', '2024-03-28', '15:00:00', 450, 1),
- ('Show Circo', '2024-03-29', '11:00:00', 180, 3),
- ('Circo Musical', '2024-04-26', '13:30:00', 200, 2);
- create table localidad(
- idLocalidad smallint not null auto_increment,
- nombreLocalidad varchar(50) not null,
- precioLocalidad float not null,
- Primary key(idLocalidad)
- );
- INSERT INTO localidad (nombreLocalidad, precioLocalidad) VALUES
- ('Platea VIP', 30.50),
- ('Platea Preferencial', 25.00),
- ('Tribuna Central', 20.00),
- ('Tribuna Lateral', 15.50),
- ('Palco VIP', 40.00),
- ('Palco Lateral', 35.00),
- ('Gradas Frontales', 18.00),
- ('Gradas Laterales', 16.50),
- ('Gradas Superiores', 22.00),
- ('Gradas Inferiores', 12.00);
- create table eventoLocalidad(
- idEventoLocalidad smallint not null auto_increment,
- idEvento smallint not null,
- idLocalidad smallint not null,
- cantidadPorEventoLocalidad smallint not null,
- Primary key(idEventoLocalidad),
- foreign key(idEvento) references evento(idEvento)
- on delete restrict
- on update cascade,
- foreign key(idLocalidad) references localidad(idLocalidad)
- on delete restrict
- on update cascade
- );
- INSERT INTO eventoLocalidad (idEvento, idLocalidad, cantidadPorEventoLocalidad) VALUES
- (1, 1, 200),
- (1, 2, 150),
- (1, 3, 150),
- (2, 4, 100),
- (2, 5, 200),
- (3, 6, 250),
- (3, 7, 450),
- (4, 8, 120),
- (4, 9, 80),
- (5, 10, 300),
- (6, 1, 150),
- (6, 2, 50),
- (7, 3, 180),
- (7, 4, 120),
- (8, 5, 250),
- (8, 6, 200),
- (9, 7, 100),
- (9, 8, 80),
- (10, 9, 120),
- (10, 10, 80);
- create table descuento(
- idDescuento smallint not null auto_increment,
- tipoDescuento varchar(100) not null,
- porcentajeDescuento smallint not null,
- Primary key(idDescuento)
- );
- INSERT INTO descuento (tipoDescuento, porcentajeDescuento)
- VALUES ('Edad', 5);
- INSERT INTO descuento (tipoDescuento, porcentajeDescuento)
- VALUES ('Discapacidad', 10);
- create table entrada(
- idEntrada smallint not null auto_increment,
- idEvento smallint not null,
- cantidadPersonasEntrada smallint not null,
- Primary key(idEntrada),
- foreign key(idEvento) references evento(idEvento)
- on delete restrict
- on update cascade
- );
- create table factura(
- idFactura smallint not null auto_increment,
- fechaFactura date not null,
- idUsuario smallint not null,
- idEntrada smallint not null,
- descripcionFactura text not null,
- totalFactura float not null,
- Primary key(idFactura),
- foreign key(idUsuario) references usuario(idUsuario)
- on delete restrict
- on update cascade,
- foreign key(idEntrada) references entrada(idEntrada)
- on delete restrict
- on update cascade
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement