If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > simple problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-10-04, 15:13
evilz35 evilz35 is offline
Registered User
 
Join Date: Feb 2004
Posts: 78
simple problem

hey peeps i am new to sql and have created the following table in my database but get the following error(below), where am i going wrong?



)
*

ERROR at line 11:
ORA-00905: missing keyword


CREATE TABLE Staff_table
(
StaffNo INT NOT NULL,
Name VARCHAR(40) NOT NULL,
Address VARCHAR(255) NOT NULL,
Salary INT NOT NULL,
DOB TIMESTAMP(6) NOT NULL,
OfficeNo INT NOT NULL,
PRIMARY KEY(StaffNo),
FOREIGN KEY(OfficeNo)
);
Reply With Quote
  #2 (permalink)  
Old 03-11-04, 04:32
omiossec omiossec is offline
Registered User
 
Join Date: Jan 2003
Location: Paris, France
Posts: 320
For Foreign key it should be

FOREIGN KEY contraint_name (OfficeNo) REFERENCE table_name (Col name)
__________________
Olivier Miossec
--
http://www.lasso-developpeur.net/
--
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On