TGD/practicas/prac2/03_create_squema.sql
Carlos Galindo 7e26615aa7
Practica 2
2018-10-14 12:52:33 +02:00

27 lines
1.1 KiB
SQL

create table departamento(
cod_dep char(5) not null constraint cp_dep primary key initially immediate deferrable,
nombre varchar(40) not null,
director varchar(20),
telefono char(15));
create table profesor(
cod_pro char(5) not null constraint cp_prof primary key initially immediate deferrable,
nombre varchar(40) not null,
telefono char(15),
cod_dep char(5) constraint ca_prof_dep references departamento(cod_dep) initially immediate deferrable);
create table asignatura(
cod_asg char(5) not null constraint cp_asi primary key initially immediate deferrable,
nombre varchar(40) not null,
semestre char(2) not null,
teoria number(3,1) not null,
prac number(3,1) not null,
cod_dep char(5) constraint ca_asi_dep references departamento(cod_dep) initially immediate deferrable);
create table docencia(
cod_pro char(5) not null constraint ca_doc_prof references profesor(cod_pro) initially immediate deferrable,
cod_asg char(5) not null constraint ca_doc_asi references asignatura(cod_asg) initially immediate deferrable,
gteo number(2) not null,
gprac number(2) not null,
constraint cp_doc primary key(cod_pro, cod_asg) initially immediate deferrable);