English 中文(简体)
Error (150) Generated by Ankou gust?
原标题:Error (150) Generated By An SQL Script?

我正试图用手稿制作有关MySQL的表格,而MySQL数据库则保留给我150个错误。 我在纳维喀特和MySQL Workbench两处尝试了以下法典,并造成150个错误。

看来,这是一个外国的关键问题,但我实际上看看一下,我的法典存在什么问题,并想知道,是否有更多的受雇用的亚洲开发银行用户会对这个问题有任何异议?

SET FOREIGN_KEY_CHECKS=0;
CREATE TABLE `network_invites` (
`invite_ID` int(11) NOT NULL AUTO_INCREMENT,
`invite_From` int(11) NOT NULL,
`invite_Network` int(11) NOT NULL,
`invite_NetCreator` int(11) NOT NULL,
`invite_Message` varchar(256) NOT NULL,
`invite_Date` date DEFAULT NULL,
PRIMARY KEY (`invite_ID`),
KEY `invite_From` (`invite_From`),
KEY `invite_Network` (`invite_Network`),
KEY `invite_NetCreator` (`invite_NetCreator`),
CONSTRAINT `network_invites_ibfk_1` FOREIGN KEY (`invite_From`) REFERENCES `users`     (`user_ID`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `network_invites_ibfk_2` FOREIGN KEY (`invite_Network`) REFERENCES `networks` (`network_ID`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `network_invites_ibfk_3` FOREIGN KEY (`invite_NetCreator`) REFERENCES `networks` (`network_Creator`) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;

I cant see what the FK problem is, those fields do exist on the DB and they are of the same datatype.

感谢任何帮助。

问题回答

I think the workaround is :

  1. 在无限制的情况下制定表格

  2. add constraints using ALTER TABLE

again , this is a workaround , and would love to hear from people@mysql or someone more experienced

表2 还确保你的初级和外国钥匙都是没有签名的。

所有这些环境都可以在纳维亚卡使用“配桌”办法加以改变。

我多次谈到这一问题,这确实是99%的时间。

用户:ID,network_IDnetwork_Creator,栏目的类型应与network_invites表完全相同。

问题在于:

CONSTRAINT `network_invites_ibfk_2` 
  FOREIGN KEY (`invite_Network`) 
  REFERENCES `networks` (`network_ID`)       ---<--- either here
  ON DELETE CASCADE ON UPDATE CASCADE,

CONSTRAINT `network_invites_ibfk_3` 
  FOREIGN KEY (`invite_NetCreator`) 
  REFERENCES `networks` (`network_Creator`)  ---<--- or here (more probable)
  ON DELETE CASCADE ON UPDATE CASCADE

Your networks table Primary Key is probably network_ID and not network_Creator.





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签