作者Howie0417 (猴子)
看板Database
標題[SQL ] foreign key 的問題...拜託各位幫忙一下@@
時間Sun Jan 10 00:55:17 2010
嗯這是我目前在作的一個報告
就是我已經先建立了下面這個table
create table customer
( customer_ID varchar(10) not null,
customer_姓名 varchar(10) not null,
customer_暱稱 varchar(10) not null,
customer_電話 varchar(15) not null,
customer_手機 varchar(15) not null,
customer_地址 varchar(30) not null,
customer_生日 date not null,
customer_職業 varchar(15) not null,
年收入 varchar(15) not null,
特殊要求 varchar(100) not null,
primary key (customer_ID,customer_姓名));
create table record
( record_ID varchar(10) not null,
customer_ID varchar(10) not null,
lady_ID varchar(10) not null,
service_ID varchar(10) not null,
driver_ID varchar(10) not null,
地點 varchar(30) not null,
日期 date not null,
primary key (record_ID,customer_ID,lady_ID),
foreign key (customer_ID) references customer (customer_ID));
接下來我想要開始建立record的資料表的時候
他都會說找不到"主資料表之參照欄位中的唯一索引"
請問到底是怎麼一回事...
拜託幫幫我
我知道這是很初級的問題
但是我實在是卡在這邊卡太久了還是沒想到哪裡出了錯....
才想說來請教各位指點迷津
麻煩大家了....
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.4.186
1F:推 daniel1205:Customer 那個 Table要先有資料... (對應的 CustomerID 01/10 01:41
2F:→ Howie0417:可是我已經先建立好了customer的表格了阿@@ 01/11 01:09