Вы находитесь на странице: 1из 1

create database escuela;

use escuela;

create table profesor(


clav_prof integer (3) not null,
nomb_prof varchar (50) not null,
fechnac_prof date not null,
direc_prof varchar (30) not null,
tel_prof varchar (15) null,
edociv_prof varchar (10) not null,
gradestud_prof varchar (20) not null,
clav_grup int (3) not null,
localidad_prof varchar (30) not null,
edad_prof varchar (3) not null,
primary key (clav_prof));

create table grupo(


clav_grup integer (3) not null,
nomb_grup varchar (20) not null,
ubic_grup varchar (30) null,
capac_grup varchar (20) null,
primary key (clav_grup));

create table alumnos(


clav_alum integer (3) not null,
nomb_alum varchar (50) not null,
edad_alum varchar (2) not null,
tel_alum varchar (15) null,
genero_alum varchar (15) not null,
clav_grup integer (3) not null,
clav_tut integer (3) not null,
clav_esp integer (3) not null,
localidad_alum varchar (30) not null,
primary key (clav_alum));

create table especialidad(


clav_esp integer (3) not null,
nomb_esp varchar (20) not null,
primary key (clav_esp));

create table tutor(


clav_tut integer (3) not null,
nomb_tut varchar (50) not null,
edad_tut varchar (3) not null,
direcc_tut varchar (40) not null,
telef_tut varchar (15) null,
primary key (clav_tut));
alter table profesor add (edad_prof varchar (3) not null);
alter table alumnos add foreign key (clav_grup) references grupo (clav_grup);
alter table alumnos add foreign key (clav_tut) references tutor (clav_tut);
alter table alumnos add foreign key (clav_esp) references especialidad (clav_esp);

describe profesor;
describe grupo;
describe alumnos;
describe tutor;
describe especialidad;

Вам также может понравиться