Ver Mensaje Individual
  #4 (permalink)  
Antiguo 21/11/2006, 08:13
Avatar de jpunk
jpunk
 
Fecha de Ingreso: octubre-2005
Ubicación: Bogota
Mensajes: 335
Antigüedad: 18 años, 7 meses
Puntos: 0
Hey tengo otro inconveniente con la última tabla y no entiendo el error, escribo las tablas con las que tengo inconveniente,

CREATE TABLE estudiantes (
Sno char(3) not null,
Snombre char(30) not null,
Sdomi char(15) not null,
Stlfno char(12) not null,
Sfnacim char(6) not null,
Siq integer not null,
Sadvfno char(3) not null,
Sesp char(4) not null,
PRIMARY KEY(Sno),
FOREIGN KEY(Sesp) REFERENCES departamento(Dept)
);

INSERT INTO estudiantes VALUES ('325', 'CURLEY DUBAY', 'CONNECTICUT', '203-123-4567', '780517', 122, '10', 'THEO');
INSERT INTO estudiantes VALUES ('150', 'LARRY DUBAY', 'CONNECTICUT', '203-123-4567', '780517', 121, '80', 'CIS');
INSERT INTO estudiantes VALUES ('100', 'MOE DUBAY', 'CONNECTICUT', '203-123-4567', '780517', 120, '10', 'THEO');
INSERT INTO estudiantes VALUES ('800', 'ROCKY BALBOA', 'PENSYLVANIA', '112-112-1122', '461004', 99, '60', 'PHIL');

CREATE TABLE matricula (
Cno char(3) not null,
Sec char(2) not null,
Sno char(3) not null,
Fechamat date not null,
Horamat date not null,
PRIMARY KEY(Cno, Sec, Sno),
FOREIGN KEY(Sno) REFERENCES estudiante
);

INSERT INTO matricula VALUES ('C11', '01', '325', "1987-01-04", '09.41.30');
INSERT INTO matricula VALUES ('C11', '01', '800', "1987-12-15", '11.49.00');
INSERT INTO matricula VALUES ('C11', '02', '100', "1987-12-17", '09.32.00');
INSERT INTO matricula VALUES ('C11', '02', '150', "1987-12-17", '09.32.30');
INSERT INTO matricula VALUES ('P33', '01', '100', "1987-12-23", '11.30.00');
INSERT INTO matricula VALUES ('P33', '01', '800', "1987-12-23", '11.23.00');
INSERT INTO matricula VALUES ('T11', '01', '100', "1987-12-23", '11.21.00');
INSERT INTO matricula VALUES ('T11', '01', '150', "1987-12-15", '11.35.30');
INSERT INTO matricula VALUES ('T11', '01', '800', "1987-12-15", '14.00.00');


El error que me sale es:

Error
consulta SQL:
CREATE TABLE matricula(
Cno char( 3 ) NOT NULL ,
Sec char( 2 ) NOT NULL ,
Sno char( 3 ) NOT NULL ,
Fechamat date NOT NULL ,
Horamat date NOT NULL ,
PRIMARY KEY ( Cno, Sec, Sno ) ,
FOREIGN KEY ( Sno ) REFERENCES estudiante
);
MySQL ha dicho:
#1005 - Can't create table '.\educa\matricula.frm' (errno: 150)