|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
I am trying to create a table for some articles. And this SQL isn't working. Please can someone explain why!
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre> CREATE TABLE articles ( name varchar(30), email varchar(30), club varchar(40), problem text, solution text, id varchar(20), section varchar(20), date varchar(20), time varchar(5), channel varchar(1), coaching text, explain text, subject varchar(40), PRIMARY KEY(id) ); [/code] Thanks, -------------------------------------------- Alex (http://www.alex-greg.co.uk) |
|
#2
|
|||
|
|||
|
date is a reserved word and cannot be used for a field name.
|
|
#3
|
||||
|
||||
|
If date is a reserved field, then how comes this work?
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre> CREATE TABLE noticeboard ( name varchar(30), email varchar(30), club varchar(40), problem text, solution text, id int(11) NOT NULL, section varchar(20), date varchar(20), time varchar(5), PRIMARY KEY (id) ); [/code] I am making some upgrades on this script and so I have had to modify the database. When I try to add this table via phpMyAdmin, I get this: MySQL said: You have an error in your SQL syntax near 'explain text, subject varchar(40), PRIMARY KEY(id) )' at line 13 |
|
#4
|
|||
|
|||
|
My mistake. Date is not reserved, explain is.
|
|
#5
|
||||
|
||||
|
OK thanks....are there any other reserved fields like this??
|
|
#6
|
|||
|
|||
|
They are listed in the manual. Too many to list here.
|
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > What is wrong with this SQL??? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|