CREATE TABLE `test_1` ( `c_title` varchar(100) character set latin1 collate latin1_general_ci NOT NULL, `c_apply_object` tinyint(4) NOT NULL default '0', PRIMARY KEY (`c_title`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO `test_1` (`c_title`, `c_apply_object`) VALUES ('list_all', 0), ('list_owned_by', 0), ('create', 0); CREATE TABLE `test_2` ( `c_table` varchar(100) character set latin1 collate latin1_general_ci NOT NULL, `c_action` varchar(100) character set latin1 collate latin1_general_ci NOT NULL, PRIMARY KEY (`c_table`,`c_action`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO `test_2` (`c_table`, `c_action`) VALUES ('sc_membership_type', 'create'), ('sc_membership_type', 'list_all'), ('sc_membership_type', 'list_owned_by'); CREATE TABLE `test_3` ( `c_deleted` tinyint(4) NOT NULL default '0', `c_what_granted_to` varchar(30) character set latin1 collate latin1_general_ci NOT NULL default 'nothing', `c_who_granted_to` int(10) unsigned NOT NULL default '0', `c_action` varchar(100) character set latin1 collate latin1_general_ci NOT NULL, `c_what_relates_to` varchar(30) character set latin1 collate latin1_general_ci NOT NULL default 'nothing', `c_related_table` varchar(100) character set latin1 collate latin1_general_ci NOT NULL, `c_related_uid` int(10) unsigned NOT NULL default '0', UNIQUE KEY `c_what_granted_to` (`c_what_granted_to`,`c_who_granted_to`,`c_action`,`c_what_relates_to`,`c_related_table`,`c_related_uid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO `test_3` (`c_deleted`, `c_what_granted_to`, `c_who_granted_to`, `c_action`, `c_what_relates_to`, `c_related_table`, `c_related_uid`) VALUES (0, 'group', 256, 'list_all', 'table', 'sc_membership_type', 0);