题解 | #对first_name创建唯一索引#
对first_name创建唯一索引uniq_idx_firstname
https://www.nowcoder.com/practice/e1824daa0c49404aa602cf0cb34bdd75
CREATE UNIQUE INDEX uniq_idx_firstname ON actor(first_name);
CREATE INDEX idx_lastname ON actor(last_name);
注意第一句句末要用分号隔开
或者:
ALTER TABLE actor ADD UNIQUE uniq_idx_firstname(first_name);
ALTER TABLE actor ADD INDEX idx_lastname(last_name);
ALTER TABLE:修改数据库表结构
本题考查数据表格插入唯一索引和普通索引的使用(有两种用法)