Código SQL:
Ver original
/* Linea */ CREATE TABLE linea( n_linea varchar2(10), c_red NUMBER(8) CONSTRAINT red_linea_fk REFERENCES red ON DELETE cascade, longitud NUMBER(6) NOT NULL CONSTRAINT linea_ch CHECK(longitud BETWEEN 1 AND 999999), CONSTRAINT linea_pk PRIMARY KEY (n_linea,c_red)); /* Subestacion */ CREATE TABLE subest( n_subest varchar2(20) CONSTRAINT subest_n_pk PRIMARY KEY, n_linea varchar2(10) NOT NULL CONSTRAINT linea_nlinea_fk REFERENCES linea, c_red NUMBER(8) NOT NULL CONSTRAINT linea_cred_fk REFERENCES linea );
Muchas gracias.