Web Hosting Talk







View Full Version : Newbie MySQL Help


MeAmRussian
04-19-2006, 04:54 PM
I'm practicing MySQL.

What's wrong with this simple table creation code?

create table business
( title char(30) not null,
suite int unsigned not null,
position int unsigned not null,
phone,
business_url,
our_url not null,
contact_first,
contact_last,
b_image1,
b_image2,
b_image3,
b_image4,
couponimage1,
couponimage2,
couponimage3,
couponimage4,
coupontext1,
coupontext2,
coupontext3,
coupontext4,
couponexp1,
couponexp2,
couponexp3,
couponexp4,
keywords not null,
couponkeywords
);

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 '
business_url,
our_url not null,
contact_first,
contact_last,
b_i' at line 5



Thanks.

Vdevelopers
04-19-2006, 05:19 PM
Don't you need to specify the types for all the fields phone and below??

RH Swaroop
04-19-2006, 05:25 PM
Edit: yeah, u will need to define the field type, buddy :)

MeAmRussian
04-19-2006, 07:26 PM
oh I see, thanks for the help!

fozzy
04-20-2006, 02:04 PM
Basic table creation:


create table my_table (
first_field int not null,
secon_field int,
third_field varchar(255),
PRIMARY KEY (first_field)
) type=innodb;


I think I hit of of the main points. Each field needs a type and the table itself needs a type.

superprogram
04-20-2006, 04:08 PM
and the table itself needs a type.??

thartdyke
04-20-2006, 04:57 PM
Sure - ISAM, MyISAM, MERGE, HEAP, BDB or InnoDB. MyISAM is the default, so you don't *have to specify a type.