-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproyectoparo.sql
More file actions
62 lines (51 loc) · 1.58 KB
/
proyectoparo.sql
File metadata and controls
62 lines (51 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
create database bdparo;
use bdparo;
drop table if exists hecho1;
drop table if exists hecho2;
drop table if exists Tiempo;
drop table if exists Ubicacion;
drop table if exists Sector;
drop table if exists Demografia;
create table Tiempo(
id_tiempo varchar(45) primary key,
mes varchar(45) not null,
anno varchar(45) not null
);
create table Ubicacion(
id_ubicacion int(3) primary key,
ciudad varchar(48) not null,
provincia varchar(45) not null,
ca varchar(45) not null
);
create table Demografia(
id_demografia int(3) primary key,
sexo_edad varchar(45) not null
);
create table Sector(
id_sector int(3) primary key,
servicio varchar(45) not null
);
create table Hecho1(
id_hecho int(3) auto_increment,
paro int(6) not null,
tiempo_fk varchar(45) not null,
ubicacion_fk int(3) not null,
sector_fk int(3) not null,
fecha_insercion varchar(30) not null,
primary key (id_hecho),
foreign key (tiempo_fk) references Tiempo(id_tiempo) on delete cascade,
foreign key (ubicacion_fk) references Ubicacion(id_ubicacion) on delete cascade,
foreign key (sector_fk) references Sector(id_sector) on delete cascade
);
create table Hecho2(
id_hecho int(3) auto_increment,
paro int(6) not null,
tiempo_fk varchar(45) not null,
ubicacion_fk int(3) not null,
demografia_fk int(3) not null,
fecha_insercion varchar(30) not null,
primary key (id_hecho),
foreign key (tiempo_fk) references Tiempo(id_tiempo) on delete cascade,
foreign key (ubicacion_fk) references Ubicacion(id_ubicacion) on delete cascade,
foreign key (demografia_fk) references Demografia(id_demografia) on delete cascade
);