I am stuck with SQL. I must admit that I am just starting to learn SQL. As a part of my uni assignment I have to create an ID collum that contains an autonumber. I've searched teh web and found IDENTITY but Im not sure if i've used it right. I get a "missing right parethesis" error with a star under the I.
CREATE TABLE COMPLAINT (
ID INTEGER IDENTITY(0,1),
DIAGNOSIS VARCHAR(40) NOT NULL,
MED_NUM CHAR(4) NOT NULL,
MED_SEQ CHAR(2) NOT NULL,
CONSTRAINT COMPK
PRIMARY KEY(ID),
CONSTRAINT COMFK
FOREIGN KEY(MED_NUM,MED_SEQ) REFERENCES PATIENT (MED_NUM,MED_SEQ)
);
Also i need to created a categorical list and that is giving me the same error as IDENTITY.
CREATE TABLE DRUG (
PKG_NAME VARCHAR(30) NOT NULL,
TECH_NAME VARCHAR(40) NOT NULL,
BATCH_NUM CHAR(7) NOT NULL,
FORM CATEGORICAL(2) VALUE LABELS ('T' 'TABLET','M' 'MIXTURE'),
DOSAGE INTEGER,
QUANTITY INTEGER NOT NULL,
CONSTRAINT DRUPK
PRIMARY KEY(BATCH_NUM)
);
Any help will be greatly appreciated
CREATE TABLE COMPLAINT (
ID INTEGER IDENTITY(0,1),
DIAGNOSIS VARCHAR(40) NOT NULL,
MED_NUM CHAR(4) NOT NULL,
MED_SEQ CHAR(2) NOT NULL,
CONSTRAINT COMPK
PRIMARY KEY(ID),
CONSTRAINT COMFK
FOREIGN KEY(MED_NUM,MED_SEQ) REFERENCES PATIENT (MED_NUM,MED_SEQ)
);
Also i need to created a categorical list and that is giving me the same error as IDENTITY.
CREATE TABLE DRUG (
PKG_NAME VARCHAR(30) NOT NULL,
TECH_NAME VARCHAR(40) NOT NULL,
BATCH_NUM CHAR(7) NOT NULL,
FORM CATEGORICAL(2) VALUE LABELS ('T' 'TABLET','M' 'MIXTURE'),
DOSAGE INTEGER,
QUANTITY INTEGER NOT NULL,
CONSTRAINT DRUPK
PRIMARY KEY(BATCH_NUM)
);
Any help will be greatly appreciated