Jump to content

help with mysql table structure


MDanz

Recommended Posts

when i put this in phpmyadmin i get errors... can anyone look over it and find a mistake..

 

CREATE TABLE Student {

SID int NOT NULL default,
SNAME varchar(200) NOT NULL default,
ADDRESS text NOT NULL default,
POST_CODE varchar(10) NOT NULL default,
PHOTO mediumblob NOT NULL default,

Primary Key (SID)


} ENGINE=INNODB



CREATE TABLE Course {

CID int NOT NULL default,
CNAME varchar(200) NOT NULL default,
DEPARTMENT text NOT NULL default,

Primary Key (CID)

} ENGINE=INNODB


CREATE TABLE Student-Course {
SID int NOT NULL default,
CID int NOT NULL default,
GRADE varchar(200) NOT NULL default,
COMMENTS text NOT NULL default,

Primary Key (SID,CID),
FOREIGN KEY (CID) REFERENCES Course (CID)  ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (SID) REFERENCES Student (SID) ON UPDATE CASCADE ON DELETE CASCADE
} ENGINE=INNODB

Link to comment
https://forums.phpfreaks.com/topic/223335-help-with-mysql-table-structure/
Share on other sites

CREATE TABLE Student{SID int( 8 ) NOT NULL AUTO_INCREMENT ,
SNAME varchar( 200 ) NOT NULL default,
ADDRESS text NOT NULL default,
POST_CODE varchar( 10 ) NOT NULL default,
PHOTO mediumblob NOT NULL default,
PRIMARY KEY ( SID ) } ENGINE = INNODB;

 

for this i get this error

 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{ SID int(8) NOT NULL auto_increment, SNAME varchar(200) NOT NULL default, ' at line 1

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.