1 Replies - 15109 Views - Last Post: 01 July 2011 - 06:17 PM

#1 gailian   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 06-December 08

syntax error with the period in between Customer and customerid

Posted 01 July 2011 - 05:48 PM

hello all, ive been trying to figure out a syntax error and getting no where, any help be apreciated.

create table Orders
	(
		orderid int, primary key , customerid integer foreign key (Customer.customerid) , 
		orderdate date null, shippeddate date null, quantity integer null  
	)

Is This A Good Question/Topic? 0
  • +

Replies To: syntax error with the period in between Customer and customerid

#2 smohd   User is offline

  • Critical Section
  • member icon


Reputation: 1825
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: syntax error with the period in between Customer and customerid

Posted 01 July 2011 - 06:17 PM

There is no comma after orderid int since you need to say it is primary key

Also to reference a column you may say:
 create table Orders
	(
		orderid int primary key , customerid integer , 
		orderdate date null, shippeddate date null, quantity integer null  
                constraint fk1 foreign key (customerid) references Customer(customerid)
	) 

This post has been edited by smohd: 01 July 2011 - 06:21 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1