Ver Mensaje Individual
  #5 (permalink)  
Antiguo 21/11/2006, 08:33
Avatar de the_scorpion
the_scorpion
 
Fecha de Ingreso: mayo-2006
Ubicación: Cuba
Mensajes: 696
Antigüedad: 18 años, 10 meses
Puntos: 3
Cita:
Iniciado por jpunk Ver Mensaje
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)
Hola

- Le llamas inconveniente aque no se crean las tablas
- No veo ningun error en las tablas ni en la inserción de datos
- A no ser que sea en el campo "Horamat date" que estas usando un campo de fecha y estas introducción valores con separador de puntos, campo hora y como mysql es tan bueno te lo inserta de esta forma
Cita:
INSERT INTO `matricula` VALUES ('C11', '01', '325', '1987-01-04', '0000-00-00');
INSERT INTO `matricula` VALUES ('C11', '01', '800', '1987-12-15', '0000-00-00');
INSERT INTO `matricula` VALUES ('C11', '02', '100', '1987-12-17', '0000-00-00');
INSERT INTO `matricula` VALUES ('C11', '02', '150', '1987-12-17', '0000-00-00');
INSERT INTO `matricula` VALUES ('P33', '01', '100', '1987-12-23', '0000-00-00');
INSERT INTO `matricula` VALUES ('P33', '01', '800', '1987-12-23', '0000-00-00');
INSERT INTO `matricula` VALUES ('T11', '01', '100', '1987-12-23', '0000-00-00');
INSERT INTO `matricula` VALUES ('T11', '01', '150', '1987-12-15', '0000-00-00');
INSERT INTO `matricula` VALUES ('T11', '01', '800', '1987-12-15', '0014-00-00');
__________________
Que hablen mal de uno es espantoso. Pero hay algo peor: que no hablen.
Quien hace, puede equivocarse. Quien nada hace, ya está equivocado".