当前位置: 首页 > 图文教程 > 数据库 > MYSQL > mysql创建Bitmap_Join_Indexes中的约束与索引

MYSQL
怎样可以在Windows上安装多个Mysql
详细讲解MySQL数据库中的安全配置步骤
解析mysql 8小时空闲后连接超时的问题
一起从基础入手来打开MySQL数据库之门
MySQL数据库中的Show命令具体用法
怎样在MySQL的数据库中定义外键详解
MySQL数据库用户帐号管理基础知识详解
MySQL从旧的版本升级为新的版本全攻略
用Tomcat和MySQL生成动态内容详解
讲解查看MySQL数据库错误码的三个方法
数据库经验:如何简单安装MySQL数据库
MySQL数据库双机热备的配置方法详解
在SUSE10下安装和配置MySQL数据库
MySQL数据库本地备份和双机相互备份
MySQL数据库常见的出错代码及出错信息
带你轻松玩转MySQL数据库的异常处理
用实例管理器轻松管理多个MySQL实例
MySQL性能调整之my.cnf文件的配置方法
Replace INTO与INSERT INTO的不同之处
循序渐进讲解MySQL数据库的性能调整

MYSQL 中的 mysql创建Bitmap_Join_Indexes中的约束与索引


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 126 ::
收藏到网摘: n/a

现象:创建Bitmap Join Indexes时出现ORA-25954报错: 维的主键或唯一约束条件缺失。 53vi.Com 原因:受到约束与索引的影响。 测试过程如下:
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则不会报错。