国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

mysql創建Bitmap_Join_Indexes中的約束與索引

2020-01-19 00:24:18
字體:
來源:轉載
供稿:網友
測試過程如下:
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則不會報錯。 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 五家渠市| 南投县| 茌平县| 丰县| 原平市| 堆龙德庆县| 广水市| 尼玛县| 贵溪市| 巴林左旗| 曲水县| 时尚| 宜川县| 霍城县| 隆安县| 永宁县| 揭阳市| 北宁市| 建水县| 齐河县| 灵丘县| 罗山县| 手机| 江西省| 若羌县| 淮南市| 保靖县| 宁强县| 长寿区| 鹿邑县| 泰顺县| 南康市| 循化| 宕昌县| 三门峡市| 台前县| 行唐县| 四会市| 连州市| 延庆县| 启东市|