MySQL Forums
Forum List  »  General

Re: mysql insert into syntax
Posted by: Arjen Lentz
Date: February 22, 2005 12:03AM

Charlotte Collis wrote:
> I am new to Mysql. I am creating a new databae and
> have created a table with varioius columns and
> have specified the data type for each column. The
> table was created successfuly. I now want to
> insert some data into the table. Using the insert
> into syntax I want to insert the data "f00105"
> into the column name "familyId" the table is
> called "familyContactInfo" the column "familyId"
> is set to varchar(7) and is the primary key
>
> I created the following query:
>
> insert into familyContactInfo, (familyId) values ("F00105")
>
> however it returns an error message saying the syntax is wrong. What am I doing wrong? Any help
> would be appreciated!

The error msg will have told you where the error occurs. If you can't work it out, it would of course help to paste the error on the forum too ;-)
But I think I can work it out anyway, you need to ditch the comma after familyContactinfo.

On a sidenote, a VARCHAR(7) is not a good candidate for a primary key. It can lead to some inefficiencies. Generally, a primary key should be a type of integer, preferably auto-increment.

Regards, Arjen.
--
Arjen Lentz, Exec.Director @ Open Query (http://openquery.com)
Remote expertise & maintenance for MySQL/MariaDB server environments.

Follow us at http://openquery.com/blog/ & http://twitter.com/openquery

Options: ReplyQuote


Subject
Written By
Posted
January 10, 2005 02:37PM
February 21, 2005 10:29AM
Re: mysql insert into syntax
February 22, 2005 12:03AM
February 22, 2005 03:11AM


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.