当前位置: 移动技术网 > IT编程>数据库>Mysql > mysql创建Bitmap_Join_Indexes中的约束与索引

mysql创建Bitmap_Join_Indexes中的约束与索引

2017年12月12日  | 移动技术网IT编程  | 我要评论

奖金申请报告,巴中市人力资源和社会保障局,贝奥武夫插曲

测试过程如下:
create table sales 
as select * from sh.sales;    

create table customers 

as 
select * from sh.customers; 
create unique index cust_id_un on customers(cust_id);    


创建: 
bitmap join indexes 

create bitmap index sales_cust_gender_bjix 
on sales(customers.cust_gender) 
from sales,customers 
where sales.cust_id=customers.cust_id; 

报错如下: 


第 3 行出现错误: 
ora-25954: 维的主键或唯一约束条件缺失
案例分析:在此处尽管定义了对表customers的唯一性索引,但是该索引并没有对表customers并没有唯一性约束,即表示唯一性索引并不表示对表进行唯一性约束;但是如果加了唯一性的约束,就不会出现报错,示例如下:


sql> alter table customers
2 modify (cust_id constraint customers_un unique); 
表已更改。

sql> create bitmap index sales_cust_gender_bjix 

2 on sales(customers.cust_gender) 
3 from sales,customers 
4 where sales.cust_id=customers.cust_id; 


索引已创建。 



结论:

只要加了唯一性的约束,创建bji则不会报错。 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网