DROP SCHEMA IF EXISTS `YouthMinistry` ;
CREATE SCHEMA IF NOT EXISTS `YouthMinistry` DEFAULT CHARACTER SET utf16 COLLATE utf16_general_ci ;
USE `YouthMinistry` ;
--
You can only create a foreign key on one table that references a key on another table. This specific problem is that memberid
is not a key on either groupmembers
or rolemembers
tables. Simply add KEY (memberid)
to those tables and you'll be good to go.
Another issue us that foreign key types must match. eventgroup
has groupid varchar
, but is referencing the groups
table, which has groupid INT
. Correct this.
As for suggestions, I very strongly recommend that each primary key be only one column: your auto-increment surrogate key. You should make these unsigned integers too.