Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE IF NOT EXISTS artista (
- cuit INT PRIMARY KEY,
- descripcion VARCHAR(50) NOT NULL,
- telefono INT NOT NULL,
- email VARCHAR(50),
- actividad VARCHAR(50) NOT NULL,
- nombre_comercial VARCHAR(50) NOT NULL,
- nombre VARCHAR(50) NOT NULL,
- apellido VARCHAR(50) NOT NULL
- ) ENGINE = InnoDB;
- create table if not exists evento (
- nro INT AUTO_INCREMENT PRIMARY KEY,
- descripcion VARCHAR(50) NOT NULL,
- fecha_hora_ini DATETIME NOT NULL,
- fecha_hora_fin DATETIME NOT NULL
- ) ENGINE = InnoDB;
- create table if not exists jurado (
- dni INT PRIMARY KEY,
- nombre VARCHAR(50) NOT NULL,
- apellido VARCHAR(50) NOT NULL,
- especialidades VARCHAR(50) NOT NULL,
- telefono VARCHAR(50) NOT NULL
- ) ENGINE = InnoDB;
- create table if not exists lugar (
- codigo INT PRIMARY KEY,
- nombre VARCHAR(50) NOT NULL,
- direccion VARCHAR(50) NOT NULL,
- url_gps VARCHAR(50)
- ) ENGINE = InnoDB;
- create table if not exists persona (
- dni INT PRIMARY KEY,
- nombre VARCHAR(50) NOT NULL,
- apellido VARCHAR(50) NOT NULL,
- telefono VARCHAR(50),
- email VARCHAR(50),
- fecha_nac DATE NOT NULL
- ) ENGINE = InnoDB;
- create table if not exists recurso (
- codigo INT PRIMARY KEY AUTO_INCREMENT,
- descripcion VARCHAR(100) NOT NULL
- ) ENGINE = InnoDB;
- create table if not exists tipo_competencia (
- codigo INT AUTO_INCREMENT PRIMARY KEY,
- descripcion VARCHAR(100) NOT NULL,
- reglas TEXT
- ) ENGINE = InnoDB;
- create table if not exists valor_diario (
- codigo_recurso INT NOT NULL,
- fecha_desde DATE NOT NULL,
- valor INT NOT NULL,
- PRIMARY KEY(codigo_recurso, fecha_desde),
- CONSTRAINT fk_valordiario_recurso
- FOREIGN KEY(codigo_recurso)
- REFERENCES recurso(codigo)
- on update cascade
- on delete restrict
- ) Engine = InnoDB;
- create table if not exists alquiler (
- nro_evento int,
- codigo_recurso int,
- cantidad int not null,
- primary key (nro_evento,codigo_recurso),
- constraint fk_alquiler_recurso
- foreign key(codigo_recurso)
- references recurso(codigo)
- on update cascade
- on delete restrict,
- constraint fk_alquiler_evento
- foreign key(nro_evento)
- references evento(nro)
- on update cascade
- on delete restrict) engine = InnoDB;
- #####Ver los unsigned
- create table if not exists organizador (
- nro_evento int,
- dni_persona int,
- primary key(nro_evento,dni_persona),
- constraint fk_organizador_evento
- foreign key (nro_evento)
- references evento(nro)
- on update cascade
- on delete restrict,
- constraint fk_organizador_persona
- foreign key (dni_persona)
- references persona (dni)
- on update cascade
- on delete restrict) engine = InnoDB;
- create table if not exists participante (
- dni_persona int,
- nro_evento int,
- codigo_tipo_competencia int,
- fecha_hora_inscripcion datetime not null,
- primary key (dni_persona,nro_evento,codigo_tipo_competencia),
- constraint fk_participante_competencia
- foreign key(nro_evento,codigo_tipo_competencia)
- references competencia(nro_evento, codigo_tipo_competencia)
- on update cascade
- on delete restrict,
- constraint fk_participante_persona
- foreign key (dni_persona)
- references persona(dni)
- on update cascade
- on delete restrict) engine = InnoDB;
- create table if not exists competencia (
- nro_evento int,
- codigo_tipo_competencia int,
- descripcion varchar(50) not null,
- fecha_hora_ini datetime not null,
- fecha_hora_fin_est datetime not null,
- premios text not null,
- costo_inscripcion int not null,
- dni_jurado int not null,
- primary key(nro_evento, codigo_tipo_competencia),
- constraint fk_competencia_evento
- foreign key (nro_evento)
- references evento(nro)
- on update cascade
- on delete restrict,
- constraint fk_competencia_jurado
- foreign key (dni_jurado)
- references jurado(dni)
- on update cascade
- on delete restrict,
- constraint fk_competencia_tipoCompetencia
- foreign key (codigo_tipo_competencia)
- references tipo_competencia(codigo)
- on update cascade
- on delete restrict) engine = InnoDB;
- create table if not exists espectaculo (
- nro_espectaculo int,
- nombre varchar(50) not null,
- fecha_hora_ini datetime not null,
- fecha_hora_fin datetime not null,
- costo_cont int not null,
- nro_evento int unsigned not null,
- cuit_artista int unsigned,
- codigo_lugar int unsigned,
- primary key (nro_espectaculo, nro_evento),
- constraint fk_espectaculo_evento
- foreign key (nro_evento)
- references evento(nro)
- on update cascade
- on delete restrict,
- constraint fk_espectaculo_artista
- foreign key (cuit_artista)
- references artista(cuit)
- on update cascade
- on delete restrict,
- constraint fk_espectaculo_lugar
- foreign key (codigo_lugar)
- references lugar(codigo)
- on update cascade
- on delete restrict) engine = InnoDB;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement