CREATE TABLE `ost_staff` (
`staff_id` int(11) unsigned NOT NULL auto_increment,
`group_id` int(10) unsigned NOT NULL default '0',
`dept_id` int(10) unsigned NOT NULL default '0',
`username` varchar(32) collate latin1_german2_ci NOT NULL default '',
`firstname` varchar(32) collate latin1_german2_ci default NULL,
`lastname` varchar(32) collate latin1_german2_ci default NULL,
`passwd` varchar(128) collate latin1_german2_ci default NULL,
`email` varchar(128) collate latin1_german2_ci default NULL,
`phone` varchar(24) collate latin1_german2_ci NOT NULL default '',
`phone_ext` varchar(6) collate latin1_german2_ci default NULL,
`mobile` varchar(24) collate latin1_german2_ci NOT NULL default '',
`signature` varchar(255) collate latin1_german2_ci NOT NULL default '',
`isactive` tinyint(1) NOT NULL default '1',
`isadmin` tinyint(1) NOT NULL default '0',
`isvisible` tinyint(1) unsigned NOT NULL default '1',
`onvacation` tinyint(1) unsigned NOT NULL default '0',
`daylight_saving` tinyint(1) unsigned NOT NULL default '0',
`append_signature` tinyint(1) unsigned NOT NULL default '0',
`change_passwd` tinyint(1) unsigned NOT NULL default '0',
`timezone_offset` float(3,1) NOT NULL default '0.0',
`max_page_size` int(11) NOT NULL default '0',
`created` datetime NOT NULL default '0000-00-00 00:00:00',
`lastlogin` datetime default NULL,
`updated` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`staff_id`),
UNIQUE KEY `username` (`username`),
KEY `dept_id` (`dept_id`),
KEY `issuperuser` (`isadmin`),
KEY `group_id` (`group_id`,`staff_id`)
) ENGINE=MyISAM AUTO_INCREMENT=35 DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci;
您好上面的查询是osticket开源的, 我知道主键,外键,唯一,但我不确定这是什么
KEY
group_id
(group_id
,staff_id
)
请告诉我,这个约束名称......
答案 0 :(得分:3)
这是INDEX
答案 1 :(得分:1)
这是一个组合了两列group_id和staff_id的索引,但被称为group_id。将其视为唯一标识符,但MySQL不强制该列是唯一的。此外,数据库将检查此密钥的方式将是group_id,然后是staff_id,而不是相反,所以请确保您的查询反映出来(即单独为employees_id执行订单不会比执行订单更快通过group_id然后是staff_id)。
如果你问的是**,那些在MySQL中毫无意义。
刚看到Bozho的评论,这个链接就足够了。