MySQL Forums
Forum List  »  Newbie

Re: Insert command is failing
Posted by: Peter Brawley
Date: June 29, 2015 01:14PM

> create table complaints (date DATE, email VARCHAR(20), message VARCHAR(250), response VARCHAR(250));

A table without a primary key isnot a real table. It's most always a bad mistake to not give a table a primary key, eg ...

create table complaints (cid int unsigned primary key auto_increment, date DATE, email VARCHAR(20), message VARCHAR(250), response VARCHAR(250));

Read about primary keys and normalisation.

> insert into complaints (date,email,message,response) values ('2015-09-03','tony@gmail.com','Where's my money?','What money?');

Strings containing single quotes must be surrounded with double quotes, or alternatively have the single quotes escaped by the escape character (`\`).

Options: ReplyQuote


Subject
Written By
Posted
Re: Insert command is failing
June 29, 2015 01:14PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.