0

我想使用这个脚本......但是由于关键约束它不会让我放弃桌子......知道吗?

CREATE DATABASE IF NOT EXISTS DATABASEONE;

USE DATABASEONE;

DROP TABLE IF EXISTS st_glowne_st_pages;

CREATE TABLE `st_glowne_st_pages` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fk_glowne` varchar(50) COLLATE utf8_polish_ci NOT NULL,
  `fk_pages` varchar(50) COLLATE utf8_polish_ci NOT NULL,
  `kolejnosc` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `id` (`id`),
  KEY `fk_glowne` (`fk_glowne`),
  KEY `fk_pages` (`fk_pages`),
  CONSTRAINT `st_glowne_st_pages_ibfk_1` FOREIGN KEY (`fk_glowne`) REFERENCES `st_glowne` (`name`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `st_glowne_st_pages_ibfk_2` FOREIGN KEY (`fk_pages`) REFERENCES `st_pages` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci;

INSERT INTO st_glowne_st_pages VALUES("1","admin.php","pageadmin.php","1");
INSERT INTO st_glowne_st_pages VALUES("3","index.php","pageindex.php","1");
INSERT INTO st_glowne_st_pages VALUES("4","work.php","pagework.php","1");
INSERT INTO st_glowne_st_pages VALUES("7","register.php","pageregister.php","1");
INSERT INTO st_glowne_st_pages VALUES("8","login.php","pagelogin.php","1");
4

1 回答 1

0

SET FOREIGN_KEY_CHECKS = 0;
...drop code...
SET FOREIGN_KEY_CHECKS = 1;
于 2013-09-30T15:59:44.007 回答