为什么您获得的是异常的原因是因为你将在表中的记录
test_usershosts,其中的价值
userID是不存在的表
test_users。与相同的值
hid也未显示在表上
test_hosts。
表格
test_usershosts取决于表格:
test_users和
test_hosts。所以,要确保在表中插入记录时
test_usershosts,该值
hid与
userid存在于父表已经:
test_users和
test_hosts。
尝试执行此查询,并确定将其插入。
INSERT INTO test_usershosts (RID,userid,hid,Usr,Pass) VALUES (NULL,1120,30,'user','pass');
- SQLFiddle演示
我
AUTO_INCREMENT在表格上看到该选项:
test_users和
test_hosts,因为在两个表格上执行的每个查询都提供了值,所以不需要。



