创建表
https://www.nowcoder.com/practice/ac233de508ef4849b0eeb4f38dcf09cf?tpId=82&tags=&title=&difficulty=0&judgeStatus=0&rp=1
create table actor
(actor_id smallint(5) not null primary key comment "主键id",
first_name varchar(45) not null comment "名字",
last_name varchar(45) not null comment "姓氏",
last_update date not null comment"日期")
创建表的时候创建索引
drop table if exists actor;
CREATE TABLE actor (
actor_id smallint(5) NOT NULL PRIMARY KEY,
first_name varchar(45) NOT NULL,
last_name varchar(45) NOT NULL,
last_update datetime NOT NULL,
unique key `uniq_idx_firstname` (first_name),
key `idx_lastname`(last_name));
在已经存在的表上建索引
create unique index uniq_idx_firstname on actor(first_name);
create index idx_lastname on actor(last_name);
浙公网安备 33010602011771号