Simple

Solo disponible en BuenasTareas
  • Páginas : 2 (479 palabras )
  • Descarga(s) : 0
  • Publicado : 16 de noviembre de 2010
Leer documento completo
Vista previa del texto
mysql> create database bio1;
mysql> use bio1;
Database changed
mysql> create table emp(id_em bigint not null auto_increment primary key,nombre_emp varchar(20),apellido_empvarchar(20),direccion_emp varchar(20),id_cl bigint not null,index(id_cl),foreign key(id_cl) references clie(id_cl) on update cascade on delete cascade)type=innodb;
mysql> create table clie(id_cl bigint not nullauto_increment primary key,nombre_clie varchar(20),apellido_clie varchar(20),direccion_clie varchar(20),cedula_clie bigint not null)type=innodb;
mysql> create table carg(id_car bigint not null auto_incrementprimary key,descripcion_carg varchar(20),cod_carg bigint not null,sueldo_carg float,id_em bigint not null,index(id_em),foreign key(id_em)references emp(id_em) on update cascade on deletecascade)type=innodb;
mysql> create table cuen(id_cu bigint not null auto_increment primary key,cod_cuen bigint not null,tipo_cuen varchar(20),retiro_cuen float,id_em bigint,id_cl bigint,index(id_cl),foreignkey(id_cl) references clie(id_cl) on update cascade on delete cascade,index(id_em),foreign key(id_em) references emp(id_em) on update cascade on delete cascade)type=innodb;
mysql> describe cuen;+-------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+----------------+| id_cu | bigint(20) | | PRI | NULL | auto_increment |
| cod_cuen | bigint(20) | | | 0 | |
| tipo_cuen | varchar(20) | YES | | NULL ||
| retiro_cuen | float | YES | | NULL | |
| id_em | bigint(20) | YES | MUL | NULL | |
| id_cl | bigint(20) | YES | MUL |NULL | |
+-------------+-------------+------+-----+---------+----------------+
mysql> describe emp;
+---------------+-------------+------+-----+---------+----------------+
|...
tracking img