Need help debugging my SQL code!

Page 1 of 1

1 Replies - 757 Views - Last Post: 13 October 2012 - 03:21 PM Rate Topic: -----

#1 -Nix-  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 49
  • Joined: 14-December 11

Need help debugging my SQL code!

Posted 13 October 2012 - 02:37 PM

Here it is, i keep getting missing parentheses errors, and i dont understand why. I also get a few other errors. I've been at it for 3 hours writing this (im new bare with me)


CREATE TABLE COURSE
(
CRS_CODE 		VARCHAR(8)	PRIMARY KEY,
CRS_DESCRIPTION 	VARCHAR(35)	NOT NULL,
CRS_CREDIT 		INTEGER(1) DEFAULT '4' NOT NULL CHECK(CRS_CREDIT IN ('1','2','3','4')),	       
)
;

CREATE TABLE XCLASS
(
CLASS_CODE		NUMBER(5)	PRIMARY KEY,				
CLASS_SECTION		NUMBER(1) DEFAULT '4' NOT NULL CHECK(CLASS_SECTION IN ('1','2','4','5','6','7','8')),
CLASS_TIME		VARCHAR(25)	NOT NULL,
CLASS_ROOM		NUMBER(6),
CRS_CODE		VARCHAR(8),
CONSTRAINT XCLASS_V_CODE_FK
FOREIGN KEY (CRS_CODE) REFERENCES COURSE )
;

CREATE TABLE ENROLL
(
CLASS_CODE	NUMBER(5),
STU_NUM		INTEGER(6)		NOT NULL,
ENROLL_GRADE	CHAR(1) DEFAULT 'Z' NOT NULL CHECK(ENROLL_GRADE IN ('A','B','C','D','F','I','W','Z')
PRIMARY KEY (CLASS_CODE, STU_NUM),
CONSTRAINT XCLASS_V_CODE_FK
FOREIGN KEY (CLASS_CODE) REFERENCES XCLASS )
)
;

CREATE TABLE STUDENT
(
STU_NUM			NUMBER(6)	PRIMARY KEY,
STU_LNAME		VARCHAR(25)	NOT NULL,
STU_FNAME		VARCHAR(20)	NOT NULL,
STU_INIT		CHAR(1),
STU_DOB			DATE		NOT NULL,
STU_HRS					DEFAILT'0',
STU_CLASS		CHAR(2)	NOT NULL CHECK(STU_CLASS IN ('Fr','So','Jr','Sr','Gr')),
STU_GPA			NUMBER(4,2)	DEFAULT'0',
STU_PHONE		NUMBER(4)	NOT NULL,
)
;




Is This A Good Question/Topic? 0
  • +

Replies To: Need help debugging my SQL code!

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6039
  • View blog
  • Posts: 23,436
  • Joined: 23-August 08

Re: Need help debugging my SQL code!

Posted 13 October 2012 - 03:21 PM

Please don't double-post.

Closed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1