Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*==============================================================*/
- /* DBMS name: MySQL 5.0 */
- /* Created on: 12/07/2011 04:44:08 p.m. */
- /*==============================================================*/
- drop table if exists ASUNTO;
- drop table if exists CASO;
- drop table if exists CEDULA;
- drop table if exists CLIENTE;
- drop table if exists DEPARTAMENTO;
- drop table if exists DIRECCION;
- drop table if exists ESTUDIANTE;
- drop table if exists MUNICIPIO;
- drop table if exists NACIONALIDAD;
- drop table if exists SEGUIMIENTOS;
- drop table if exists TELEFONO;
- drop table if exists TIPO;
- /*==============================================================*/
- /* Table: ASUNTO */
- /*==============================================================*/
- create table ASUNTO
- (
- ID_ASUNTO int unsigned not null auto_increment,
- ASUNTO varchar(50),
- primary key (ID_ASUNTO)
- );
- /*==============================================================*/
- /* Table: CASO */
- /*==============================================================*/
- create table CASO
- (
- ID_CASO int unsigned not null auto_increment,
- NO_CARNE int unsigned,
- ID_ASUNTO tinyint,
- ID_TIPO_CASO tinyint,
- FECHA_INICIO date,
- FECHA_FENECIDO date,
- DESCRIPCION_CASO varchar(254),
- NO_FOLIO smallint,
- OBSERVACIONES nvarchar(254),
- MEMORIAL tinyint,
- primary key (ID_CASO)
- );
- /*==============================================================*/
- /* Table: CEDULA */
- /*==============================================================*/
- create table CEDULA
- (
- ID_CEDULADPI int unsigned not null auto_increment,
- NO_CARNE int,
- NO_ORDEN char(4),
- NO_REGISTRO int,
- EXTENDIDA varchar(40),
- NO_DPI bigint,
- primary key (ID_CEDULADPI)
- );
- /*==============================================================*/
- /* Table: CLIENTE */
- /*==============================================================*/
- create table CLIENTE
- (
- ID_CLIENTE int unsigned not null auto_increment,
- NOMBRE_CLIENTE varchar(50),
- APELLIDO_CLIENTE varchar(50),
- FECHA_NACIMIENTO date,
- ESTADO_CIVIL tinyint,
- SABE_FIRMAR tinyint,
- primary key (ID_CLIENTE)
- );
- /*==============================================================*/
- /* Table: DEPARTAMENTO */
- /*==============================================================*/
- create table DEPARTAMENTO
- (
- ID_DEPARTAMENTO int unsigned not null auto_increment,
- NOMBRE_DEPARTAMENTO varchar(60),
- primary key (ID_DEPARTAMENTO)
- );
- /*==============================================================*/
- /* Table: DIRECCION */
- /*==============================================================*/
- create table DIRECCION
- (
- ID_DIRECCION int unsigned not null auto_increment,
- ID_MUNICIPIO tinyint,
- ID_CLIENTE int,
- NO_CARNE int,
- DIRECCION varchar(80),
- ZONA tinyint,
- TIPO tinyint,
- primary key (ID_DIRECCION)
- );
- /*==============================================================*/
- /* Table: ESTUDIANTE */
- /*==============================================================*/
- create table ESTUDIANTE
- (
- NO_CARNE int unsigned not null,
- ID_NACIONALIDAD tinyint,
- NO_BUFETE int,
- NOMBRE_ESTUDIANTE varchar(50),
- APELLIDOS_ESTUDIANTE varchar(50),
- FECHA_NACIMIENTO date,
- ESTADO_CIVIL tinyint,
- primary key (NO_CARNE)
- );
- /*==============================================================*/
- /* Table: MUNICIPIO */
- /*==============================================================*/
- create table MUNICIPIO
- (
- ID_MUNICIPIO int unsigned not null auto_increment,
- ID_DEPARTAMENTO tinyint,
- NOMBRE_MUNICIPIO varchar(50),
- primary key (ID_MUNICIPIO)
- );
- /*==============================================================*/
- /* Table: NACIONALIDAD */
- /*==============================================================*/
- create table NACIONALIDAD
- (
- ID_NACIONALIDAD int unsigned not null auto_increment,
- NACIONALIDAD varchar(50),
- primary key (ID_NACIONALIDAD)
- );
- /*==============================================================*/
- /* Table: SEGUIMIENTOS */
- /*==============================================================*/
- create table SEGUIMIENTOS
- (
- ID_SEGUIMIENTO int unsigned not null auto_increment,
- ID_CASO int,
- FECHA date,
- COMENTARIO varchar(255),
- primary key (ID_SEGUIMIENTO)
- );
- /*==============================================================*/
- /* Table: TELEFONO */
- /*==============================================================*/
- create table TELEFONO
- (
- ID_TEL int unsigned not null auto_increment,
- NO_CARNE int,
- ID_CLIENTE int,
- TELEFONO varchar(8),
- TIPO tinyint,
- primary key (ID_TEL)
- );
- /*==============================================================*/
- /* Table: TIPO */
- /*==============================================================*/
- create table TIPO
- (
- ID_TIPO_CASO int unsigned not null auto_increment,
- TIPO varchar(50),
- primary key (ID_TIPO_CASO)
- );
- alter table CASO add constraint FK_REFERENCE_21 foreign key (NO_CARNE)
- references ESTUDIANTE (NO_CARNE) on delete restrict on update restrict;
- alter table CASO add constraint FK_REFERENCE_22 foreign key (ID_ASUNTO)
- references ASUNTO (ID_ASUNTO) on delete restrict on update restrict;
- alter table CASO add constraint FK_REFERENCE_23 foreign key (ID_TIPO_CASO)
- references TIPO (ID_TIPO_CASO) on delete restrict on update restrict;
- alter table CEDULA add constraint FK_REFERENCE_3 foreign key (NO_CARNE)
- references ESTUDIANTE (NO_CARNE) on delete restrict on update restrict;
- alter table DIRECCION add constraint FK_REFERENCE_4 foreign key (ID_MUNICIPIO)
- references MUNICIPIO (ID_MUNICIPIO) on delete restrict on update restrict;
- alter table DIRECCION add constraint FK_REFERENCE_6 foreign key (ID_CLIENTE)
- references CLIENTE (ID_CLIENTE) on delete restrict on update restrict;
- alter table DIRECCION add constraint FK_REFERENCE_7 foreign key (NO_CARNE)
- references ESTUDIANTE (NO_CARNE) on delete restrict on update restrict;
- alter table ESTUDIANTE add constraint FK_REFERENCE_1 foreign key (ID_NACIONALIDAD)
- references NACIONALIDAD (ID_NACIONALIDAD) on delete restrict on update restrict;
- alter table MUNICIPIO add constraint FK_REFERENCE_5 foreign key (ID_DEPARTAMENTO)
- references DEPARTAMENTO (ID_DEPARTAMENTO) on delete restrict on update restrict;
- alter table SEGUIMIENTOS add constraint FK_REFERENCE_24 foreign key (ID_CASO)
- references CASO (ID_CASO) on delete restrict on update restrict;
- alter table TELEFONO add constraint FK_REFERENCE_10 foreign key (ID_CLIENTE)
- references CLIENTE (ID_CLIENTE) on delete restrict on update restrict;
- alter table TELEFONO add constraint FK_REFERENCE_2 foreign key (NO_CARNE)
- references ESTUDIANTE (NO_CARNE) on delete restrict on update restrict;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement