在数据库中的新建一个数据表,名为js1,结构与js表相同。为js1表创建一个唯一聚集索引,索引字段为Sid,索引名为I_js_sid。
时间: 2023-11-22 20:55:05 浏览: 73
在 SQL Server 中,可以使用以下语句创建名为 js1 的表,并创建一个名为 I_js_sid 的唯一聚集索引:
```
CREATE TABLE js1 (
Sid INT PRIMARY KEY,
Sname VARCHAR(50),
Sage INT,
Ssex VARCHAR(10),
Sdept VARCHAR(20)
)
CREATE UNIQUE CLUSTERED INDEX I_js_sid ON js1 (Sid)
```
注意,在创建表时,我们指定了 Sid 为主键,因此不需要再为它创建索引。而对于 Sid 的唯一聚集索引,则使用 CREATE UNIQUE CLUSTERED INDEX 语句创建,并指定了索引名为 I_js_sid。
阅读全文
相关推荐
















