Click here to Skip to main content
15,893,486 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When i wrote a program about database on SQL for setting up a data table ,the compiler showed a error ' there is a mistake between ' Cpno'' I can't find out the reason for the program isright,the wrriten is right. Please help me slove this problem.
(This is the program 'CREATE TABLE Course
(Cno CHAR(4) PRIMARY KEY,
Cname CHAR(40),
Cpno CHAR(4),
Ccredit SMALLIN,
FOREIGN KEY Cpno REFERENCES Course(Cno)
);
Posted

The problem is there is no data type named - SMALLIN

Try something like this it should work for you.

CREATE TABLE Course
(Cno CHAR(4) PRIMARY KEY,
Cname CHAR(40),
Cpno CHAR(4) REFERENCES Course(Cno),
Ccredit int,
);
 
Share this answer
 
Try this. I guess it should work.

SQL
CREATE TABLE Course
 (Cno CHAR(4) PRIMARY KEY,
 Cname CHAR(40),
 Cpno CHAR(4),
 Ccredit SMALLINt,
 FOREIGN KEY (Cpno) REFERENCES Course(Cno)
 ); 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900