第一种 直接在表上sno列单击右键就有个主键属性直接点一下就已经定义成主键了还有一种是写存储过程 Alter table tabname add primary key(col) col是你要添加的列名