56 lines
1.4 KiB
MySQL
56 lines
1.4 KiB
MySQL
|
drop database informes;
|
||
|
create database if not exists informes;
|
||
|
use informes;
|
||
|
|
||
|
create table if not exists usuarios(
|
||
|
id int not null auto_increment,
|
||
|
usuario varchar(30) not null,
|
||
|
primary key(id, usuario),
|
||
|
pass varchar(30) not null);
|
||
|
|
||
|
insert into usuarios(usuario, pass) values
|
||
|
("pepe", "pass"),
|
||
|
("juan", "1234"),
|
||
|
("roberto", "asdgg");
|
||
|
|
||
|
create table if not exists gestiones(
|
||
|
id int not null primary key auto_increment,
|
||
|
descripcion varchar(30),
|
||
|
idUsuario int not null,
|
||
|
foreign key (idUsuario) references usuarios(id)
|
||
|
);
|
||
|
|
||
|
insert into gestiones(descripcion, idUsuario)values
|
||
|
("vicio", 1),
|
||
|
("comida", 1),
|
||
|
("escuela", 1),
|
||
|
("colegio", 2),
|
||
|
("super", 2),
|
||
|
("pc", 2),
|
||
|
("cosa1", 3),
|
||
|
("cosa2", 3),
|
||
|
("cosa3", 3);
|
||
|
|
||
|
create table if not exists transacciones(
|
||
|
id int not null primary key auto_increment,
|
||
|
precio float,
|
||
|
descripcion varchar(30),
|
||
|
fecha date,
|
||
|
idGestion int not null,
|
||
|
foreign key (idGestion) references gestiones(id)
|
||
|
);
|
||
|
|
||
|
insert into transacciones(precio, descripcion, fecha, idGestion) values
|
||
|
(9, "juego1", '19-01-01',1),
|
||
|
(3, "jego2", '19-02-01',1),
|
||
|
(6, "cosas ilegales", '19-03-03', 1),
|
||
|
(8, "objeto prueba", '19-04-01', 2),
|
||
|
(9, "objeto peuba2", '19-02-02', 2),
|
||
|
(7, "otro objeto", '19-04-03', 3),
|
||
|
(8, "juego1", '19-01-01',4),
|
||
|
(4, "jego2", '19-02-02',4),
|
||
|
(5, "cosas ilegales", '19-03-03', 4),
|
||
|
(9, "objeto prueba", '19-01-01', 5),
|
||
|
(10, "objeto peuba2", '19-02-02', 5),
|
||
|
(2, "otro objeto", '19-03-03', 6);
|