程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> CUBRID學習筆記 21 查看主鍵外鍵索引,cubrid學習筆記

CUBRID學習筆記 21 查看主鍵外鍵索引,cubrid學習筆記

編輯:MySQL綜合教程

CUBRID學習筆記 21 查看主鍵外鍵索引,cubrid學習筆記


命令

show create table game;

game是表名 

在web管理中,請在sql標簽中查,不要在query中執行.

show create table game;
=== <Result of SELECT Command in Line 1> ===
  TABLE                 CREATE TABLE        
============================================
  'game'                'CREATE TABLE game (
host_year INTEGER NOT NULL, event_code INTEGER NOT NULL, athlete_code INTEGER NOT NULL, 
stadium_code INTEGER NOT NULL, nation_code CHARACTER(3), medal CHARACTER(1), game_date DATE,  
CONSTRAINT pk_game_host_year_event_code_athlete_code PRIMARY KEY  (host_year, event_code, athlete_code),  
CONSTRAINT fk_game_event_code FOREIGN KEY  (event_code) REFERENCES event ON DELETE RESTRICT ON UPDATE RESTRICT,  
CONSTRAINT fk_game_athlete_code FOREIGN KEY  (athlete_code) REFERENCES athlete ON DELETE RESTRICT ON UPDATE RESTRICT)'
1 row selected.
Current transaction has been committed.
1 command(s) successfully processed.

可以看到外鍵信息如
CONSTRAINT fk_game_event_code FOREIGN KEY  (event_code) REFERENCES event ON DELETE RESTRICT ON UPDATE RESTRICT,  


可以看到主鍵信息
CONSTRAINT pk_game_host_year_event_code_athlete_code PRIMARY KEY  (host_year, event_code, athlete_code),  

換個體位看索引 ,利用主鍵
SELECT * FROM db_index WHERE class_name = 'game' AND is_primary_key = 'YES';

 

 
















  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved