166 lines
3.0 KiB
SQL
166 lines
3.0 KiB
SQL
create database cocina;
|
|
CREATE USER 'UserRemoto' @'localhost' IDENTIFIED BY 'password123';
|
|
GRANT ALL PRIVILEGES ON cocina TO 'UserRemoto' @'localhost';
|
|
FLUSH PRIVILEGES;
|
|
use cocina;
|
|
|
|
drop table usuarios;
|
|
create table usuarios(
|
|
nombreUsuario varchar(100) primary key,
|
|
correo varchar(100),
|
|
password varchar(100),
|
|
tipo varchar(100)
|
|
);
|
|
|
|
drop table asiento;
|
|
create table asiento(
|
|
id integer auto_increment primary key,
|
|
nombre_asiento varchar(100),
|
|
estado boolean,
|
|
zona_id integer,
|
|
FOREIGN KEY (zona_id) REFERENCES zona(id)
|
|
);
|
|
|
|
drop table zona;
|
|
create table zona(
|
|
id integer auto_increment primary key,
|
|
precio double
|
|
);
|
|
|
|
drop table compra;
|
|
create table compra (
|
|
id integer auto_increment primary key,
|
|
usuario_id varchar(100),
|
|
asiento_id integer,
|
|
zona_id integer,
|
|
FOREIGN KEY (usuario_id) REFERENCES usuarios(nombreUsuario),
|
|
FOREIGN KEY (asiento_id) REFERENCES asiento(id),
|
|
FOREIGN KEY (zona_id) REFERENCES zona(id)
|
|
);
|
|
|
|
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;
|
|
|
|
INSERT INTO `zona`(`precio`)VALUES
|
|
(300),
|
|
(500),
|
|
(600),
|
|
(300);
|
|
|
|
|
|
INSERT INTO `usuarios`(`nombreUsuario`, `correo`, `password`, `tipo`) VALUES(?,?,?,?);
|
|
|
|
select * from zona;
|
|
|
|
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);
|