I'm trying to create a table using PHPmyadmin, below is my SQL code
[code]
DROP TABLE IF EXISTS student CASCADE;
CREATE TABLE student(
StudentId VARCHAR2(8) NOT NULL,
FirstName VARCHAR2(20) NOT NULL,
MiddleNames VARCHAR2(20),
LastName VARCHAR2(20) NOT NULL,
CurrentYear VARCHAR2(20) NOT NULL,
DOB DATE NOT NULL,
EmailAddress VARCHAR2(50) NOT NULL,
PRIMARY KEY (StudentId)
);
DROP TABLE IF EXISTS researchdegree CASCADE;
CREATE TABLE researchdegree(
DegreeId VARCHAR2(8) NOT NULL,
DegreeName VARCHAR2(20) NOT NULL,
LengthYears NUMBER(1) NOT NULL,
PRIMARY KEY (DegreeId)
);
DROP TABLE IF EXISTS application CASCADE;
CREATE TABLE application(
AppId VARCHAR2(8) NOT NULL,
AppResult VARCHAR2(9),
StudentId VARCHAR2(8) NOT NULL REFERENCES student,
DegreeId VARCHAR2(8) NOT NULL REFERENCES researchdegree,
PRIMARY KEY (AppId)
);
DROP TABLE IF EXISTS interview CASCADE ;
CREATE TABLE interview(
InterviewId VARCHAR2(8) NOT NULL,
IDate DATE NOT NULL,
ITime VARCHAR2(5) NOT NULL,
Interviewer VARCHAR2(50) NOT NULL,
AppId VARCHAR2(8) NOT NULL REFERENCES application,
PRIMARY KEY (InterviewId)
);
DROP TABLE IF EXISTS reference CASCADE;
CREATE TABLE reference(
RefId VARCHAR2(8) NOT NULL,
SourceName VARCHAR2(50) NOT NULL,
SourceEmail VARCHAR2(320) NOT NULL,
RefContent VARCHAR2(1000) NOT NULL,
AppId VARCHAR2(8) NOT NULL REFERENCES application,
PRIMARY KEY (RefId)
);
DROP TABLE IF EXISTS viva CASCADE;
CREATE TABLE viva(
VivaId VARCHAR2(8) NOT NULL,
VDate DATE NOT NULL,
VTime VARCHAR2(5) NOT NULL,
Supervisor VARCHAR2(50) NOT NULL,
AppId VARCHAR2(8) NOT NULL REFERENCES application,
PRIMARY KEY (VivaId)
);
DROP TABLE IF EXISTS examiner CASCADE;
CREATE TABLE examiner(
ExaminerId VARCHAR2(8) NOT NULL PRIMARY KEY,
Phone VARCHAR2(11),
Email VARCHAR2(320),
PRIMARY KEY (ExaminerId)
);
[/code]The server is using "MySQL client version: 5.1.41" and gives the following error after executing the above code:
[IMG]http://i184.photobucket.com/albums/x268/pishkie/sqlerror.png[/IMG]
I'm not quite sure what's wrong, at first I thought it was being caused by incorrect use of the DATE type but after removing that line of code, the error still occurs in the same place :/
Any suggestions would be appreciated, thanks for reading :)
I don't think MySQL supports VARCHAR2()
Try VARCHAR(), shouldn't make a real difference.
Same goes for NUMBER, try tinyint(1)
Although that depends on how much / what kind of data do you want to store in it (TINYINT(1) holds = -9 to 9).
[QUOTE=MD1337;21741420]I don't think MySQL supports VARCHAR2()
Try VARCHAR(), shouldn't make a real difference.
Same goes for NUMBER, try tinyint(1)
Although that depends on how much / what kind of data do you want to store in it (TINYINT(1) holds = -9 to 9).[/QUOTE]
This. It isn't really my area, but I think that Varchar2 is strictly for Oracle databases. Unless you're dealing with HUGE (1k+) field entries, this shouldn't have any noticeable effects on your DB. If you're worried on maxing out the varchar types byte allowance, you could always use BLOBs I guess...
Thanks guys, problem solved. Many thanks!
Sorry, you need to Log In to post a reply to this thread.