所以我正在使用sqlfiddle,但总是收到错误“无法添加外键约束”。有人可以帮我找到错误吗?我确定问题出在第一个表(教授)上,就像您删除了两个FK约束一样,代码运行正常。
CREATE TABLE Professor (
Inicials char(2) not null,
nom varchar(30),
DNI varchar(10),
Email varchar(30),
CONSTRAINT inicials_pk PRIMARY KEY (Inicials),
CONSTRAINT dni_professor UNIQUE (DNI),
CONSTRAINT Email_professor UNIQUE (Email)
);
INSERT INTO Professor (Inicials, nom, DNI, Email)
VALUES ('JF','Joel Ferragut','56783698V','jferragut@iesmontisa.org');
INSERT INTO Professor (Inicials, nom, DNI, Email)
VALUES ('AE','Aleix Esteve','56983698V','aesteve@iesmontisa.org');
INSERT INTO Professor (Inicials, nom, DNI, Email)
VALUES ('KC','Kevin Costes','56883698V','kevincostes@iesmontisa.org');
CREATE TABLE Grup (
Nivell varchar(10),
Curs varchar(10),
Lletra varchar(5),
Aula varchar(5),
CONSTRAINT GrupNivell_pk PRIMARY KEY (Nivell, Curs, Lletra)
);
INSERT INTO Grup (Nivell, Curs, Lletra, Aula)
VALUES ('1','2018-2019','A','24');
CREATE TABLE Docencia (
hores_totals int,
Inicials char(2) not null,
Nivell varchar(10),
Curs varchar(10),
Lletra varchar(5),
CONSTRAINT profe FOREIGN KEY (inicials)
REFERENCES Professors (inicials),
CONSTRAINT GrupNivell_pk FOREIGN KEY (Nivell, Curs, Lletra)
REFERENCES Grup (Nivell, Curs, Lletra)
);
答案 0 :(得分:0)
这是一个拼写错误,您的表称为“教授”,您的外键引用“教授”。
尝试一下:
self.lf = tk.LabelFrame(self.master, text="Plot")
self.lf.grid(row=1, column=0, padx=3, pady=3)