首页 > 试题广场 >

为了使索引键的值在基本表中唯一,在建立索引的语句中应使用保留

[单选题]

为了使索引键的值在基本表中唯一,在建立索引的语句中应使用保留字(  )

  • UNIQUE

  • COUNT

  • DISTINCT

  • UNION

unique 和 distinct 都是去重的意思,但他们所用的语句不同

1:unique 可以用于在创建表时或者在修改表的结构时使用

例如:

create table test(sno int not null unique);

或者 alter table test alter unique(sname);

2:distinct则是用于对select 语句使用

例如: select distinct depart from test
发表于 2021-04-10 13:10:19 回复(0)