Jump to content

Could you tell me why is this code not working? I appreciate any help! Thanks.


layman

Recommended Posts

Hello,

 

Could you tell me why is this code not working? I appreciate any help! Thanks.

 

The error I am getting is:

#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 'number(5) not null default '', Product_review text(100), Product_brand var' at line 6

 

Server version: 5.1.41

I have created already the SYSTEM_ADMIN table I am referencing, so that one should not be the problem.

Can not see what is the problem with line 6. Can anyone spot it?

 

CREATE TABLE Products (
Grp ENUM('Motherboard', 'HardDrive', 'Processor', 'RAM', 'GraphicCard', 'SoundCard', 'USBPort', 'RouterSwitch', 'Server', 
'PowerAdaptor', 'Webcam', 'OperatingSystem', 'Software', 'CaseStyle', 'Speaker', 'FloppyDrive', 'OpticalStorage', 
'Monitor', 'Printer', 'Mouse', 'Keyboard') NOT NULL,
Serialno 	        varchar(20)	not null default '',
Product_name 		text(100)	not null default '',                                     line 6
Product_description 	text(100)	not null default '',
Product_price 		number(5)	not null default '',
Product_review 		text(100),
Product_brand 		varchar(30),
Product_type 		varchar(30),
Product_speed 		varchar(30),
Product_size 		varchar(30),
Product_dimensions 	varchar(30),
Product_on_board_devices varchar(30),	
Product_form_factor 	varchar(30),
Product_FSB 		varchar(30),
Product_secu_spec 	varchar(30),
Product_techn_stand 	varchar(30),
Product_maxres 	varchar(30),
Product_colour 	varchar(30),
Admin_id int(4) not null, 
    key Serialno(Serialno),
    PRIMARY KEY (Grp, Serialno),
FOREIGN KEY (Admin_id) references SYSTEM_ADMIN(Admin_id) on update cascade on delete cascade
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Link to comment
Share on other sites

Thank you!  I changed it to decimal(7,2), but still getting an 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 'text not null default '', Product_price decimal(7,2) not null default '', Pr' at line 5

 

Do you see what the problem is with my table?

 

CREATE TABLE Products (
Grp ENUM('Motherboard', 'HardDrive', 'Processor', 'RAM', 'GraphicCard', 'SoundCard', 'USBPort', 'RouterSwitch', 'Server', 'PowerAdaptor', 'Webcam', 'OperatingSystem', 'Software', 'CaseStyle', 'Speaker', 'FloppyDrive', 'OpticalStorage', 'Monitor', 'Printer', 'Mouse', 'Keyboard') NOT NULL,
Serialno 	        varchar(20) not null default '',
Product_name 		varchar(50) not null default '',
Product_description 	varchar(50)text not null default '',
Product_price 		decimal(7,2) not null default '',
Product_review 		varchar(70),
Product_brand 		varchar(30),
Product_type 		varchar(30),
Product_speed 		varchar(30),
Product_size 		varchar(30),
Product_dimensions 	varchar(30),
Product_on_board_dev 	varchar(30),	
Product_form_factor 	varchar(30),
Product_FSB 		varchar(30),
Product_secu_spec 	varchar(30),
Product_techn_stand 	varchar(30),
Product_maxres 		varchar(30),
Product_colour 		varchar(30),
Admin_id 		int(4) not null, 
    key Serialno(Serialno),
    PRIMARY KEY (Serialno),
FOREIGN KEY (Admin_id) references SYSTEM_ADMIN(Admin_id) on update cascade on delete cascade
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.