Hey Leute, ich stoße auf ein Problem beim Versuch, diese 5 Tabellen zu erstellen. Von dem, was ich sagen kann, muss sich die Angelegenheit mit dem Champion befassen. Jedes Mal, wenn ich versuche, meine SQL-Datei zu importieren, erhalte ich einen Fehler 150, der besagt, dass die Champion-Tabelle nicht erstellt werden kann.Probleme beim Versuch, diese Tabellen zu erstellen
Um zu klären, kann ein Champion nur eine Fraktion haben, aber eine Fraktion kann aus vielen Champions bestehen. Die gleiche Beziehung für Rollen und Affinität. Vielen Dank für Ihre Hilfe im Voraus.
DROP TABLE IF EXISTS `champion`;
DROP TABLE IF EXISTS `role`;
DROP TABLE IF EXISTS `build`;
DROP TABLE IF EXISTS `faction`;
DROP TABLE IF EXISTS `build_type`;
DROP TABLE IF EXISTS `affinity`;
-- roles table
-- Table consisting of the roles various champions play
CREATE TABLE `role` (
`role_id` int(11) NOT NULL AUTO_INCREMENT,
`role_name` varchar(255) NOT NULL,
PRIMARY KEY (`role_id`)
)ENGINE=InnoDB;
-- build table
CREATE TABLE `build` (
`build_id` int(11) NOT NULL AUTO_INCREMENT,
`build_name` varchar(255) NOT NULL,
PRIMARY KEY (`build_id`),
UNIQUE KEY (`build_name`)
)ENGINE=InnoDB;
-- faction table
-- Table consisting of the faction each champion belongs to
CREATE TABLE `faction`(
`faction_id` int(11) NOT NULL AUTO_INCREMENT,
`faction_name` varchar(255) NOT NULL,
PRIMARY KEY (`faction_id`)
)ENGINE=InnoDB;
-- Champions table
-- Table consisting of various champions in League of Legends
CREATE TABLE `champion`(
`champion_id` int(11) NOT NULL AUTO_INCREMENT,
`champion_name` varchar(255) NOT NULL,
`f_id` int(11) NOT NULL,
`r_id` int(11) NOT NULL,
`a_id` int(11) NOT NULL,
PRIMARY KEY (`champion_id`),
FOREIGN KEY (`r_id`) REFERENCES `role` (`role_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
FOREIGN KEY (`f_id`) REFERENCES `faction` (`faction_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
FOREIGN KEY (`a_id`) REFERENCES `affinity` (`affinity_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
UNIQUE KEY (`champion_name`)
)ENGINE=InnoDB;
-- build_type table
CREATE TABLE `build_type`(
`cid` int(11) NOT NULL,
`bid` int(11) NOT NULL,
PRIMARY KEY (`cid`, `bid`),
FOREIGN KEY (`cid`) REFERENCES `champion` (`champion_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
FOREIGN KEY (`bid`) REFERENCES `build` (`build_id`)
ON DELETE CASCADE
ON UPDATE CASCADE
)ENGINE=InnoDB;
-- affinity table
-- Table consisting of the affinity a certain champion synergizes
-- with
CREATE TABLE `affinity`(
`affinity_id` int(11) NOT NULL AUTO_INCREMENT,
`affinity_name` varchar(255) NOT NULL,
PRIMARY KEY (`affinity_id`)
)ENGINE=InnoDB;
Ich bin froh, dass es so eine einfache Lösung war. Vielen Dank, dass Sie darauf hingewiesen haben. – tntsgoboom
Sie sind herzlich willkommen – jonju