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

What errors ?

Use plain brackets () instead of curly brackets {}
Add a semicolon ; after each statement (after "INNODB")

Think I need to get my eyes checked...

I did not see it either. But I copied the code into a test client which told me what was wrong.

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

1. Use plain brackets () instead of curly brackets {}
2. Add a semicolon ; after each statement (after "INNODB")

You forgot to change 1.

Apart from still using { } instead of ( )
where you have any line like this

SNAME varchar( 200 ) NOT NULL default,

you have to state what the default value is.
eg
SNAME varchar( 200 ) NOT NULL default 'fred',

so obviously you will have trouble setting default values for some fields, like name, address, post_code, in fact ALL the fields where you have used default!

Default is normally used where you can have the database automatically insert a valid default value - say no, which you will occasionally later set to yes . so in a houses for rent database, the default value for a new property for available would be yes, which you'd change to no whenever it was rented out. Your query to display available to rent property on a web site would then use "where available='yes' ", so visitors don't get excited about a property, only to discover it's been rented out for years.

Now THIS is a glider (and it's mine) ;)

Nice. I had the privilige of joining in a two-seater once. Very, very impressive...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.