Home > Database > Mysql Tutorial > mysql-请问数据库表中可以在一个表里面有两个关联同一个表的外键吗?

mysql-请问数据库表中可以在一个表里面有两个关联同一个表的外键吗?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 09:42:09
Original
1469 people have browsed it

mysql

具体是这样的:
我有一个用户表user,一个好友表fans。
fans中有三个字段 id,user_id,fans_id,其中user_id和fans_id都是跟user表的id关联的外键,我发现这样会报错。
可是用户跟好友的信息又要与用户表的信息关联,请问各位大神,怎样才不会报错或者有什么好一点的解决办法吗?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template