You are here: Re: Learning php Sql « PHP SQL « IT news, forums, messages
Re: Learning php Sql

Posted by J.O. Aho on 10/07/70 11:48

Frankly wrote:
> "Frankly" <NotReal@yahoo.com> wrote in message news:...
> I have now created 4 almost 5 tables.
>
> the ManagementBuildings table shows as 2 tables - I think that is because
> of
> 2 primary keys?
>
> I am now on the apartments table and for some reason I can not complete it.
> I know the structure of the this and the other tables still needs to be
> tuned - but why
> this.. it didnt happen on any of my other tables :(
>
> SQL query:
>
> CREATE TABLE `Apartments` (
>
> `ApartmentID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
> `Rent` INT NOT NULL ,
> `Bedrooms` INT NOT NULL ,
> `ApartmentNumber` VARCHAR( 10 ) NOT NULL ,
> `MoveInDate` DATE NOT NULL ,
> `StillAvailable` ENUM NOT NULL ,
> `ApartmentContact` CHAR( 20 ) NOT NULL ,<----- this is where the problem
> is?.
> `ApartmentPhone` VARCHAR( 12 ) NOT NULL ,
> `Picture1` VARCHAR( 50 ) NOT NULL ,
> `Picture2` VARCHAR( 50 ) NOT NULL ,
> `Picture3` VARCHAR( 50 ) NOT NULL ,
> INDEX ( `Rent` )
> ) TYPE = MYISAM
>
> MySQL said:
>
> #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
> 'NOT NULL, `ApartmentContact` CHAR(20) NOT NULL, `ApartmentPhone

The problem lies before the 'NOT NULL, `ApartmentContact` CHAR(20) NOT NULL,
`ApartmentPhone', with other words the ENUM after `StillAvailable`, I would
choose to use INT(1) where default is 1 and if not available then set it to 0.

as IF(1) results in a true and IF(0) results in false.

If you still want to struggle with ENUM, then take a look here
http://dev.mysql.com/doc/refman/5.0/en/enum.html

You may run into problems with the type CHAR later on too, I would choose to
use VARCHAR instead.


//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация