2024-03-07 05:03:51 +00:00
|
|
|
create database cocina;
|
2024-03-10 22:11:32 +00:00
|
|
|
CREATE USER 'UserRemoto' @'localhost' IDENTIFIED BY 'password123';
|
|
|
|
GRANT ALL PRIVILEGES ON cocina TO 'UserRemoto' @'localhost';
|
|
|
|
FLUSH PRIVILEGES;
|
2024-03-11 14:12:12 +00:00
|
|
|
use cocina;
|
2024-03-07 05:03:51 +00:00
|
|
|
|
|
|
|
drop table usuarios;
|
|
|
|
create table usuarios(
|
|
|
|
nombreUsuario varchar(100) primary key,
|
2024-03-09 05:22:11 +00:00
|
|
|
correo varchar(100),
|
2024-03-07 05:03:51 +00:00
|
|
|
password varchar(100),
|
|
|
|
tipo varchar(100)
|
|
|
|
);
|
|
|
|
|
|
|
|
drop table asiento;
|
|
|
|
create table asiento(
|
|
|
|
id integer auto_increment primary key,
|
2024-03-09 05:22:11 +00:00
|
|
|
nombre_asiento varchar(100),
|
2024-03-11 14:12:12 +00:00
|
|
|
estado boolean,
|
2024-03-09 05:22:11 +00:00
|
|
|
zona_id integer,
|
|
|
|
FOREIGN KEY (zona_id) REFERENCES zona(id)
|
2024-03-07 05:03:51 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
drop table zona;
|
|
|
|
create table zona(
|
2024-03-11 14:12:12 +00:00
|
|
|
id integer auto_increment primary key,
|
|
|
|
precio double
|
2024-03-09 05:22:11 +00:00
|
|
|
);
|
|
|
|
|
2024-03-11 14:12:12 +00:00
|
|
|
drop table compra;
|
2024-03-09 05:22:11 +00:00
|
|
|
create table compra (
|
|
|
|
id integer auto_increment primary key,
|
2024-03-11 14:12:12 +00:00
|
|
|
usuario_id varchar(100),
|
2024-03-09 05:22:11 +00:00
|
|
|
asiento_id integer,
|
2024-03-11 14:12:12 +00:00
|
|
|
zona_id integer,
|
2024-03-09 05:22:11 +00:00
|
|
|
FOREIGN KEY (usuario_id) REFERENCES usuarios(nombreUsuario),
|
2024-03-11 14:12:12 +00:00
|
|
|
FOREIGN KEY (asiento_id) REFERENCES asiento(id),
|
|
|
|
FOREIGN KEY (zona_id) REFERENCES zona(id)
|
2024-03-09 05:22:11 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
INSERT INTO `usuarios`(`nombreUsuario`,`correo`,`password`,`tipo`)VALUES
|
|
|
|
('daniel','dangja9@gmail.com', 'lalelilolu', 'usuario'),
|
|
|
|
('juan','juanlazarorp@gmail.com', 'perrotonto16', 'admin'),
|
|
|
|
('francis','reyes.23.jacome@gmail.com','palapa', 'admin'),
|
|
|
|
('citlali', '2282785651citlali@gmail.com', 'contraseña', 'usuario');
|
|
|
|
|
|
|
|
select * from usuarios;
|
|
|
|
|
2024-03-11 14:12:12 +00:00
|
|
|
INSERT INTO `zona`(`precio`)VALUES
|
|
|
|
(300),
|
|
|
|
(500),
|
|
|
|
(600),
|
|
|
|
(300);
|
2024-03-09 05:22:11 +00:00
|
|
|
|
|
|
|
|
2024-03-11 14:12:12 +00:00
|
|
|
INSERT INTO `usuarios`(`nombreUsuario`, `correo`, `password`, `tipo`) VALUES(?,?,?,?);
|
|
|
|
|
|
|
|
select * from zona;
|
2024-03-09 05:22:11 +00:00
|
|
|
|
2024-03-11 14:12:12 +00:00
|
|
|
INSERT INTO `asiento`(`nombre_asiento`, `estado`, `zona_id`)
|
|
|
|
VALUES
|
|
|
|
("A1",true,1),
|
|
|
|
("A2",true,1),
|
|
|
|
("A3",true,1),
|
|
|
|
("A4",true,1),
|
|
|
|
("A5",true,1),
|
|
|
|
("B1",true,1),
|
|
|
|
("B2",true,1),
|
|
|
|
("B3",true,1),
|
|
|
|
("B4",true,1),
|
|
|
|
("B5",true,1),
|
|
|
|
("C1",true,1),
|
|
|
|
("C2",true,1),
|
|
|
|
("C3",true,1),
|
|
|
|
("C4",true,1),
|
|
|
|
("C5",true,1),
|
|
|
|
("D1",true,1),
|
|
|
|
("D2",true,1),
|
|
|
|
("D3",true,1),
|
|
|
|
("D4",true,1),
|
|
|
|
("D5",true,1),
|
|
|
|
("E1",true,1),
|
|
|
|
("E2",true,1),
|
|
|
|
("E3",true,1),
|
|
|
|
("E4",true,1),
|
|
|
|
("E5",true,1),
|
|
|
|
("F1",true,1),
|
|
|
|
("F2",true,1),
|
|
|
|
("F3",true,1),
|
|
|
|
("F4",true,1),
|
|
|
|
("F5",true,1),
|
|
|
|
("G1",true,1),
|
|
|
|
("G2",true,1),
|
|
|
|
("G3",true,1),
|
|
|
|
("G4",true,1),
|
|
|
|
("G5",true,1),
|
|
|
|
("A1",true,2),
|
|
|
|
("A2",true,2),
|
|
|
|
("A3",true,2),
|
|
|
|
("A4",true,2),
|
|
|
|
("A5",true,2),
|
|
|
|
("A6",true,2),
|
|
|
|
("B1",true,2),
|
|
|
|
("B2",true,2),
|
|
|
|
("B3",true,2),
|
|
|
|
("B4",true,2),
|
|
|
|
("B5",true,2),
|
|
|
|
("B6",true,2),
|
|
|
|
("C1",true,2),
|
|
|
|
("C2",true,2),
|
|
|
|
("C3",true,2),
|
|
|
|
("C4",true,2),
|
|
|
|
("C5",true,2),
|
|
|
|
("C6",true,2),
|
|
|
|
("D1",true,2),
|
|
|
|
("D2",true,2),
|
|
|
|
("D3",true,2),
|
|
|
|
("D4",true,2),
|
|
|
|
("D5",true,2),
|
|
|
|
("D6",true,2),
|
|
|
|
("A1",true,3),
|
|
|
|
("A2",true,3),
|
|
|
|
("A3",true,3),
|
|
|
|
("A4",true,3),
|
|
|
|
("A5",true,3),
|
|
|
|
("B1",true,3),
|
|
|
|
("B2",true,3),
|
|
|
|
("B3",true,3),
|
|
|
|
("B4",true,3),
|
|
|
|
("B5",true,3),
|
|
|
|
("A1",true,4),
|
|
|
|
("A2",true,4),
|
|
|
|
("A3",true,4),
|
|
|
|
("A4",true,4),
|
|
|
|
("A5",true,4),
|
|
|
|
("B1",true,4),
|
|
|
|
("B2",true,4),
|
|
|
|
("B3",true,4),
|
|
|
|
("B4",true,4),
|
|
|
|
("B5",true,4),
|
|
|
|
("C1",true,4),
|
|
|
|
("C2",true,4),
|
|
|
|
("C3",true,4),
|
|
|
|
("C4",true,4),
|
|
|
|
("C5",true,4),
|
|
|
|
("D1",true,4),
|
|
|
|
("D2",true,4),
|
|
|
|
("D3",true,4),
|
|
|
|
("D4",true,4),
|
|
|
|
("D5",true,4),
|
|
|
|
("E1",true,4),
|
|
|
|
("E2",true,4),
|
|
|
|
("E3",true,4),
|
|
|
|
("E4",true,4),
|
|
|
|
("E5",true,4),
|
|
|
|
("F1",true,4),
|
|
|
|
("F2",true,4),
|
|
|
|
("F3",true,4),
|
|
|
|
("F4",true,4),
|
|
|
|
("F5",true,4),
|
|
|
|
("G1",true,4),
|
|
|
|
("G2",true,4),
|
|
|
|
("G3",true,4),
|
|
|
|
("G4",true,4),
|
|
|
|
("G5",true,4);
|