More Question More Delphi with Access |
答題得分者是:timhuang
|
Vashee
初階會員 發表:38 回覆:87 積分:25 註冊:2003-03-31 發送簡訊給我 |
This is regarding the last post 'The use of Delphi with Access' To Justmade:
I have a question regarding your table layout suggestion. If (History Table)
Order Number (Primary Key)
Order Time (Detail Table)
Order Number (Primary Key)
Dish ID (Primary Key)
Quantity If both Order Number is set to Primary Key, It will be a One to One basic, however, it will be many items under the same OrderNumber in the Detail Table. Also, I cannot set two primary keys in the same table
|
timhuang
尊榮會員 發表:78 回覆:1815 積分:1608 註冊:2002-07-15 發送簡訊給我 |
引言: If both Order Number is set to Primary Key, It will be a One to One basic, however, it will be many items under the same OrderNumber in the Detail Table. Also, I cannot set two primary keys in the same tableHi, you can select both Order Number and Dish ID from Detail Table and set a compound primary key which combined with more than one column. It's not to set two independent primary keys in one table. Each table only has one primary key. |
Justmade
版主 發表:94 回覆:1934 積分:2030 註冊:2003-03-12 發送簡訊給我 |
引言: it will be many items under the same OrderNumber in the Detail TableIt is exactly why you need to use both the Order Number and Dish ID to be the primary key. A primary key cannot have repeated value. So, if you set OrderNumber as primary key, you can only have 1 record per Order Number. However, if you use both, you can have many records with same Order Number provided that the Dish ID is different. |
Vashee
初階會員 發表:38 回覆:87 積分:25 註冊:2003-03-31 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |